mirror of
https://github.com/SebastianObi/LXMF-Tools.git
synced 2025-12-22 10:27:12 +00:00
Bug fixing and improvement
This commit is contained in:
@@ -6,6 +6,8 @@ last_heartbeat = 0000-00-00 00:00:00
|
||||
enabled_local = True
|
||||
enabled_cluster = True
|
||||
auto_add_user_announce = False
|
||||
auto_add_user_announce_hop_min = 0
|
||||
auto_add_user_announce_hop_max = 0
|
||||
auto_add_user_message = True
|
||||
auto_add_user_type = user
|
||||
auto_add_cluster = True
|
||||
|
||||
@@ -6,6 +6,8 @@ last_heartbeat = 0000-00-00 00:00:00
|
||||
enabled_local = True
|
||||
enabled_cluster = True
|
||||
auto_add_user_announce = False
|
||||
auto_add_user_announce_hop_min = 0
|
||||
auto_add_user_announce_hop_max = 0
|
||||
auto_add_user_message = True
|
||||
auto_add_user_type = user
|
||||
auto_add_cluster = True
|
||||
|
||||
@@ -896,6 +896,15 @@ class lxmf_announce_callback:
|
||||
if DATA["main"].getboolean("auto_add_user_announce"):
|
||||
source_hash = RNS.hexrep(destination_hash, False)
|
||||
exist = False
|
||||
|
||||
hop_count = RNS.Transport.hops_to(destination_hash)
|
||||
hop_min = DATA.getint("main", "auto_add_user_announce_hop_min")
|
||||
hop_max = DATA.getint("main", "auto_add_user_announce_hop_max")
|
||||
if hop_min > 0 and hop_count < hop_min:
|
||||
exist = True
|
||||
if hop_max > 0 and hop_count < hop_max:
|
||||
exist = True
|
||||
|
||||
for section in DATA.sections():
|
||||
for (key, val) in DATA.items(section):
|
||||
if key == source_hash:
|
||||
@@ -4221,7 +4230,9 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
|
||||
except:
|
||||
pass
|
||||
if len(fields) > 0:
|
||||
announce_data = umsgpack.packb({ANNOUNCE_DATA_CONTENT: CONFIG["lxmf"]["display_name"].encode("utf-8"), ANNOUNCE_DATA_TITLE: None, ANNOUNCE_DATA_FIELDS: fields})
|
||||
announce_data = {ANNOUNCE_DATA_CONTENT: CONFIG["lxmf"]["display_name"].encode("utf-8"), ANNOUNCE_DATA_TITLE: None, ANNOUNCE_DATA_FIELDS: fields}
|
||||
log("LXMF - Configured announce data: "+str(announce_data), LOG_DEBUG)
|
||||
announce_data = umsgpack.packb(announce_data)
|
||||
elif CONFIG["lxmf"]["destination_type_conv"] != "":
|
||||
display_name += chr(CONFIG["lxmf"].getint("destination_type_conv"))
|
||||
|
||||
@@ -5735,6 +5746,8 @@ last_heartbeat = 0000-00-00 00:00:00
|
||||
enabled_local = True
|
||||
enabled_cluster = True
|
||||
auto_add_user_announce = False
|
||||
auto_add_user_announce_hop_min = 0
|
||||
auto_add_user_announce_hop_max = 0
|
||||
auto_add_user_message = True
|
||||
auto_add_user_type = user
|
||||
auto_add_cluster = True
|
||||
|
||||
@@ -6,6 +6,8 @@ last_heartbeat = 0000-00-00 00:00:00
|
||||
enabled_local = True
|
||||
enabled_cluster = True
|
||||
auto_add_user_announce = False
|
||||
auto_add_user_announce_hop_min = 0
|
||||
auto_add_user_announce_hop_max = 0
|
||||
auto_add_user_message = True
|
||||
auto_add_user_type = user
|
||||
auto_add_cluster = True
|
||||
|
||||
@@ -6,6 +6,8 @@ last_heartbeat = 0000-00-00 00:00:00
|
||||
enabled_local = True
|
||||
enabled_cluster = True
|
||||
auto_add_user_announce = False
|
||||
auto_add_user_announce_hop_min = 0
|
||||
auto_add_user_announce_hop_max = 0
|
||||
auto_add_user_message = True
|
||||
auto_add_user_type = user
|
||||
auto_add_cluster = True
|
||||
|
||||
@@ -896,6 +896,15 @@ class lxmf_announce_callback:
|
||||
if DATA["main"].getboolean("auto_add_user_announce"):
|
||||
source_hash = RNS.hexrep(destination_hash, False)
|
||||
exist = False
|
||||
|
||||
hop_count = RNS.Transport.hops_to(destination_hash)
|
||||
hop_min = DATA.getint("main", "auto_add_user_announce_hop_min")
|
||||
hop_max = DATA.getint("main", "auto_add_user_announce_hop_max")
|
||||
if hop_min > 0 and hop_count < hop_min:
|
||||
exist = True
|
||||
if hop_max > 0 and hop_count < hop_max:
|
||||
exist = True
|
||||
|
||||
for section in DATA.sections():
|
||||
for (key, val) in DATA.items(section):
|
||||
if key == source_hash:
|
||||
@@ -4221,7 +4230,9 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
|
||||
except:
|
||||
pass
|
||||
if len(fields) > 0:
|
||||
announce_data = umsgpack.packb({ANNOUNCE_DATA_CONTENT: CONFIG["lxmf"]["display_name"].encode("utf-8"), ANNOUNCE_DATA_TITLE: None, ANNOUNCE_DATA_FIELDS: fields})
|
||||
announce_data = {ANNOUNCE_DATA_CONTENT: CONFIG["lxmf"]["display_name"].encode("utf-8"), ANNOUNCE_DATA_TITLE: None, ANNOUNCE_DATA_FIELDS: fields}
|
||||
log("LXMF - Configured announce data: "+str(announce_data), LOG_DEBUG)
|
||||
announce_data = umsgpack.packb(announce_data)
|
||||
elif CONFIG["lxmf"]["destination_type_conv"] != "":
|
||||
display_name += chr(CONFIG["lxmf"].getint("destination_type_conv"))
|
||||
|
||||
@@ -5735,6 +5746,8 @@ last_heartbeat = 0000-00-00 00:00:00
|
||||
enabled_local = True
|
||||
enabled_cluster = True
|
||||
auto_add_user_announce = False
|
||||
auto_add_user_announce_hop_min = 0
|
||||
auto_add_user_announce_hop_max = 0
|
||||
auto_add_user_message = True
|
||||
auto_add_user_type = user
|
||||
auto_add_cluster = True
|
||||
|
||||
@@ -714,6 +714,15 @@ class lxmf_announce_callback:
|
||||
if CONFIG["lxmf"].getboolean("announce_auto_message") and DATA.has_section("user"):
|
||||
source_hash = RNS.hexrep(destination_hash, False)
|
||||
exist = False
|
||||
|
||||
hop_count = RNS.Transport.hops_to(destination_hash)
|
||||
hop_min = CONFIG.getint("lxmf", "announce_auto_message_hop_min")
|
||||
hop_max = CONFIG.getint("lxmf", "announce_auto_message_hop_max")
|
||||
if hop_min > 0 and hop_count < hop_min:
|
||||
exist = True
|
||||
if hop_max > 0 and hop_count < hop_max:
|
||||
exist = True
|
||||
|
||||
for (key, val) in DATA.items("user"):
|
||||
if key == source_hash:
|
||||
exist = True
|
||||
@@ -1464,6 +1473,8 @@ announce_hidden = No
|
||||
# This function allows you to welcome new users to the network
|
||||
# by sending a message to all newly received announcements.
|
||||
announce_auto_message = False
|
||||
announce_auto_message_hop_min = 0
|
||||
announce_auto_message_hop_max = 0
|
||||
announce_auto_message_content = Welcome to the Reticulum network! This is an echo test that you can use to test the message functionality. It will respond to every message you send.
|
||||
announce_auto_message_deny_type = 0x04,0x06
|
||||
|
||||
|
||||
@@ -1449,17 +1449,29 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
|
||||
if CONFIG.has_section(section):
|
||||
type_fields = {}
|
||||
for (key, val) in CONFIG.items(section):
|
||||
if "=" in val or ";" in val:
|
||||
type_fields[key] = {}
|
||||
keys = val.split(";")
|
||||
for val in keys:
|
||||
val = val.split("=")
|
||||
if len(val) == 2:
|
||||
type_fields[key][val[0]] = val_to_val(val[1])
|
||||
if key == "config_lxm":
|
||||
try:
|
||||
if val != "":
|
||||
val = base64.urlsafe_b64decode(val.replace("lxm://", "").replace("/", "")+"==")
|
||||
val = umsgpack.unpackb(val)
|
||||
if val and "data" in val:
|
||||
type_fields["config"] = val["data"]["data"]
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
type_fields[key] = val
|
||||
if "=" in val or ";" in val:
|
||||
type_fields[key] = {}
|
||||
keys = val.split(";")
|
||||
for val in keys:
|
||||
val = val.split("=")
|
||||
if len(val) == 2:
|
||||
type_fields[key][val[0]] = val_to_val(val[1])
|
||||
else:
|
||||
type_fields[key] = val
|
||||
if len(type_fields) > 0:
|
||||
announce_data = umsgpack.packb({ANNOUNCE_DATA_CONTENT: CONFIG["lxmf"]["display_name"].encode("utf-8"), ANNOUNCE_DATA_TITLE: None, ANNOUNCE_DATA_FIELDS: {MSG_FIELD_TYPE_FIELDS: type_fields}})
|
||||
announce_data = {ANNOUNCE_DATA_CONTENT: CONFIG["lxmf"]["display_name"].encode("utf-8"), ANNOUNCE_DATA_TITLE: None, ANNOUNCE_DATA_FIELDS: {MSG_FIELD_TYPE_FIELDS: type_fields}}
|
||||
log("LXMF - Configured announce data: "+str(announce_data), LOG_DEBUG)
|
||||
announce_data = umsgpack.packb(announce_data)
|
||||
|
||||
LXMF_CONNECTION = lxmf_connection(
|
||||
storage_path=path,
|
||||
@@ -1576,6 +1588,7 @@ u_s = #URL Software
|
||||
i_s = #Info Software
|
||||
cmd = #CMD
|
||||
config = #Config
|
||||
config_lxm = #Config as lxm string
|
||||
'''
|
||||
|
||||
|
||||
@@ -1712,6 +1725,7 @@ u_s = #URL Software
|
||||
i_s = #Info Software
|
||||
cmd = #CMD
|
||||
config = #Config
|
||||
config_lxm = #Config as lxm string
|
||||
'''
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user