mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-12-17 14:54:26 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
407cc8fb5f | ||
|
|
1f7302903a | ||
|
|
5736012f2c | ||
|
|
bb98a512f3 | ||
|
|
ae0d4c6e0c | ||
|
|
2449b39f77 | ||
|
|
e022d469f8 | ||
|
|
a4f665e650 | ||
|
|
19d1d8504f | ||
|
|
276a5f56e1 | ||
|
|
89dd17ece5 | ||
|
|
82bb479957 |
@@ -142,7 +142,7 @@ class Conversation:
|
||||
|
||||
self.__changed_callback = None
|
||||
|
||||
if not RNS.Transport.has_path(bytes.fromhex(source_hash)):
|
||||
if not RNS.Identity.recall(bytes.fromhex(self.source_hash)):
|
||||
RNS.Transport.request_path(bytes.fromhex(source_hash))
|
||||
|
||||
self.source_identity = RNS.Identity.recall(bytes.fromhex(self.source_hash))
|
||||
|
||||
@@ -91,6 +91,9 @@ class Directory:
|
||||
entries = {}
|
||||
for e in unpacked_list:
|
||||
|
||||
if e[1] == None:
|
||||
e[1] = "Undefined"
|
||||
|
||||
if len(e) > 3:
|
||||
hosts_node = e[3]
|
||||
else:
|
||||
|
||||
@@ -15,7 +15,11 @@ class Node:
|
||||
self.identity = self.app.identity
|
||||
self.destination = RNS.Destination(self.identity, RNS.Destination.IN, RNS.Destination.SINGLE, "nomadnetwork", "node")
|
||||
self.last_announce = time.time()
|
||||
self.last_file_refresh = time.time()
|
||||
self.last_page_refresh = time.time()
|
||||
self.announce_interval = self.app.node_announce_interval
|
||||
self.page_refresh_interval = self.app.page_refresh_interval
|
||||
self.file_refresh_interval = self.app.file_refresh_interval
|
||||
self.job_interval = Node.JOB_INTERVAL
|
||||
self.should_run_jobs = True
|
||||
self.app_data = None
|
||||
@@ -46,6 +50,8 @@ class Node:
|
||||
|
||||
|
||||
def register_pages(self):
|
||||
# TODO: Deregister previously registered pages
|
||||
# that no longer exist.
|
||||
self.servedpages = []
|
||||
self.scan_pages(self.app.pagespath)
|
||||
|
||||
@@ -65,6 +71,8 @@ class Node:
|
||||
)
|
||||
|
||||
def register_files(self):
|
||||
# TODO: Deregister previously registered files
|
||||
# that no longer exist.
|
||||
self.servedfiles = []
|
||||
self.scan_files(self.app.filespath)
|
||||
|
||||
@@ -223,6 +231,16 @@ class Node:
|
||||
if now > self.last_announce + self.announce_interval*60:
|
||||
self.announce()
|
||||
|
||||
if self.page_refresh_interval > 0:
|
||||
if now > self.last_page_refresh + self.page_refresh_interval*60:
|
||||
self.register_pages()
|
||||
self.last_page_refresh = time.time()
|
||||
|
||||
if self.file_refresh_interval > 0:
|
||||
if now > self.last_file_refresh + self.file_refresh_interval*60:
|
||||
self.register_files()
|
||||
self.last_file_refresh = time.time()
|
||||
|
||||
time.sleep(self.job_interval)
|
||||
|
||||
def peer_connected(self, link):
|
||||
|
||||
@@ -119,6 +119,8 @@ class NomadNetworkApp:
|
||||
self.should_run_jobs = True
|
||||
self.job_interval = 5
|
||||
self.defer_jobs = 90
|
||||
self.page_refresh_interval = 0
|
||||
self.file_refresh_interval = 0
|
||||
|
||||
self.peer_announce_at_start = True
|
||||
self.try_propagation_on_fail = True
|
||||
@@ -831,9 +833,27 @@ class NomadNetworkApp:
|
||||
if "pages_path" in self.config["node"]:
|
||||
self.pagespath = self.config["node"]["pages_path"]
|
||||
|
||||
if not "page_refresh_interval" in self.config["node"]:
|
||||
self.page_refresh_interval = 0
|
||||
else:
|
||||
value = self.config["node"].as_int("page_refresh_interval")
|
||||
if value < 0:
|
||||
value = 0
|
||||
self.page_refresh_interval = value
|
||||
|
||||
|
||||
if "files_path" in self.config["node"]:
|
||||
self.filespath = self.config["node"]["files_path"]
|
||||
|
||||
if not "file_refresh_interval" in self.config["node"]:
|
||||
self.file_refresh_interval = 0
|
||||
else:
|
||||
value = self.config["node"].as_int("file_refresh_interval")
|
||||
if value < 0:
|
||||
value = 0
|
||||
self.file_refresh_interval = value
|
||||
|
||||
|
||||
if "prioritise_destinations" in self.config["node"]:
|
||||
self.prioritised_lxmf_destinations = self.config["node"].as_list("prioritise_destinations")
|
||||
else:
|
||||
@@ -1057,6 +1077,22 @@ announce_at_start = Yes
|
||||
# and generally you do not need to use it.
|
||||
# prioritise_destinations = 41d20c727598a3fbbdf9106133a3a0ed, d924b81822ca24e68e2effea99bcb8cf
|
||||
|
||||
# Automatic rescan interval of the pages directory in minutes.
|
||||
# Default: int = 0 (no rescan)
|
||||
page_refresh_interval = 0
|
||||
|
||||
# You can specify the interval in minutes for
|
||||
# rescanning the hosted pages path. By default,
|
||||
# this option is disabled, and the pages path
|
||||
# will only be scanned on startup.
|
||||
# page_refresh_interval = 0
|
||||
|
||||
# You can specify the interval in minutes for
|
||||
# rescanning the hosted files path. By default,
|
||||
# this option is disabled, and the files path
|
||||
# will only be scanned on startup.
|
||||
# file_refresh_interval = 0
|
||||
|
||||
[printing]
|
||||
|
||||
# You can configure Nomad Network to print
|
||||
|
||||
@@ -1 +1 @@
|
||||
__version__ = "0.4.1"
|
||||
__version__ = "0.4.4"
|
||||
|
||||
@@ -517,7 +517,7 @@ class Browser:
|
||||
self.status = Browser.PATH_REQUESTED
|
||||
self.update_display()
|
||||
|
||||
pr_time = time.time()
|
||||
pr_time = time.time()+RNS.Transport.first_hop_timeout(self.destination_hash)
|
||||
while not RNS.Transport.has_path(self.destination_hash):
|
||||
now = time.time()
|
||||
if now > pr_time+self.timeout:
|
||||
@@ -770,7 +770,7 @@ class Browser:
|
||||
self.status = Browser.PATH_REQUESTED
|
||||
self.update_display()
|
||||
|
||||
pr_time = time.time()
|
||||
pr_time = time.time()+RNS.Transport.first_hop_timeout(self.destination_hash)
|
||||
while not RNS.Transport.has_path(self.destination_hash):
|
||||
now = time.time()
|
||||
if now > pr_time+self.timeout:
|
||||
@@ -976,7 +976,10 @@ class Browser:
|
||||
try:
|
||||
file_name = request_receipt.response[0]
|
||||
file_data = request_receipt.response[1]
|
||||
file_destination = self.app.downloads_path+"/"+file_name
|
||||
file_destination_name = file_name.split("/")
|
||||
file_destination_name = file_destination_name[len(file_destination_name)-1]
|
||||
file_destination = self.app.downloads_path+"/"+file_destination_name
|
||||
|
||||
|
||||
counter = 0
|
||||
while os.path.isfile(file_destination):
|
||||
|
||||
@@ -894,7 +894,7 @@ class ConversationWidget(urwid.WidgetWrap):
|
||||
if allowed:
|
||||
self.frame.contents["footer"] = (self.minimal_editor, None)
|
||||
else:
|
||||
warning = urwid.AttrMap(urwid.Padding(urwid.Text("\n"+g["info"]+"\n\nYou cannot currently message this peer, since it's identity keys are not known.\n\nWait for an announce to arrive from the peer, or query the network for it.\n\nTo query the network, select this conversation in the conversation list, press Ctrl-E, and use the query button.\n", align="center")), "msg_header_caution")
|
||||
warning = urwid.AttrMap(urwid.Padding(urwid.Text("\n"+g["info"]+"\n\nYou cannot currently message this peer, since it's identity keys are not known. The keys have been requested from the network and should arrive shortly, if available. Close this conversation and reopen it to try again.\n\nTo query the network manually, select this conversation in the conversation list, press Ctrl-E, and use the query button.\n", align="center")), "msg_header_caution")
|
||||
self.frame.contents["footer"] = (warning, None)
|
||||
|
||||
def toggle_focus_area(self):
|
||||
|
||||
@@ -621,12 +621,24 @@ Determines how often, in minutes, your node is announced on the network. Default
|
||||
Determines where the node server will look for hosted pages. Must be a readable filesystem path.
|
||||
<
|
||||
|
||||
>>>
|
||||
`!page_refresh_interval = 0`!
|
||||
>>>>
|
||||
Determines the interval in minutes for rescanning the hosted pages path. By default, this option is disabled, and the pages path will only be scanned on startup.
|
||||
<
|
||||
|
||||
>>>
|
||||
`!files_path = ~/.nomadnetwork/storage/files`!
|
||||
>>>>
|
||||
Determines where the node server will look for downloadable files. Must be a readable filesystem path.
|
||||
<
|
||||
|
||||
>>>
|
||||
`!file_refresh_interval = 0`!
|
||||
>>>>
|
||||
Determines the interval in minutes for rescanning the hosted files path. By default, this option is disabled, and the files path will only be scanned on startup.
|
||||
<
|
||||
|
||||
>>>
|
||||
`!disable_propagation = no`!
|
||||
>>>>
|
||||
|
||||
2
setup.py
2
setup.py
@@ -30,6 +30,6 @@ setuptools.setup(
|
||||
entry_points= {
|
||||
'console_scripts': ['nomadnet=nomadnet.nomadnet:main']
|
||||
},
|
||||
install_requires=["rns>=0.6.3", "lxmf>=0.3.7", "urwid==2.1.2", "qrcode"],
|
||||
install_requires=["rns>=0.6.4", "lxmf>=0.3.8", "urwid==2.1.2", "qrcode"],
|
||||
python_requires=">=3.6",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user