Fixed a erroneous warning message about missing authentication identities. Fixed a missing check for announce intervals being unset in the configuration. Fixes #12.

This commit is contained in:
Mark Qvist 2023-01-27 16:36:15 +01:00
parent 8c94118e07
commit 6f80c6941d
2 changed files with 15 additions and 12 deletions

View File

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

View File

@ -1 +1 @@
__version__ = "0.2.9"
__version__ = "0.3.0"