Added ability to allow transfers of LXMs larger than 1 megabyte

This commit is contained in:
Mark Qvist 2024-03-19 11:56:21 +01:00
parent b87b80f152
commit bfcff07025
4 changed files with 34 additions and 2 deletions

View File

@ -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)

View File

@ -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"])

View File

@ -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

View File

@ -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+" "