Added handling for authenticated propagation nodes

This commit is contained in:
Mark Qvist 2022-06-17 13:43:38 +02:00
parent 2354ba3412
commit 7a625d677d
2 changed files with 11 additions and 4 deletions

View File

@ -255,6 +255,9 @@ class NomadNetworkApp:
if self.enable_node:
self.message_router.enable_propagation()
# TODO: Set LXMF storage limits
RNS.log("LXMF Propagation Node started on: "+RNS.prettyhexrep(self.message_router.propagation_destination.hash))
self.node = nomadnet.Node(self)
else:
@ -352,6 +355,10 @@ class NomadNetworkApp:
return "Done, no new messages"
else:
return "Downloaded "+str(new_msgs)+" new messages"
elif self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_NO_IDENTITY_RCVD:
return "Node did not receive identification"
elif self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_NO_ACCESS:
return "Node did not allow request"
else:
return "Unknown"
@ -379,7 +386,7 @@ class NomadNetworkApp:
return self.message_router.propagation_transfer_progress
def request_lxmf_sync(self, limit = None):
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state >= LXMF.LXMRouter.PR_COMPLETE:
self.peer_settings["last_lxmf_sync"] = time.time()
self.save_peer_settings()
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)

View File

@ -334,7 +334,7 @@ class ConversationsDisplay():
self.dialog_open = False
self.sync_dialog = None
self.update_conversation_list()
if self.app.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
if self.app.message_router.propagation_transfer_state >= LXMF.LXMRouter.PR_COMPLETE:
self.app.cancel_lxmf_sync()
max_messages_group = []
@ -360,7 +360,7 @@ class ConversationsDisplay():
real_sync_button = urwid.Button("Sync Now", on_press=sync_now)
hidden_sync_button = urwid.Button("Cancel Sync", on_press=cancel_sync)
if self.app.get_sync_status() == "Idle" or self.app.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
if self.app.get_sync_status() == "Idle" or self.app.message_router.propagation_transfer_state >= LXMF.LXMRouter.PR_COMPLETE:
sync_button = real_sync_button
else:
sync_button = hidden_sync_button
@ -423,7 +423,7 @@ class ConversationsDisplay():
if self.dialog_open and self.sync_dialog != None:
self.sync_dialog.sync_progress.set_completion(self.app.get_sync_progress())
if self.app.get_sync_status() == "Idle" or self.app.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
if self.app.get_sync_status() == "Idle" or self.app.message_router.propagation_transfer_state >= LXMF.LXMRouter.PR_COMPLETE:
self.sync_dialog.bc.contents[0] = (self.sync_dialog.real_sync_button, self.sync_dialog.bc.options("weight", 0.45))
else:
self.sync_dialog.bc.contents[0] = (self.sync_dialog.hidden_sync_button, self.sync_dialog.bc.options("weight", 0.45))