From 37cc6aa158b7e5511b28474ec05ad9e42e4cb030 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Fri, 25 Jul 2025 21:56:02 +1200 Subject: [PATCH] add button to identify self to nomad network node --- meshchat.py | 24 ++++++++++++++ .../nomadnetwork/NomadNetworkPage.vue | 33 ++++++++++++++++++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/meshchat.py b/meshchat.py index 871df15..7026906 100644 --- a/meshchat.py +++ b/meshchat.py @@ -1758,6 +1758,30 @@ class ReticulumMeshChat: "lxmf_message": lxmf_message, }) + # identify self on existing nomadnetwork link + @routes.post("/api/v1/nomadnetwork/{destination_hash}/identify") + async def index(request): + + # get path params + destination_hash = request.match_info.get("destination_hash", "") + + # convert destination hash to bytes + destination_hash = bytes.fromhex(destination_hash) + + # identify to existing active link + if destination_hash in nomadnet_cached_links: + link = nomadnet_cached_links[destination_hash] + if link.status is RNS.Link.ACTIVE: + link.identify(self.identity) + return web.json_response({ + "message": "Identity has been sent!", + }) + + # failed to identify + return web.json_response({ + "message": "Failed to identify. No active link to destination.", + }, status=500) + # delete lxmf message @routes.delete("/api/v1/lxmf-messages/{hash}") async def index(request): diff --git a/src/frontend/components/nomadnetwork/NomadNetworkPage.vue b/src/frontend/components/nomadnetwork/NomadNetworkPage.vue index efca11e..ff06cf3 100644 --- a/src/frontend/components/nomadnetwork/NomadNetworkPage.vue +++ b/src/frontend/components/nomadnetwork/NomadNetworkPage.vue @@ -17,8 +17,21 @@ - {{ selectedNodePath.hops }} {{ selectedNodePath.hops === 1 ? 'hop' : 'hops' }} away - +
+
+
+
+ + + +
+
+
+
+ + +
@@ -773,6 +786,24 @@ export default { } }, + async identify(destinationHash) { + try { + + // ask user to confirm + if(!confirm("Are you sure you want to identify yourself to this NomadNetwork Node? The page will reload after your identity has been sent.")){ + return; + } + + // identify self to nomadnetwork node + await window.axios.post(`/api/v1/nomadnetwork/${destinationHash}/identify`); + + // reload page + this.reloadNodePage(); + + } catch(e) { + DialogUtils.alert(e.response?.data?.message ?? "Failed to identify!"); + } + }, downloadNomadNetFile(destinationHash, filePath, onSuccessCallback, onFailureCallback, onProgressCallback) { try {