use http api instead of websocket for sending announce

This commit is contained in:
liamcottle
2024-07-09 00:45:27 +12:00
parent a1401bed8b
commit c7b9b1d580
3 changed files with 5 additions and 19 deletions

View File

@@ -742,7 +742,7 @@
await window.axios.get(`/api/v1/announce`);
} catch(e) {
alert("failed to announce");
console.log(error);
console.log(e);
}
},
},

View File

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

6
web.py
View File

@@ -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":