mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-12-24 18:24:22 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9ca0a2fd1 | ||
|
|
cb87148ec3 | ||
|
|
9596361a6b | ||
|
|
d4a3a91e04 | ||
|
|
dbd1d87adb | ||
|
|
db3642ee05 | ||
|
|
6b74e49b0f | ||
|
|
5253cccfa7 | ||
|
|
a2e6a06a35 | ||
|
|
9c79496504 | ||
|
|
eafe77718f | ||
|
|
6d2bf21f0d | ||
|
|
eac9021c75 |
@@ -245,8 +245,11 @@ class NomadNetworkApp:
|
||||
self.peer_settings["served_file_requests"] = 0
|
||||
|
||||
except Exception as e:
|
||||
RNS.log("Could not load local peer settings from "+self.peersettingspath, RNS.LOG_ERROR)
|
||||
RNS.log("The contained exception was: %s" % (str(e)), RNS.LOG_ERROR)
|
||||
RNS.logdest = RNS.LOG_STDOUT
|
||||
RNS.log(f"Could not load local peer settings from {self.peersettingspath}", RNS.LOG_ERROR)
|
||||
RNS.log(f"The contained exception was: {e}", RNS.LOG_ERROR)
|
||||
RNS.log(f"This likely means that the peer settings file has become corrupt.", RNS.LOG_ERROR)
|
||||
RNS.log(f"You can try deleting the file at {self.peersettingspath} and restarting nomadnet.", RNS.LOG_ERROR)
|
||||
nomadnet.panic()
|
||||
else:
|
||||
try:
|
||||
@@ -558,9 +561,9 @@ class NomadNetworkApp:
|
||||
return self.message_router.get_outbound_propagation_node()
|
||||
|
||||
def save_peer_settings(self):
|
||||
file = open(self.peersettingspath, "wb")
|
||||
file.write(msgpack.packb(self.peer_settings))
|
||||
file.close()
|
||||
tmp_path = f"{self.peersettingspath}.tmp"
|
||||
with open(tmp_path, "wb") as file: file.write(msgpack.packb(self.peer_settings))
|
||||
os.replace(tmp_path, self.peersettingspath)
|
||||
|
||||
def lxmf_delivery(self, message):
|
||||
time_string = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(message.timestamp))
|
||||
@@ -805,7 +808,7 @@ class NomadNetworkApp:
|
||||
if not "intro_time" in self.config["textui"]:
|
||||
self.config["textui"]["intro_time"] = 1
|
||||
else:
|
||||
self.config["textui"]["intro_time"] = self.config["textui"].as_int("intro_time")
|
||||
self.config["textui"]["intro_time"] = self.config["textui"].as_float("intro_time")
|
||||
|
||||
if not "intro_text" in self.config["textui"]:
|
||||
self.config["textui"]["intro_text"] = "Nomad Network"
|
||||
|
||||
@@ -8,8 +8,10 @@ from .Node import Node
|
||||
from .ui import *
|
||||
|
||||
|
||||
modules = glob.glob(os.path.dirname(__file__)+"/*.py")
|
||||
__all__ = [ os.path.basename(f)[:-3] for f in modules if not f.endswith('__init__.py')]
|
||||
py_modules = glob.glob(os.path.dirname(__file__)+"/*.py")
|
||||
pyc_modules = glob.glob(os.path.dirname(__file__)+"/*.pyc")
|
||||
modules = py_modules+pyc_modules
|
||||
__all__ = list(set([os.path.basename(f).replace(".pyc", "").replace(".py", "") for f in modules if not (f.endswith("__init__.py") or f.endswith("__init__.pyc"))]))
|
||||
|
||||
def panic():
|
||||
os._exit(255)
|
||||
@@ -1 +1 @@
|
||||
__version__ = "0.9.0"
|
||||
__version__ = "0.9.2"
|
||||
|
||||
@@ -3,8 +3,10 @@ import glob
|
||||
import RNS
|
||||
import nomadnet
|
||||
|
||||
modules = glob.glob(os.path.dirname(__file__)+"/*.py")
|
||||
__all__ = [ os.path.basename(f)[:-3] for f in modules if not f.endswith('__init__.py')]
|
||||
py_modules = glob.glob(os.path.dirname(__file__)+"/*.py")
|
||||
pyc_modules = glob.glob(os.path.dirname(__file__)+"/*.pyc")
|
||||
modules = py_modules+pyc_modules
|
||||
__all__ = list(set([os.path.basename(f).replace(".pyc", "").replace(".py", "") for f in modules if not (f.endswith("__init__.py") or f.endswith("__init__.pyc"))]))
|
||||
|
||||
|
||||
UI_NONE = 0x00
|
||||
|
||||
@@ -697,7 +697,7 @@ class Browser:
|
||||
|
||||
def confirmed(sender):
|
||||
try:
|
||||
self.retrieve_url(e_url.get_edit_text())
|
||||
self.retrieve_url(e_url.get_edit_text().strip())
|
||||
except Exception as e:
|
||||
self.browser_footer = urwid.Text("Could not open link: "+str(e))
|
||||
self.frame.contents["footer"] = (self.browser_footer, self.frame.options())
|
||||
@@ -799,7 +799,7 @@ class Browser:
|
||||
|
||||
self.page_background_color = None
|
||||
bgpos = self.markup.find("#!bg=")
|
||||
if bgpos:
|
||||
if bgpos >= 0:
|
||||
endpos = self.markup.find("\n", bgpos)
|
||||
if endpos-(bgpos+5) == 3:
|
||||
bg = self.markup[bgpos+5:endpos]
|
||||
@@ -807,7 +807,7 @@ class Browser:
|
||||
|
||||
self.page_foreground_color = None
|
||||
fgpos = self.markup.find("#!fg=")
|
||||
if fgpos:
|
||||
if fgpos >= 0:
|
||||
endpos = self.markup.find("\n", fgpos)
|
||||
if endpos-(fgpos+5) == 3:
|
||||
fg = self.markup[fgpos+5:endpos]
|
||||
@@ -866,7 +866,7 @@ class Browser:
|
||||
|
||||
self.page_background_color = None
|
||||
bgpos = self.markup.find("#!bg=")
|
||||
if bgpos:
|
||||
if bgpos >= 0:
|
||||
endpos = self.markup.find("\n", bgpos)
|
||||
if endpos-(bgpos+5) == 3:
|
||||
bg = self.markup[bgpos+5:endpos]
|
||||
@@ -874,7 +874,7 @@ class Browser:
|
||||
|
||||
self.page_foreground_color = None
|
||||
fgpos = self.markup.find("#!fg=")
|
||||
if fgpos:
|
||||
if fgpos >= 0:
|
||||
endpos = self.markup.find("\n", fgpos)
|
||||
if endpos-(fgpos+5) == 3:
|
||||
fg = self.markup[fgpos+5:endpos]
|
||||
@@ -1018,7 +1018,7 @@ class Browser:
|
||||
|
||||
self.page_background_color = None
|
||||
bgpos = self.markup.find("#!bg=")
|
||||
if bgpos:
|
||||
if bgpos >= 0:
|
||||
endpos = self.markup.find("\n", bgpos)
|
||||
if endpos-(bgpos+5) == 3:
|
||||
bg = self.markup[bgpos+5:endpos]
|
||||
@@ -1026,7 +1026,7 @@ class Browser:
|
||||
|
||||
self.page_foreground_color = None
|
||||
fgpos = self.markup.find("#!fg=")
|
||||
if fgpos:
|
||||
if fgpos >= 0:
|
||||
endpos = self.markup.find("\n", fgpos)
|
||||
if endpos-(fgpos+5) == 3:
|
||||
fg = self.markup[fgpos+5:endpos]
|
||||
|
||||
@@ -331,7 +331,7 @@ class ConversationsDisplay():
|
||||
existing_conversations = nomadnet.Conversation.conversation_list(self.app)
|
||||
|
||||
display_name = e_name.get_edit_text()
|
||||
source_hash_text = e_id.get_edit_text()
|
||||
source_hash_text = e_id.get_edit_text().strip()
|
||||
source_hash = bytes.fromhex(source_hash_text)
|
||||
trust_level = DirectoryEntry.UNTRUSTED
|
||||
if r_unknown.state == True:
|
||||
@@ -412,7 +412,7 @@ class ConversationsDisplay():
|
||||
try:
|
||||
local_delivery_signal = "local_delivery_occurred"
|
||||
duplicate_signal = "duplicate_lxm"
|
||||
lxm_uri = e_uri.get_edit_text()
|
||||
lxm_uri = e_uri.get_edit_text().strip()
|
||||
|
||||
ingest_result = self.app.message_router.ingest_lxm_uri(
|
||||
lxm_uri,
|
||||
|
||||
@@ -487,20 +487,14 @@ def make_output(state, line, url_delegate, pre_escape=False):
|
||||
state["bg_color"] = state["default_bg"]
|
||||
state["align"] = state["default_align"]
|
||||
elif c == "c":
|
||||
if state["align"] != "center":
|
||||
state["align"] = "center"
|
||||
else:
|
||||
state["align"] = state["default_align"]
|
||||
if state["align"] != "center": state["align"] = "center"
|
||||
# else: state["align"] = state["default_align"]
|
||||
elif c == "l":
|
||||
if state["align"] != "left":
|
||||
state["align"] = "left"
|
||||
else:
|
||||
state["align"] = state["default_align"]
|
||||
if state["align"] != "left": state["align"] = "left"
|
||||
# else: state["align"] = state["default_align"]
|
||||
elif c == "r":
|
||||
if state["align"] != "right":
|
||||
state["align"] = "right"
|
||||
else:
|
||||
state["align"] = state["default_align"]
|
||||
if state["align"] != "right": state["align"] = "right"
|
||||
# else: state["align"] = state["default_align"]
|
||||
elif c == "a":
|
||||
state["align"] = state["default_align"]
|
||||
|
||||
@@ -649,7 +643,7 @@ def make_output(state, line, url_delegate, pre_escape=False):
|
||||
orig_spec = speclist[4]
|
||||
|
||||
if url_delegate != None:
|
||||
linkspec = LinkSpec(link_url, orig_spec)
|
||||
linkspec = LinkSpec(link_url, orig_spec, cm=cm)
|
||||
if link_fields != "":
|
||||
lf = link_fields.split("|")
|
||||
if len(lf) > 0:
|
||||
@@ -696,11 +690,11 @@ def make_output(state, line, url_delegate, pre_escape=False):
|
||||
|
||||
|
||||
class LinkSpec(urwid.AttrSpec):
|
||||
def __init__(self, link_target, orig_spec):
|
||||
def __init__(self, link_target, orig_spec, cm=256):
|
||||
self.link_target = link_target
|
||||
self.link_fields = None
|
||||
|
||||
super().__init__(orig_spec.foreground, orig_spec.background)
|
||||
super().__init__(orig_spec.foreground, orig_spec.background, colors=cm)
|
||||
|
||||
|
||||
class LinkableText(urwid.Text):
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import os
|
||||
import glob
|
||||
|
||||
modules = glob.glob(os.path.dirname(__file__)+"/*.py")
|
||||
__all__ = [ os.path.basename(f)[:-3] for f in modules if not f.endswith('__init__.py')]
|
||||
py_modules = glob.glob(os.path.dirname(__file__)+"/*.py")
|
||||
pyc_modules = glob.glob(os.path.dirname(__file__)+"/*.pyc")
|
||||
modules = py_modules+pyc_modules
|
||||
__all__ = list(set([os.path.basename(f).replace(".pyc", "").replace(".py", "") for f in modules if not (f.endswith("__init__.py") or f.endswith("__init__.pyc"))]))
|
||||
|
||||
6
nomadnet/vendor/__init__.py
vendored
6
nomadnet/vendor/__init__.py
vendored
@@ -1,5 +1,7 @@
|
||||
import os
|
||||
import glob
|
||||
|
||||
modules = glob.glob(os.path.dirname(__file__)+"/*.py")
|
||||
__all__ = [ os.path.basename(f)[:-3] for f in modules if not f.endswith('__init__.py')]
|
||||
py_modules = glob.glob(os.path.dirname(__file__)+"/*.py")
|
||||
pyc_modules = glob.glob(os.path.dirname(__file__)+"/*.pyc")
|
||||
modules = py_modules+pyc_modules
|
||||
__all__ = list(set([os.path.basename(f).replace(".pyc", "").replace(".py", "") for f in modules if not (f.endswith("__init__.py") or f.endswith("__init__.pyc"))]))
|
||||
|
||||
2
setup.py
2
setup.py
@@ -30,6 +30,6 @@ setuptools.setup(
|
||||
entry_points= {
|
||||
'console_scripts': ['nomadnet=nomadnet.nomadnet:main']
|
||||
},
|
||||
install_requires=["rns>=1.0.1", "lxmf>=0.9.0", "urwid>=2.6.16", "qrcode"],
|
||||
install_requires=["rns>=1.0.4", "lxmf>=0.9.3", "urwid>=2.6.16", "qrcode"],
|
||||
python_requires=">=3.7",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user