Added ratchet info display to object details

This commit is contained in:
Mark Qvist 2024-09-07 22:29:30 +02:00
parent 5d586d26fc
commit e0e1540a94
4 changed files with 51 additions and 13 deletions

View file

@ -781,6 +781,14 @@ class RVDetails(MDRecycleView):
RNS.log("The contained exception was: "+str(e), RNS.LOG_ERROR)
RNS.trace_exception(e)
try:
ratchet_id = RNS.Identity.current_ratchet_id(self.delegate.object_hash)
if ratchet_id:
self.entries.append({"icon": "lock-check-outline", "text": f"Using ratchet [b]{RNS.prettyhexrep(ratchet_id)}[/b]", "on_release": pass_job})
except Exception as e:
RNS.trace_exception(e)
try:
nh = RNS.Transport.hops_to(self.delegate.object_hash)
nhi = self.delegate.app.sideband.reticulum.get_next_hop_if_name(self.delegate.object_hash)
@ -806,9 +814,25 @@ class RVDetails(MDRecycleView):
RNS.trace_exception(e)
try:
ticket_expires = self.delegate.app.sideband.message_router.get_outbound_ticket_expiry(self.delegate.object_hash)
stamp_cost = self.delegate.app.sideband.message_router.get_outbound_stamp_cost(self.delegate.object_hash)
t_str = ""
if ticket_expires:
t_str = " (but have ticket)"
if stamp_cost:
self.entries.append({"icon": "postage-stamp", "text": f"Required stamp cost [b]{stamp_cost}[/b]", "on_release": pass_job})
self.entries.append({"icon": "postage-stamp", "text": f"Required stamp cost [b]{stamp_cost}[/b]"+t_str, "on_release": pass_job})
if ticket_expires:
valid_for = ticket_expires - time.time()
self.entries.append({"icon": "ticket-confirmation", "text": f"Delivery ticket valid for [b]{RNS.prettytime(valid_for)}[/b]", "on_release": pass_job})
except Exception as e:
RNS.trace_exception(e)
try:
ticket_expires = self.delegate.app.sideband.message_router.get_outbound_ticket_expiry(self.delegate.object_hash)
if ticket_expires:
valid_for = ticket_expires - time.time()
self.entries.append({"icon": "ticket-confirmation", "text": f"Delivery ticket valid for [b]{RNS.prettytime(valid_for)}[/b]", "on_release": pass_job})
except Exception as e:
RNS.trace_exception(e)