mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-12-17 14:54:26 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
407cc8fb5f | ||
|
|
1f7302903a | ||
|
|
5736012f2c | ||
|
|
bb98a512f3 | ||
|
|
ae0d4c6e0c | ||
|
|
2449b39f77 | ||
|
|
e022d469f8 | ||
|
|
a4f665e650 | ||
|
|
19d1d8504f |
@@ -90,7 +90,10 @@ class Directory:
|
|||||||
|
|
||||||
entries = {}
|
entries = {}
|
||||||
for e in unpacked_list:
|
for e in unpacked_list:
|
||||||
|
|
||||||
|
if e[1] == None:
|
||||||
|
e[1] = "Undefined"
|
||||||
|
|
||||||
if len(e) > 3:
|
if len(e) > 3:
|
||||||
hosts_node = e[3]
|
hosts_node = e[3]
|
||||||
else:
|
else:
|
||||||
@@ -375,4 +378,4 @@ class DirectoryEntry:
|
|||||||
self.hosts_node = hosts_node
|
self.hosts_node = hosts_node
|
||||||
self.identify = identify_on_connect
|
self.identify = identify_on_connect
|
||||||
else:
|
else:
|
||||||
raise TypeError("Attempt to add invalid source hash to directory")
|
raise TypeError("Attempt to add invalid source hash to directory")
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ class Node:
|
|||||||
self.identity = self.app.identity
|
self.identity = self.app.identity
|
||||||
self.destination = RNS.Destination(self.identity, RNS.Destination.IN, RNS.Destination.SINGLE, "nomadnetwork", "node")
|
self.destination = RNS.Destination(self.identity, RNS.Destination.IN, RNS.Destination.SINGLE, "nomadnetwork", "node")
|
||||||
self.last_announce = time.time()
|
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.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.job_interval = Node.JOB_INTERVAL
|
||||||
self.should_run_jobs = True
|
self.should_run_jobs = True
|
||||||
self.app_data = None
|
self.app_data = None
|
||||||
@@ -46,6 +50,8 @@ class Node:
|
|||||||
|
|
||||||
|
|
||||||
def register_pages(self):
|
def register_pages(self):
|
||||||
|
# TODO: Deregister previously registered pages
|
||||||
|
# that no longer exist.
|
||||||
self.servedpages = []
|
self.servedpages = []
|
||||||
self.scan_pages(self.app.pagespath)
|
self.scan_pages(self.app.pagespath)
|
||||||
|
|
||||||
@@ -65,6 +71,8 @@ class Node:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def register_files(self):
|
def register_files(self):
|
||||||
|
# TODO: Deregister previously registered files
|
||||||
|
# that no longer exist.
|
||||||
self.servedfiles = []
|
self.servedfiles = []
|
||||||
self.scan_files(self.app.filespath)
|
self.scan_files(self.app.filespath)
|
||||||
|
|
||||||
@@ -222,6 +230,16 @@ class Node:
|
|||||||
|
|
||||||
if now > self.last_announce + self.announce_interval*60:
|
if now > self.last_announce + self.announce_interval*60:
|
||||||
self.announce()
|
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)
|
time.sleep(self.job_interval)
|
||||||
|
|
||||||
|
|||||||
@@ -115,10 +115,12 @@ class NomadNetworkApp:
|
|||||||
|
|
||||||
self.downloads_path = os.path.expanduser("~/Downloads")
|
self.downloads_path = os.path.expanduser("~/Downloads")
|
||||||
|
|
||||||
self.firstrun = False
|
self.firstrun = False
|
||||||
self.should_run_jobs = True
|
self.should_run_jobs = True
|
||||||
self.job_interval = 5
|
self.job_interval = 5
|
||||||
self.defer_jobs = 90
|
self.defer_jobs = 90
|
||||||
|
self.page_refresh_interval = 0
|
||||||
|
self.file_refresh_interval = 0
|
||||||
|
|
||||||
self.peer_announce_at_start = True
|
self.peer_announce_at_start = True
|
||||||
self.try_propagation_on_fail = True
|
self.try_propagation_on_fail = True
|
||||||
@@ -827,12 +829,30 @@ class NomadNetworkApp:
|
|||||||
if value < 1:
|
if value < 1:
|
||||||
value = 1
|
value = 1
|
||||||
self.node_announce_interval = value
|
self.node_announce_interval = value
|
||||||
|
|
||||||
if "pages_path" in self.config["node"]:
|
if "pages_path" in self.config["node"]:
|
||||||
self.pagespath = self.config["node"]["pages_path"]
|
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"]:
|
if "files_path" in self.config["node"]:
|
||||||
self.filespath = self.config["node"]["files_path"]
|
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"]:
|
if "prioritise_destinations" in self.config["node"]:
|
||||||
self.prioritised_lxmf_destinations = self.config["node"].as_list("prioritise_destinations")
|
self.prioritised_lxmf_destinations = self.config["node"].as_list("prioritise_destinations")
|
||||||
@@ -1057,6 +1077,22 @@ announce_at_start = Yes
|
|||||||
# and generally you do not need to use it.
|
# and generally you do not need to use it.
|
||||||
# prioritise_destinations = 41d20c727598a3fbbdf9106133a3a0ed, d924b81822ca24e68e2effea99bcb8cf
|
# 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]
|
[printing]
|
||||||
|
|
||||||
# You can configure Nomad Network to print
|
# You can configure Nomad Network to print
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
__version__ = "0.4.2"
|
__version__ = "0.4.4"
|
||||||
|
|||||||
@@ -976,7 +976,10 @@ class Browser:
|
|||||||
try:
|
try:
|
||||||
file_name = request_receipt.response[0]
|
file_name = request_receipt.response[0]
|
||||||
file_data = request_receipt.response[1]
|
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
|
counter = 0
|
||||||
while os.path.isfile(file_destination):
|
while os.path.isfile(file_destination):
|
||||||
|
|||||||
@@ -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.
|
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`!
|
`!files_path = ~/.nomadnetwork/storage/files`!
|
||||||
>>>>
|
>>>>
|
||||||
Determines where the node server will look for downloadable files. Must be a readable filesystem path.
|
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`!
|
`!disable_propagation = no`!
|
||||||
>>>>
|
>>>>
|
||||||
|
|||||||
Reference in New Issue
Block a user