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 - +