diff --git a/sbapp/main.py b/sbapp/main.py index f2032e1..bf23f2f 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -2010,6 +2010,10 @@ class SidebandApp(MDApp): self.sideband.config["lxmf_sync_limit"] = self.settings_screen.ids.settings_lxmf_sync_limit.active self.sideband.save_configuration() + def save_lxm_limit_1mb(sender=None, event=None): + self.sideband.config["lxm_limit_1mb"] = self.settings_screen.ids.settings_lxm_limit_1mb.active + self.sideband.save_configuration() + def save_debug(sender=None, event=None): self.sideband.config["debug"] = self.settings_screen.ids.settings_debug.active self.sideband.save_configuration() @@ -2128,6 +2132,9 @@ class SidebandApp(MDApp): self.settings_screen.ids.settings_lxmf_sync_limit.active = sync_limit self.settings_screen.ids.settings_lxmf_sync_limit.bind(active=save_lxmf_sync_limit) + self.settings_screen.ids.settings_lxm_limit_1mb.active = self.sideband.config["lxm_limit_1mb"] + self.settings_screen.ids.settings_lxm_limit_1mb.bind(active=save_lxm_limit_1mb) + self.settings_screen.ids.settings_debug.active = self.sideband.config["debug"] self.settings_screen.ids.settings_debug.bind(active=save_debug) diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 47258f9..5d06fc3 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -284,6 +284,7 @@ class SidebandCore(): self.config["nn_home_node"] = None self.config["print_command"] = "lp" self.config["eink_mode"] = False + self.config["lxm_limit_1mb"] = True # Connectivity self.config["connect_transport"] = False @@ -413,6 +414,8 @@ class SidebandCore(): self.config["eink_mode"] = False if not "display_style_in_contact_list" in self.config: self.config["display_style_in_contact_list"] = False + if not "lxm_limit_1mb" in self.config: + self.config["lxm_limit_1mb"] = True if not "input_language" in self.config: self.config["input_language"] = None @@ -3142,7 +3145,13 @@ class SidebandCore(): RNS.log("Reticulum started, activating LXMF...") self.setstate("init.loadingstate", "Activating LXMF Router") - self.message_router = LXMF.LXMRouter(identity = self.identity, storagepath = self.lxmf_storage, autopeer = True) + + if self.config["lxm_limit_1mb"]: + lxm_limit = 1000 + else: + lxm_limit = 128*1000 + + self.message_router = LXMF.LXMRouter(identity = self.identity, storagepath = self.lxmf_storage, autopeer = True, delivery_limit = lxm_limit) self.message_router.register_delivery_callback(self.lxmf_delivery) self.lxmf_destination = self.message_router.register_delivery_identity(self.identity, display_name=self.config["display_name"]) diff --git a/sbapp/ui/layouts.py b/sbapp/ui/layouts.py index c5d895b..877486e 100644 --- a/sbapp/ui/layouts.py +++ b/sbapp/ui/layouts.py @@ -1372,6 +1372,22 @@ MDScreen: disabled: False active: False + MDBoxLayout: + orientation: "horizontal" + size_hint_y: None + padding: [0,0,dp(24),dp(0)] + height: dp(48) + + MDLabel: + text: "Limit incoming messages to 1MB" + font_style: "H6" + + MDSwitch: + id: settings_lxm_limit_1mb + pos_hint: {"center_y": 0.3} + disabled: False + active: False + MDBoxLayout: orientation: "horizontal" size_hint_y: None diff --git a/sbapp/ui/messages.py b/sbapp/ui/messages.py index c83387c..1ac5cc5 100644 --- a/sbapp/ui/messages.py +++ b/sbapp/ui/messages.py @@ -143,7 +143,7 @@ class Messages(): prgstr = "" prg = self.app.sideband.get_lxm_progress(msg["hash"]) if prg != None: - prgstr = ", "+str(round(prg*100, 1))+"% progress" + prgstr = ", "+str(round(prg*100, 1))+"% done" if msg["title"]: titlestr = "[b]Title[/b] "+msg["title"].decode("utf-8")+"\n" w.heading = titlestr+"[b]Sent[/b] "+txstr+"\n[b]State[/b] Sending"+prgstr+" "