mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-25 14:50:37 +01:00
Added I2P connectivity. Added android/desktop awareness for connectivity settings.
This commit is contained in:
parent
163df580c0
commit
40cd0b54ab
105
main.py
105
main.py
@ -484,6 +484,27 @@ class SidebandApp(MDApp):
|
|||||||
### Connectivity screen
|
### Connectivity screen
|
||||||
######################################
|
######################################
|
||||||
def connectivity_action(self, sender=None):
|
def connectivity_action(self, sender=None):
|
||||||
|
def con_hide_settings():
|
||||||
|
self.widget_hide(self.root.ids.connectivity_use_local)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_local_groupid)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_local_ifac_netname)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_local_ifac_passphrase)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_use_tcp)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_tcp_host)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_tcp_port)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_tcp_ifac_netname)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_tcp_ifac_passphrase)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_use_i2p)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_i2p_b32)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_i2p_ifac_netname)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_i2p_ifac_passphrase)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_tcp_label)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_local_label)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_i2p_label)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_rnode_label)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_use_rnode)
|
||||||
|
self.widget_hide(self.root.ids.connectivity_rnode_cid)
|
||||||
|
|
||||||
def save_connectivity(sender=None, event=None):
|
def save_connectivity(sender=None, event=None):
|
||||||
RNS.log("Save connectivity")
|
RNS.log("Save connectivity")
|
||||||
self.sideband.config["connect_local"] = self.root.ids.connectivity_use_local.active
|
self.sideband.config["connect_local"] = self.root.ids.connectivity_use_local.active
|
||||||
@ -501,40 +522,64 @@ class SidebandApp(MDApp):
|
|||||||
self.sideband.config["connect_i2p_ifac_passphrase"] = self.root.ids.connectivity_i2p_ifac_passphrase.text
|
self.sideband.config["connect_i2p_ifac_passphrase"] = self.root.ids.connectivity_i2p_ifac_passphrase.text
|
||||||
self.sideband.save_configuration()
|
self.sideband.save_configuration()
|
||||||
|
|
||||||
info = "By default, sideband will try to discover and connect to any available Reticulum network via active WiFi and/or Ethernet interfaces. If any Reticulum Transport Instances are found, Sideband will use these to connect to wider Reticulum networks. You can disable this behaviour if you don't want it.\n\n"
|
if RNS.vendor.platformutils.get_platform() == "android":
|
||||||
info += "You can connect also connect to a network via a remote or local Reticulum instance using TCP or I2P. [b]Please Note![/b] Connecting via I2P requires that you already have I2P running on your device, and the SAM API enabled.\n\n"
|
if self.sideband.reticulum.is_connected_to_shared_instance:
|
||||||
info += "For changes to connectivity to take effect, you must shut down and restart Sideband."
|
info = "Sideband is connected via a shared Reticulum instance running on this system.\n\n"
|
||||||
self.root.ids.connectivity_info.text = info
|
info += "To configure connectivity, edit the relevant configuration file for the instance."
|
||||||
|
self.root.ids.connectivity_info.text = info
|
||||||
|
con_hide_settings()
|
||||||
|
|
||||||
self.root.ids.connectivity_use_local.active = self.sideband.config["connect_local"]
|
else:
|
||||||
self.root.ids.connectivity_local_groupid.text = self.sideband.config["connect_local_groupid"]
|
info = "By default, Sideband will try to discover and connect to any available Reticulum networks via active WiFi and/or Ethernet interfaces. If any Reticulum Transport Instances are found, Sideband will use these to connect to wider Reticulum networks. You can disable this behaviour if you don't want it.\n\n"
|
||||||
self.root.ids.connectivity_local_ifac_netname.text = self.sideband.config["connect_local_ifac_netname"]
|
info += "You can also connect to a network via a remote or local Reticulum instance using TCP or I2P. [b]Please Note![/b] Connecting via I2P requires that you already have I2P running on your device, and that the SAM API is enabled.\n\n"
|
||||||
self.root.ids.connectivity_local_ifac_passphrase.text = self.sideband.config["connect_local_ifac_passphrase"]
|
info += "For changes to connectivity to take effect, you must shut down and restart Sideband."
|
||||||
|
self.root.ids.connectivity_info.text = info
|
||||||
|
|
||||||
self.root.ids.connectivity_use_tcp.active = self.sideband.config["connect_tcp"]
|
self.root.ids.connectivity_use_local.active = self.sideband.config["connect_local"]
|
||||||
self.root.ids.connectivity_tcp_host.text = self.sideband.config["connect_tcp_host"]
|
self.root.ids.connectivity_local_groupid.text = self.sideband.config["connect_local_groupid"]
|
||||||
self.root.ids.connectivity_tcp_port.text = self.sideband.config["connect_tcp_port"]
|
self.root.ids.connectivity_local_ifac_netname.text = self.sideband.config["connect_local_ifac_netname"]
|
||||||
self.root.ids.connectivity_tcp_ifac_netname.text = self.sideband.config["connect_tcp_ifac_netname"]
|
self.root.ids.connectivity_local_ifac_passphrase.text = self.sideband.config["connect_local_ifac_passphrase"]
|
||||||
self.root.ids.connectivity_tcp_ifac_passphrase.text = self.sideband.config["connect_tcp_ifac_passphrase"]
|
|
||||||
|
|
||||||
self.root.ids.connectivity_use_i2p.active = self.sideband.config["connect_i2p"]
|
self.root.ids.connectivity_use_tcp.active = self.sideband.config["connect_tcp"]
|
||||||
self.root.ids.connectivity_i2p_b32.text = self.sideband.config["connect_i2p_b32"]
|
self.root.ids.connectivity_tcp_host.text = self.sideband.config["connect_tcp_host"]
|
||||||
self.root.ids.connectivity_i2p_ifac_netname.text = self.sideband.config["connect_i2p_ifac_netname"]
|
self.root.ids.connectivity_tcp_port.text = self.sideband.config["connect_tcp_port"]
|
||||||
self.root.ids.connectivity_i2p_ifac_passphrase.text = self.sideband.config["connect_i2p_ifac_passphrase"]
|
self.root.ids.connectivity_tcp_ifac_netname.text = self.sideband.config["connect_tcp_ifac_netname"]
|
||||||
|
self.root.ids.connectivity_tcp_ifac_passphrase.text = self.sideband.config["connect_tcp_ifac_passphrase"]
|
||||||
|
|
||||||
self.root.ids.connectivity_use_local.bind(active=save_connectivity)
|
self.root.ids.connectivity_use_i2p.active = self.sideband.config["connect_i2p"]
|
||||||
self.root.ids.connectivity_local_groupid.bind(on_text_validate=save_connectivity)
|
self.root.ids.connectivity_i2p_b32.text = self.sideband.config["connect_i2p_b32"]
|
||||||
self.root.ids.connectivity_local_ifac_netname.bind(on_text_validate=save_connectivity)
|
self.root.ids.connectivity_i2p_ifac_netname.text = self.sideband.config["connect_i2p_ifac_netname"]
|
||||||
self.root.ids.connectivity_local_ifac_passphrase.bind(on_text_validate=save_connectivity)
|
self.root.ids.connectivity_i2p_ifac_passphrase.text = self.sideband.config["connect_i2p_ifac_passphrase"]
|
||||||
self.root.ids.connectivity_use_tcp.bind(active=save_connectivity)
|
|
||||||
self.root.ids.connectivity_tcp_host.bind(on_text_validate=save_connectivity)
|
self.root.ids.connectivity_use_local.bind(active=save_connectivity)
|
||||||
self.root.ids.connectivity_tcp_port.bind(on_text_validate=save_connectivity)
|
self.root.ids.connectivity_local_groupid.bind(on_text_validate=save_connectivity)
|
||||||
self.root.ids.connectivity_tcp_ifac_netname.bind(on_text_validate=save_connectivity)
|
self.root.ids.connectivity_local_ifac_netname.bind(on_text_validate=save_connectivity)
|
||||||
self.root.ids.connectivity_tcp_ifac_passphrase.bind(on_text_validate=save_connectivity)
|
self.root.ids.connectivity_local_ifac_passphrase.bind(on_text_validate=save_connectivity)
|
||||||
self.root.ids.connectivity_use_i2p.bind(active=save_connectivity)
|
self.root.ids.connectivity_use_tcp.bind(active=save_connectivity)
|
||||||
self.root.ids.connectivity_i2p_b32.bind(on_text_validate=save_connectivity)
|
self.root.ids.connectivity_tcp_host.bind(on_text_validate=save_connectivity)
|
||||||
self.root.ids.connectivity_i2p_ifac_netname.bind(on_text_validate=save_connectivity)
|
self.root.ids.connectivity_tcp_port.bind(on_text_validate=save_connectivity)
|
||||||
self.root.ids.connectivity_i2p_ifac_passphrase.bind(on_text_validate=save_connectivity)
|
self.root.ids.connectivity_tcp_ifac_netname.bind(on_text_validate=save_connectivity)
|
||||||
|
self.root.ids.connectivity_tcp_ifac_passphrase.bind(on_text_validate=save_connectivity)
|
||||||
|
self.root.ids.connectivity_use_i2p.bind(active=save_connectivity)
|
||||||
|
self.root.ids.connectivity_i2p_b32.bind(on_text_validate=save_connectivity)
|
||||||
|
self.root.ids.connectivity_i2p_ifac_netname.bind(on_text_validate=save_connectivity)
|
||||||
|
self.root.ids.connectivity_i2p_ifac_passphrase.bind(on_text_validate=save_connectivity)
|
||||||
|
|
||||||
|
else:
|
||||||
|
info = ""
|
||||||
|
|
||||||
|
if self.sideband.reticulum.is_connected_to_shared_instance:
|
||||||
|
info = "Sideband is connected via a shared Reticulum instance running on this system.\n\n"
|
||||||
|
info += "To configure connectivity, edit the configuration file located at:\n\n"
|
||||||
|
info += str(RNS.Reticulum.configpath)
|
||||||
|
else:
|
||||||
|
info = "Sideband is currently running a standalone or master Reticulum instance on this system.\n\n"
|
||||||
|
info += "To configure connectivity, edit the configuration file located at:\n\n"
|
||||||
|
info += str(RNS.Reticulum.configpath)
|
||||||
|
|
||||||
|
self.root.ids.connectivity_info.text = info
|
||||||
|
|
||||||
|
con_hide_settings()
|
||||||
|
|
||||||
self.root.ids.screen_manager.transition.direction = "left"
|
self.root.ids.screen_manager.transition.direction = "left"
|
||||||
self.root.ids.screen_manager.current = "connectivity_screen"
|
self.root.ids.screen_manager.current = "connectivity_screen"
|
||||||
|
@ -791,11 +791,11 @@ class SidebandCore():
|
|||||||
else:
|
else:
|
||||||
ifac_netkey = self.config["connect_i2p_ifac_passphrase"]
|
ifac_netkey = self.config["connect_i2p_ifac_passphrase"]
|
||||||
|
|
||||||
i2pinterface = I2PInterface.I2PInterface(
|
i2pinterface = RNS.Interfaces.I2PInterface.I2PInterface(
|
||||||
RNS.Transport,
|
RNS.Transport,
|
||||||
"I2PInterface",
|
"I2PInterface",
|
||||||
RNS.Reticulum.storagepath,
|
RNS.Reticulum.storagepath,
|
||||||
self.config["connect_i2p_b32"],
|
[self.config["connect_i2p_b32"]],
|
||||||
connectable = False,
|
connectable = False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -175,6 +175,7 @@ MDNavigationLayout:
|
|||||||
height: dp(48)
|
height: dp(48)
|
||||||
|
|
||||||
MDLabel:
|
MDLabel:
|
||||||
|
id: connectivity_local_label
|
||||||
text: "Connect via local WiFi/Ethernet"
|
text: "Connect via local WiFi/Ethernet"
|
||||||
font_style: "H6"
|
font_style: "H6"
|
||||||
|
|
||||||
@ -214,6 +215,7 @@ MDNavigationLayout:
|
|||||||
height: dp(48)
|
height: dp(48)
|
||||||
|
|
||||||
MDLabel:
|
MDLabel:
|
||||||
|
id: connectivity_tcp_label
|
||||||
text: "Connect via TCP"
|
text: "Connect via TCP"
|
||||||
font_style: "H6"
|
font_style: "H6"
|
||||||
|
|
||||||
@ -255,6 +257,7 @@ MDNavigationLayout:
|
|||||||
height: dp(48)
|
height: dp(48)
|
||||||
|
|
||||||
MDLabel:
|
MDLabel:
|
||||||
|
id: connectivity_i2p_label
|
||||||
text: "Connect via I2P"
|
text: "Connect via I2P"
|
||||||
font_style: "H6"
|
font_style: "H6"
|
||||||
|
|
||||||
@ -290,6 +293,7 @@ MDNavigationLayout:
|
|||||||
height: dp(48)
|
height: dp(48)
|
||||||
|
|
||||||
MDLabel:
|
MDLabel:
|
||||||
|
id: connectivity_rnode_label
|
||||||
text: "Connect via RNode"
|
text: "Connect via RNode"
|
||||||
font_style: "H6"
|
font_style: "H6"
|
||||||
disabled: True
|
disabled: True
|
||||||
|
Loading…
Reference in New Issue
Block a user