From 6379168b107078d2545df30e95f0fa718e870341 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Tue, 21 May 2024 00:09:03 +1200 Subject: [PATCH] add ui to show my audio call destination hash --- public/call.html | 25 ++++++++++++++++++++++++- web.py | 22 +++++++++++++++++----- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/public/call.html b/public/call.html index 3b96a8e..515bd31 100644 --- a/public/call.html +++ b/public/call.html @@ -94,7 +94,7 @@
Start a new Call
-
+
@@ -102,6 +102,10 @@ Initiate Call
+
+
My Destination Hash
+
{{ myAudioCallAddressHash || "Unknown" }}
+
@@ -152,6 +156,8 @@ audioCalls: [], + myAudioCallAddressHash: null, + destinationHash: null, isInitiatingCall: false, @@ -173,6 +179,9 @@ }, mounted: function() { + // update config + this.getConfig(); + // update calls list this.updateCallsList(); @@ -439,6 +448,20 @@ return parseFloat((bytes / Math.pow(k, i)).toFixed(decimals)) + ' ' + sizes[i]; }, + async getConfig() { + try { + + // fetch calls + const response = await axios.get("/api/v1/config"); + + // update ui + this.myAudioCallAddressHash = response.data.config.audio_call_address_hash; + + } catch(e) { + // do nothing on error + console.error(e); + } + }, async updateCallsList() { try { diff --git a/web.py b/web.py index d389ed7..6e3aede 100644 --- a/web.py +++ b/web.py @@ -240,6 +240,13 @@ class ReticulumWebChat: return websocket_response + # get config + @routes.get("/api/v1/config") + async def index(request): + return web.json_response({ + "config": self.get_config_dict(), + }) + # get calls @routes.get("/api/v1/calls") async def index(request): @@ -753,13 +760,18 @@ class ReticulumWebChat: async def send_config_to_websocket_clients(self): await self.websocket_broadcast(json.dumps({ "type": "config", - "config": { - "display_name": self.config.display_name.get(), - "identity_hash": self.identity.hexhash, - "lxmf_address_hash": self.local_lxmf_destination.hexhash, - }, + "config": self.get_config_dict(), })) + # returns a dictionary of config + def get_config_dict(self): + return { + "display_name": self.config.display_name.get(), + "identity_hash": self.identity.hexhash, + "lxmf_address_hash": self.local_lxmf_destination.hexhash, + "audio_call_address_hash": self.audio_call_manager.audio_call_receiver.destination.hexhash, + } + # convert app data to string, or return none unable to do so def convert_app_data_to_string(self, app_data):