Append data vars to URL in browser. Fixes for Conversation list dialog not closing after save

master
zenith 2026-05-20 22:28:32 -04:00
parent 3ce348dbb2
commit df6245be67
2 changed files with 33 additions and 11 deletions

View File

@ -141,12 +141,21 @@ class Browser:
def current_url(self):
if self.destination_hash == None:
return ""
else:
if self.path == None:
path = ""
else:
path = self.path
return RNS.hexrep(self.destination_hash, delimit=False)+":"+path
path = "" if self.path == None else self.path
url = RNS.hexrep(self.destination_hash, delimit=False)+":"+path
if isinstance(self.request_data, dict) and self.request_data:
parts = []
for k, v in self.request_data.items():
if not isinstance(k, str):
continue
if not k.startswith("var_"):
continue
parts.append(k[4:]+"="+str(v))
if parts:
url += "`" + "|".join(parts)
return url
def url_hash(self, url):
if url == None:

View File

@ -809,10 +809,23 @@ class ConversationsDisplay():
self.dialog_open = True
item = self.ilb.get_selected_item()
if item == None:
self.dialog_open = False
return
source_hash_text = item.source_hash
display_name = self.ilb.get_selected_item().display_name
if display_name == None:
source_hash_text = getattr(item, "source_hash", None)
if source_hash_text is None:
blocked = getattr(item, "blocked_dest_hash", None)
if isinstance(blocked, (bytes, bytearray)):
source_hash_text = RNS.hexrep(blocked, delimit=False)
if source_hash_text is None:
self.dialog_open = False
return
display_name = getattr(item, "display_name", None)
if display_name is None:
try:
display_name = self.app.directory.display_name(bytes.fromhex(source_hash_text))
except Exception:
display_name = None
if display_name is None:
display_name = ""
e_id = urwid.Edit(caption="Addr : ",edit_text=source_hash_text)
@ -872,8 +885,8 @@ class ConversationsDisplay():
r_propagated = urwid.RadioButton(method_button_group, "Use propagation nodes", state=propagated_selected)
def dismiss_dialog(sender):
self.update_conversation_list()
self.dialog_open = False
self.update_conversation_list()
def confirmed(sender):
try:
@ -894,8 +907,8 @@ class ConversationsDisplay():
entry = DirectoryEntry(source_hash, display_name, trust_level, preferred_delivery=delivery, sort_rank=sort_rank, notes=notes_value)
self.app.directory.remember(entry)
self._refresh_open_conversation_widget(source_hash_text)
self.update_conversation_list()
self.dialog_open = False
self.update_conversation_list()
self.app.ui.main_display.sub_displays.network_display.directory_change_callback()
except Exception as e:
RNS.log("Could not save directory entry. The contained exception was: "+str(e), RNS.LOG_VERBOSE)