diff --git a/sbapp/main.py b/sbapp/main.py index 5bcb6cc..8abc5bc 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -3540,6 +3540,7 @@ class SidebandApp(MDApp): def save_connectivity(sender=None, event=None): self.sideband.config["connect_transport"] = self.connectivity_screen.ids.connectivity_enable_transport.active + self.sideband.config["connect_share_instance"] = self.connectivity_screen.ids.connectivity_share_instance.active self.sideband.config["connect_local"] = self.connectivity_screen.ids.connectivity_use_local.active self.sideband.config["connect_local_groupid"] = self.connectivity_screen.ids.connectivity_local_groupid.text self.sideband.config["connect_local_ifac_netname"] = self.connectivity_screen.ids.connectivity_local_ifac_netname.text @@ -3697,6 +3698,10 @@ class SidebandApp(MDApp): self.connectivity_screen.ids.connectivity_enable_transport.active = self.sideband.config["connect_transport"] con_collapse_transport(collapse=not self.sideband.config["connect_transport"]) self.connectivity_screen.ids.connectivity_enable_transport.bind(active=save_connectivity) + + self.connectivity_screen.ids.connectivity_share_instance.active = self.sideband.config["connect_share_instance"] + self.connectivity_screen.ids.connectivity_share_instance.bind(active=save_connectivity) + self.connectivity_screen.ids.connectivity_local_ifmode.text = self.sideband.config["connect_ifmode_local"].capitalize() self.connectivity_screen.ids.connectivity_tcp_ifmode.text = self.sideband.config["connect_ifmode_tcp"].capitalize() self.connectivity_screen.ids.connectivity_i2p_ifmode.text = self.sideband.config["connect_ifmode_i2p"].capitalize() @@ -3776,7 +3781,8 @@ class SidebandApp(MDApp): dialog.dismiss() yes_button.bind(on_release=dl_yes) - rpc_string = "rpc_key = "+RNS.hexrep(self.sideband.reticulum.rpc_key, delimit=False) + rpc_string = "shared_instance_type = tcp\n" + rpc_string += "rpc_key = "+RNS.hexrep(self.sideband.reticulum.rpc_key, delimit=False) Clipboard.copy(rpc_string) dialog.open() diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 6a288a9..dff6a52 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -663,6 +663,8 @@ class SidebandCore(): self.config["config_template"] = None if not "connect_transport" in self.config: self.config["connect_transport"] = False + if not "connect_share_instance" in self.config: + self.config["connect_share_instance"] = False if not "connect_rnode" in self.config: self.config["connect_rnode"] = False if not "connect_rnode_ifac_netname" in self.config: @@ -4114,7 +4116,11 @@ class SidebandCore(): self.setstate("init.loadingstate", "Substantiating Reticulum") try: - self.reticulum = RNS.Reticulum(configdir=self.rns_configdir, loglevel=selected_level, logdest=self._log_handler) + if RNS.vendor.platformutils.is_android() and self.config["connect_share_instance"] == True: + self.reticulum = RNS.Reticulum(configdir=self.rns_configdir, loglevel=selected_level, logdest=self._log_handler, shared_instance_type="tcp") + else: + self.reticulum = RNS.Reticulum(configdir=self.rns_configdir, loglevel=selected_level, logdest=self._log_handler) + if RNS.vendor.platformutils.is_android(): if self.is_service: if os.path.isfile(self.rns_configdir+"/config_template_invalid"): diff --git a/sbapp/ui/layouts.py b/sbapp/ui/layouts.py index e520c34..48ff811 100644 --- a/sbapp/ui/layouts.py +++ b/sbapp/ui/layouts.py @@ -641,15 +641,33 @@ MDScreen: # font_size: dp(24) # # disabled: True - MDLabel: - text: "Shared Instance Access\\n" - id: connectivity_shared_access_label - font_style: "H5" + # MDLabel: + # text: "Shared Instance Access\\n" + # id: connectivity_shared_access_label + # font_style: "H5" + + MDBoxLayout: + orientation: "horizontal" + padding: [0,0,dp(24),0] + size_hint_y: None + height: dp(24) + + MDLabel: + id: connectivity_shared_label + text: "Share Reticulum Instance" + font_style: "H6" + # disabled: True + + MDSwitch: + id: connectivity_share_instance + active: False + pos_hint: {"center_y": 0.3} + # disabled: True MDLabel: id: connectivity_shared_access markup: True - text: "The Reticulum instance launched by Sideband will be available for other programs on this system. By default, this grants connectivity to other local Reticulum-based programs, but no access to management, interface status and path information.\\n\\nIf you want to allow full functionality and ability to manage the running instance, you will need to configure other programs to use the correct RPC key for this instance.\\n\\nThis can be very useful for using other tools related to Reticulum, for example via command-line programs running in Termux. To do this, use the button below to copy the RPC key configuration line, and paste it into the Reticulum configuration file within the Termux environment, or other program.\\n\\nPlease note! [b]It is not necessary[/b] to enable Reticulum Transport for this to work!\\n\\n" + text: "You can make the Reticulum instance launched by Sideband available for other programs on this system. By default, this grants connectivity to other local Reticulum-based programs, but no access to management, interface status and path information.\\n\\nIf you want to allow full functionality and ability to manage the running instance, you will need to configure other programs to use the correct RPC key for this instance.\\n\\nThis can be very useful for using other tools related to Reticulum, for example via command-line programs running in Termux. To do this, use the button below to copy the RPC key configuration line, and paste it into the Reticulum configuration file within the Termux environment, or other program.\\n\\nPlease note! [b]It is not necessary[/b] to enable Reticulum Transport for this to work!\\n\\n" size_hint_y: None text_size: self.width, None height: self.texture_size[1]