From 4d6beb4af8633d046828137b7ea9c433ec3d377b Mon Sep 17 00:00:00 2001 From: liamcottle Date: Tue, 21 May 2024 04:01:38 +1200 Subject: [PATCH] add button and api to announce from call ui --- public/call.html | 28 +++++++++++++++++++++++++--- web.py | 26 ++++++++++++++++++++------ 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/public/call.html b/public/call.html index 5868f30..e7231fc 100644 --- a/public/call.html +++ b/public/call.html @@ -149,9 +149,23 @@ Initiate Call -
-
My Destination Hash
-
{{ myAudioCallAddressHash || "Unknown" }}
+
+
+
My Destination Hash
+
{{ myAudioCallAddressHash || "Unknown" }}
+
+
@@ -645,6 +659,14 @@ } }, + async announce() { + try { + await window.axios.get(`/api/v1/announce`); + } catch(e) { + alert("failed to announce"); + console.log(error); + } + }, }, computed: { activeAudioCalls: function() { diff --git a/web.py b/web.py index 0cf9007..e6c8001 100644 --- a/web.py +++ b/web.py @@ -403,6 +403,16 @@ class ReticulumWebChat: "message": "call has been hungup", }) + # announce + @routes.get("/api/v1/announce") + async def index(request): + + self.announce() + + return web.json_response({ + "message": "announcing", + }) + # serve announces @routes.get("/api/v1/announces") async def index(request): @@ -611,6 +621,15 @@ class ReticulumWebChat: app.on_startup.append(on_startup) web.run_app(app, host=host, port=port) + # handle announcing + def announce(self): + + # send announce for lxmf + self.local_lxmf_destination.announce(app_data=self.config.display_name.get().encode("utf-8")) + + # send announce for audio call + self.audio_call_manager.announce(app_data=self.config.display_name.get().encode("utf-8")) + # handle data received from websocket client async def on_websocket_data_received(self, client, data): @@ -669,12 +688,7 @@ class ReticulumWebChat: # handle sending an announce elif _type == "announce": - - # send announce for lxmf - self.local_lxmf_destination.announce(app_data=self.config.display_name.get().encode("utf-8")) - - # send announce for audio call - self.audio_call_manager.announce(app_data=self.config.display_name.get().encode("utf-8")) + self.announce() # handle downloading a file from a nomadnet node elif _type == "nomadnet.file.download":