use http api instead of websocket for sending announce
This commit is contained in:
@@ -742,7 +742,7 @@
|
||||
await window.axios.get(`/api/v1/announce`);
|
||||
} catch(e) {
|
||||
alert("failed to announce");
|
||||
console.log(error);
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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
6
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":
|
||||
|
||||
|
||||
Reference in New Issue
Block a user