Skip to content

Commit

Permalink
Added hops display to node info. Fixed node info display for unknown …
Browse files Browse the repository at this point in the history
…ops and addresses.
  • Loading branch information
markqvist committed Apr 6, 2022
1 parent 8b84864 commit 4ff9968
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nomadnet/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def serve_page(self, path, data, request_id, remote_identity, requested_at):
except Exception as e:
RNS.log("Error while fetching list of allowed identities for request: "+str(e), RNS.LOG_ERROR)

if remote_identity.hash in allowed_list:
if hasattr(remote_identity, "hash") and remote_identity.hash in allowed_list:
request_allowed = True
else:
request_allowed = False
Expand Down
22 changes: 20 additions & 2 deletions nomadnet/ui/textui/Network.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,29 @@ def save_node(sender):
]

node_ident = RNS.Identity.recall(source_hash)
op_hash = RNS.Destination.hash_from_name_and_identity("lxmf.delivery", node_ident)
op_str = self.app.directory.simplest_display_str(op_hash)
if node_ident != None:
op_hash = RNS.Destination.hash_from_name_and_identity("lxmf.delivery", node_ident)
op_str = self.app.directory.simplest_display_str(op_hash)
else:
op_str = "Unknown"

operator_entry = urwid.Text("Operator : "+op_str, align="left")
pile_widgets.insert(4, operator_entry)

hops = RNS.Transport.hops_to(source_hash)
if hops == 1:
str_s = ""
else:
str_s = "s"

if hops != RNS.Transport.PATHFINDER_M:
hops_str = str(hops)+" hop"+str_s
else:
hops_str = "Unknown"

operator_entry = urwid.Text("Distance : "+hops_str, align="left")
pile_widgets.insert(5, operator_entry)

pile = urwid.Pile(pile_widgets)

self.display_widget = urwid.Filler(pile, valign="top", height="pack")
Expand Down

0 comments on commit 4ff9968

Please sign in to comment.