From c7b9b1d580886beda7976a2b4bf9212cd3184284 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Tue, 9 Jul 2024 00:45:27 +1200 Subject: [PATCH] use http api instead of websocket for sending announce --- public/call.html | 2 +- public/index.html | 16 +++------------- web.py | 6 +----- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/public/call.html b/public/call.html index e0a24f1..1d2df2b 100644 --- a/public/call.html +++ b/public/call.html @@ -742,7 +742,7 @@ await window.axios.get(`/api/v1/announce`); } catch(e) { alert("failed to announce"); - console.log(error); + console.log(e); } }, }, diff --git a/public/index.html b/public/index.html index 08d9b99..b588a1b 100644 --- a/public/index.html +++ b/public/index.html @@ -1550,21 +1550,11 @@ }, async sendAnnounce() { - // do nothing if not connected to websocket - if(!this.isWebsocketConnected){ - this.alert("Not connected to WebSocket!"); - return; - } - try { - - // ask reticulum to announce - this.ws.send(JSON.stringify({ - "type": "announce", - })); - + await window.axios.get(`/api/v1/announce`); } catch(e) { - console.error(e); + this.alert("failed to announce"); + console.log(e); } // fetch config so it updates last announced timestamp diff --git a/web.py b/web.py index 7ee89f2..4d8bad1 100644 --- a/web.py +++ b/web.py @@ -675,7 +675,7 @@ class ReticulumMeshChat: @routes.get("/api/v1/announce") async def index(request): - self.announce() + await self.announce() return web.json_response({ "message": "announcing", @@ -1068,10 +1068,6 @@ class ReticulumMeshChat: # send config to websocket clients await self.send_config_to_websocket_clients() - # handle sending an announce - elif _type == "announce": - await self.announce() - # handle downloading a file from a nomadnet node elif _type == "nomadnet.file.download":