diff --git a/meshchat.py b/meshchat.py index b9cc6e4..718dcd9 100644 --- a/meshchat.py +++ b/meshchat.py @@ -1047,6 +1047,23 @@ class ReticulumMeshChat: }, }) + # drop path to destination + @routes.post("/api/v1/destination/{destination_hash}/drop-path") + 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) + + # drop path + self.reticulum.drop_path(destination_hash) + + return web.json_response({ + "message": "Path has been dropped", + }) + # get signal metrics for a destination by checking the latest announce or lxmf message received from them @routes.get("/api/v1/destination/{destination_hash}/signal-metrics") async def index(request): diff --git a/src/frontend/components/ping/PingPage.vue b/src/frontend/components/ping/PingPage.vue index d4a3cb2..27545f7 100644 --- a/src/frontend/components/ping/PingPage.vue +++ b/src/frontend/components/ping/PingPage.vue @@ -29,15 +29,18 @@
- - - +
@@ -181,6 +184,24 @@ export default { } }, + async dropPath() { + + // simple check to ensure destination hash is valid + if(this.destinationHash == null || this.destinationHash.length !== 32){ + DialogUtils.alert("Invalid Destination Hash!"); + return; + } + + try { + const response = await window.axios.post(`/api/v1/destination/${this.destinationHash}/drop-path`); + DialogUtils.alert(response.data.message); + } catch(e) { + console.log(e); + const message = e.response?.data?.message ?? `Failed to drop path: ${e}`; + DialogUtils.alert(message); + } + + }, addPingResult(result) { this.pingResults.push(result); this.scrollPingResultsToBottom();