From 6f80c6941de0a899ad8346efbd2f0e33f62eda39 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 27 Jan 2023 16:36:15 +0100 Subject: [PATCH] Fixed a erroneous warning message about missing authentication identities. Fixed a missing check for announce intervals being unset in the configuration. Fixes #12. --- LXMF/Utilities/lxmd.py | 25 ++++++++++++++----------- LXMF/_version.py | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/LXMF/Utilities/lxmd.py b/LXMF/Utilities/lxmd.py index d033424..69f05eb 100644 --- a/LXMF/Utilities/lxmd.py +++ b/LXMF/Utilities/lxmd.py @@ -302,6 +302,10 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo # Set up authentication if active_configuration["auth_required"]: message_router.set_authentication(required=True) + + if len(active_configuration["allowed_identities"]) == 0: + RNS.log("Clint authentication was enabled, but no identity hashes could be loaded from "+str(allowedpath)+". Nobody will be able to sync messages from this propagation node.", RNS.LOG_WARNING) + for identity_hash in active_configuration["allowed_identities"]: message_router.allow(identity_hash) @@ -322,9 +326,6 @@ def program_setup(configdir = None, rnsconfigdir = None, run_pn = False, on_inbo RNS.log("LXMF Propagation Node started on "+RNS.prettyhexrep(message_router.propagation_destination.hash)) - if len(active_configuration["allowed_identities"]) == 0: - RNS.log("Clint authentication was enabled, but no identity hashes could be loaded from "+str(allowedpath)+". Nobody will be able to sync messages from this propagation node.", RNS.LOG_WARNING) - RNS.log("Started lxmd version {version}".format(version=__version__), RNS.LOG_NOTICE) threading.Thread(target=deferred_start_jobs, daemon=True).start() @@ -338,15 +339,17 @@ def jobs(): while True: try: - if time.time() > last_peer_announce + active_configuration["peer_announce_interval"]: - RNS.log("Sending announce for LXMF delivery destination", RNS.LOG_EXTREME) - message_router.announce(lxmf_destination.hash) - last_peer_announce = time.time() + if "peer_announce_interval" in active_configuration and active_configuration["peer_announce_interval"] != None: + if time.time() > last_peer_announce + active_configuration["peer_announce_interval"]: + RNS.log("Sending announce for LXMF delivery destination", RNS.LOG_EXTREME) + message_router.announce(lxmf_destination.hash) + last_peer_announce = time.time() - if time.time() > last_node_announce + active_configuration["node_announce_interval"]: - RNS.log("Sending announce for LXMF Propagation Node", RNS.LOG_EXTREME) - message_router.announce_propagation_node() - last_node_announce = time.time() + if "node_announce_interval" in active_configuration and active_configuration["node_announce_interval"] != None: + if time.time() > last_node_announce + active_configuration["node_announce_interval"]: + RNS.log("Sending announce for LXMF Propagation Node", RNS.LOG_EXTREME) + message_router.announce_propagation_node() + last_node_announce = time.time() except Exception as e: RNS.log("An error occurred while running periodic jobs. The contained exception was: "+str(e), RNS.LOG_ERROR) diff --git a/LXMF/_version.py b/LXMF/_version.py index 75cf783..493f741 100644 --- a/LXMF/_version.py +++ b/LXMF/_version.py @@ -1 +1 @@ -__version__ = "0.2.9" +__version__ = "0.3.0"