mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-05-02 06:06:19 -04:00
Compare commits
20 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4eed5bab48 | ||
![]() |
aa4feeb29c | ||
![]() |
ad985a2552 | ||
![]() |
42fdc30cf8 | ||
![]() |
e79689010e | ||
![]() |
e4f57d6260 | ||
![]() |
03d1b22b8f | ||
![]() |
f8775adbab | ||
![]() |
c0dac0eadb | ||
![]() |
c198d516da | ||
![]() |
d9886980fa | ||
![]() |
7ced4c3659 | ||
![]() |
c3c8f99131 | ||
![]() |
9f00ffbae6 | ||
![]() |
a26edd21db | ||
![]() |
46f3a4127c | ||
![]() |
eeb15dcb43 | ||
![]() |
9ef34fc774 | ||
![]() |
704a4ea828 | ||
![]() |
5f31aeb3c1 |
9 changed files with 170 additions and 2604 deletions
2
.github/ISSUE_TEMPLATE/🐛-bug-report.md
vendored
2
.github/ISSUE_TEMPLATE/🐛-bug-report.md
vendored
|
@ -12,7 +12,7 @@ Before creating a bug report on this issue tracker, you **must** read the [Contr
|
|||
|
||||
- The issue tracker is used by developers of this project. **Do not use it to ask general questions, or for support requests**.
|
||||
- Ideas and feature requests can be made on the [Discussions](https://github.com/markqvist/Reticulum/discussions). **Only** feature requests accepted by maintainers and developers are tracked and included on the issue tracker. **Do not post feature requests here**.
|
||||
- After reading the [Contribution Guidelines](https://github.com/markqvist/Reticulum/blob/master/Contributing.md), delete this section from your bug report.
|
||||
- After reading the [Contribution Guidelines](https://github.com/markqvist/Reticulum/blob/master/Contributing.md), **delete this section only** (*"Read the Contribution Guidelines"*) from your bug report, **and fill in all the other sections**.
|
||||
|
||||
**Describe the Bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
|
|
@ -16,10 +16,6 @@ ENV PATH="/home/myuser/.local/bin:${PATH}"
|
|||
|
||||
################### BEGIN NomadNet ###########################################
|
||||
|
||||
COPY --chown=myuser:myuser requirements.txt requirements.txt
|
||||
|
||||
RUN pip install --user -r requirements.txt
|
||||
|
||||
|
||||
COPY --chown=myuser:myuser . .
|
||||
|
||||
|
|
10
README.md
10
README.md
|
@ -146,13 +146,13 @@ You can help support the continued development of open, free and private communi
|
|||
```
|
||||
84FpY1QbxHcgdseePYNmhTHcrgMX4nFfBYtz2GKYToqHVVhJp8Eaw1Z1EedRnKD19b3B8NiLCGVxzKV17UMmmeEsCrPyA5w
|
||||
```
|
||||
- Ethereum
|
||||
```
|
||||
0xFDabC71AC4c0C78C95aDDDe3B4FA19d6273c5E73
|
||||
```
|
||||
- Bitcoin
|
||||
```
|
||||
35G9uWVzrpJJibzUwpNUQGQNFzLirhrYAH
|
||||
bc1p4a6axuvl7n9hpapfj8sv5reqj8kz6uxa67d5en70vzrttj0fmcusgxsfk5
|
||||
```
|
||||
- Ethereum
|
||||
```
|
||||
0xae89F3B94fC4AD6563F0864a55F9a697a90261ff
|
||||
```
|
||||
- Ko-Fi: https://ko-fi.com/markqvist
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import RNS
|
|||
import LXMF
|
||||
import time
|
||||
import nomadnet
|
||||
import threading
|
||||
import RNS.vendor.umsgpack as msgpack
|
||||
|
||||
class PNAnnounceHandler:
|
||||
|
@ -29,7 +30,7 @@ class PNAnnounceHandler:
|
|||
RNS.log("The contained exception was: "+str(e), RNS.LOG_DEBUG)
|
||||
|
||||
class Directory:
|
||||
ANNOUNCE_STREAM_MAXLENGTH = 64
|
||||
ANNOUNCE_STREAM_MAXLENGTH = 256
|
||||
|
||||
aspect_filter = "nomadnetwork.node"
|
||||
@staticmethod
|
||||
|
@ -55,6 +56,7 @@ class Directory:
|
|||
self.directory_entries = {}
|
||||
self.announce_stream = []
|
||||
self.app = app
|
||||
self.announce_lock = threading.Lock()
|
||||
self.load_from_disk()
|
||||
|
||||
self.pn_announce_handler = PNAnnounceHandler(self)
|
||||
|
@ -124,6 +126,7 @@ class Directory:
|
|||
RNS.log("Could not load directory from disk. The contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||
|
||||
def lxmf_announce_received(self, source_hash, app_data):
|
||||
with self.announce_lock:
|
||||
if app_data != None:
|
||||
if self.app.compact_stream:
|
||||
try:
|
||||
|
@ -143,10 +146,12 @@ class Directory:
|
|||
while len(self.announce_stream) > Directory.ANNOUNCE_STREAM_MAXLENGTH:
|
||||
self.announce_stream.pop()
|
||||
|
||||
if hasattr(self.app, "ui") and self.app.ui != None:
|
||||
if hasattr(self.app.ui, "main_display"):
|
||||
self.app.ui.main_display.sub_displays.network_display.directory_change_callback()
|
||||
|
||||
def node_announce_received(self, source_hash, app_data, associated_peer):
|
||||
with self.announce_lock:
|
||||
if app_data != None:
|
||||
if self.app.compact_stream:
|
||||
try:
|
||||
|
@ -176,6 +181,7 @@ class Directory:
|
|||
self.app.ui.main_display.sub_displays.network_display.directory_change_callback()
|
||||
|
||||
def pn_announce_received(self, source_hash, app_data, associated_peer, associated_node):
|
||||
with self.announce_lock:
|
||||
found_node = None
|
||||
for sh in self.directory_entries:
|
||||
if sh == associated_node:
|
||||
|
@ -206,7 +212,7 @@ class Directory:
|
|||
while len(self.announce_stream) > Directory.ANNOUNCE_STREAM_MAXLENGTH:
|
||||
self.announce_stream.pop()
|
||||
|
||||
if hasattr(self.app.ui, "main_display"):
|
||||
if hasattr(self.app, "ui") and hasattr(self.app.ui, "main_display"):
|
||||
self.app.ui.main_display.sub_displays.network_display.directory_change_callback()
|
||||
|
||||
def remove_announce_with_timestamp(self, timestamp):
|
||||
|
@ -339,7 +345,7 @@ class Directory:
|
|||
if e.hosts_node:
|
||||
node_list.append(e)
|
||||
|
||||
node_list.sort(key = lambda e: (e.sort_rank if e.sort_rank != None else 2^32, DirectoryEntry.TRUSTED-e.trust_level, e.display_name))
|
||||
node_list.sort(key = lambda e: (e.sort_rank if e.sort_rank != None else 2^32, DirectoryEntry.TRUSTED-e.trust_level, e.display_name if e.display_name != None else "_"))
|
||||
return node_list
|
||||
|
||||
def number_of_known_nodes(self):
|
||||
|
|
|
@ -19,7 +19,7 @@ from datetime import datetime
|
|||
import RNS.vendor.umsgpack as msgpack
|
||||
|
||||
from ._version import __version__
|
||||
from .vendor.configobj import ConfigObj
|
||||
from RNS.vendor.configobj import ConfigObj
|
||||
|
||||
class NomadNetworkApp:
|
||||
time_format = "%Y-%m-%d %H:%M:%S"
|
||||
|
@ -537,7 +537,7 @@ class NomadNetworkApp:
|
|||
RNS.log("Could not autoselect a propagation node! LXMF propagation will not be available until a trusted node announces on the network, or a propagation node is manually selected.", RNS.LOG_WARNING)
|
||||
else:
|
||||
pn_name_str = ""
|
||||
RNS.log("Selecting "+RNS.prettyhexrep(selected_node)+pn_name_str+" as default LXMF propagation node", RNS.LOG_INFO)
|
||||
RNS.log("Selecting "+RNS.prettyhexrep(selected_node)+pn_name_str+" as default LXMF propagation node", RNS.LOG_DEBUG)
|
||||
self.message_router.set_outbound_propagation_node(selected_node)
|
||||
|
||||
def get_user_selected_propagation_node(self):
|
||||
|
|
|
@ -1 +1 @@
|
|||
__version__ = "0.6.0"
|
||||
__version__ = "0.6.2"
|
||||
|
|
|
@ -368,6 +368,10 @@ class AnnounceStreamEntry(urwid.WidgetWrap):
|
|||
def timestamp(self):
|
||||
return self.timestamp
|
||||
|
||||
class TabButton(urwid.Button):
|
||||
button_left = urwid.Text("[")
|
||||
button_right = urwid.Text("]")
|
||||
|
||||
class AnnounceStream(urwid.WidgetWrap):
|
||||
def __init__(self, app, parent):
|
||||
self.app = app
|
||||
|
@ -376,11 +380,24 @@ class AnnounceStream(urwid.WidgetWrap):
|
|||
self.timeout = self.app.config["textui"]["animation_interval"]*2
|
||||
self.ilb = None
|
||||
self.no_content = True
|
||||
self.current_tab = "nodes"
|
||||
|
||||
self.added_entries = []
|
||||
self.widget_list = []
|
||||
self.update_widget_list()
|
||||
|
||||
# Create tab buttons
|
||||
self.tab_nodes = TabButton("Nodes", on_press=self.show_nodes_tab)
|
||||
self.tab_peers = TabButton("Peers", on_press=self.show_peers_tab)
|
||||
self.tab_pn = TabButton("Propagation Nodes", on_press=self.show_pn_tab)
|
||||
|
||||
# Create tab bar with proportional widths
|
||||
self.tab_bar = urwid.Columns([
|
||||
('weight', 1, self.tab_nodes),
|
||||
('weight', 1, self.tab_peers),
|
||||
('weight', 3, self.tab_pn),
|
||||
], dividechars=1) # Add 1 character spacing between tabs
|
||||
|
||||
self.ilb = ExceptionHandlingListBox(
|
||||
self.widget_list,
|
||||
on_selection_change=self.list_selection,
|
||||
|
@ -389,7 +406,13 @@ class AnnounceStream(urwid.WidgetWrap):
|
|||
#highlight_offFocus="list_off_focus"
|
||||
)
|
||||
|
||||
self.display_widget = self.ilb
|
||||
# Combine tab bar and list box
|
||||
self.pile = urwid.Pile([
|
||||
('pack', self.tab_bar),
|
||||
('weight', 1, self.ilb),
|
||||
])
|
||||
|
||||
self.display_widget = self.pile
|
||||
super().__init__(urwid.LineBox(self.display_widget, title="Announce Stream"))
|
||||
|
||||
def keypress(self, size, key):
|
||||
|
@ -412,28 +435,45 @@ class AnnounceStream(urwid.WidgetWrap):
|
|||
self.update_widget_list()
|
||||
|
||||
def update_widget_list(self):
|
||||
self.widget_list = []
|
||||
new_entries = []
|
||||
|
||||
for e in self.app.directory.announce_stream:
|
||||
if not e[0] in self.added_entries:
|
||||
self.added_entries.insert(0, e[0])
|
||||
new_entries.insert(0, e)
|
||||
announce_type = e[3]
|
||||
|
||||
# Filter based on current tab
|
||||
if self.current_tab == "nodes" and (announce_type == "node" or announce_type == True):
|
||||
new_entries.append(e)
|
||||
elif self.current_tab == "peers" and (announce_type == "peer" or announce_type == False):
|
||||
new_entries.append(e)
|
||||
elif self.current_tab == "pn" and announce_type == "pn":
|
||||
new_entries.append(e)
|
||||
|
||||
for e in new_entries:
|
||||
nw = AnnounceStreamEntry(self.app, e, self)
|
||||
nw.timestamp = e[0]
|
||||
self.widget_list.insert(0, nw)
|
||||
self.widget_list.append(nw)
|
||||
|
||||
if len(new_entries) > 0:
|
||||
self.no_content = False
|
||||
if self.ilb != None:
|
||||
self.ilb.set_body(self.widget_list)
|
||||
else:
|
||||
if len(self.widget_list) == 0:
|
||||
self.no_content = True
|
||||
self.widget_list = [urwid.Text(f"No {self.current_tab} announces", align='center')]
|
||||
|
||||
if self.ilb != None:
|
||||
if self.ilb:
|
||||
self.ilb.set_body(self.widget_list)
|
||||
|
||||
def show_nodes_tab(self, button):
|
||||
self.current_tab = "nodes"
|
||||
self.update_widget_list()
|
||||
|
||||
def show_peers_tab(self, button):
|
||||
self.current_tab = "peers"
|
||||
self.update_widget_list()
|
||||
|
||||
def show_pn_tab(self, button):
|
||||
self.current_tab = "pn"
|
||||
self.update_widget_list()
|
||||
|
||||
def list_selection(self, arg1, arg2):
|
||||
pass
|
||||
|
@ -1612,9 +1652,15 @@ class NetworkDisplay():
|
|||
self.announce_stream_display.rebuild_widget_list()
|
||||
|
||||
def reinit_lxmf_peers(self):
|
||||
if self.lxmf_peers_display:
|
||||
si = self.lxmf_peers_display.ilb.get_selected_position()
|
||||
else:
|
||||
si = None
|
||||
self.lxmf_peers_display = LXMFPeers(self.app)
|
||||
self.lxmf_peers_display.delegate = self
|
||||
self.close_list_dialogs()
|
||||
if si != None:
|
||||
self.lxmf_peers_display.ilb.select_item(si)
|
||||
|
||||
def close_list_dialogs(self):
|
||||
if self.list_display == 0:
|
||||
|
@ -1801,10 +1847,11 @@ class LXMFPeerEntry(urwid.WidgetWrap):
|
|||
txfer_limit = RNS.prettysize(peer.propagation_transfer_limit*1000)
|
||||
else:
|
||||
txfer_limit = "No"
|
||||
ar = round(peer.acceptance_rate*100, 2)
|
||||
peer_info_str = sym+" "+display_str+"\n "+alive_string+", last heard "+pretty_date(int(peer.last_heard))
|
||||
peer_info_str += "\n "+str(peer.unhandled_message_count)+f" unhandled LXMs, {txfer_limit} sync limit\n"
|
||||
peer_info_str += f" {RNS.prettyspeed(peer.sync_transfer_rate)} STR, "
|
||||
peer_info_str += f"{RNS.prettyspeed(peer.link_establishment_rate)} LER\n"
|
||||
peer_info_str += f"{RNS.prettyspeed(peer.link_establishment_rate)} LER, {ar}% AR\n"
|
||||
widget = ListEntry(peer_info_str)
|
||||
self.display_widget = urwid.AttrMap(widget, style, focus_style)
|
||||
self.display_widget.destination_hash = destination_hash
|
||||
|
|
2483
nomadnet/vendor/configobj.py
vendored
2483
nomadnet/vendor/configobj.py
vendored
File diff suppressed because it is too large
Load diff
2
setup.py
2
setup.py
|
@ -30,6 +30,6 @@ setuptools.setup(
|
|||
entry_points= {
|
||||
'console_scripts': ['nomadnet=nomadnet.nomadnet:main']
|
||||
},
|
||||
install_requires=["rns>=0.9.1", "lxmf>=0.6.1", "urwid>=2.6.16", "qrcode"],
|
||||
install_requires=["rns>=0.9.4", "lxmf>=0.6.3", "urwid>=2.6.16", "qrcode"],
|
||||
python_requires=">=3.7",
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue