From 4c7e27c88bbac8e8b471685ac07cc85e802816b2 Mon Sep 17 00:00:00 2001 From: Hemna Date: Wed, 17 Apr 2024 12:34:01 -0400 Subject: [PATCH] Webchat Send Beacon uses Path selected in UI This patch changes the Send Beacon button capability in webchat to use the path selected in the UI for the actual beacon being sent out. --- aprsd/cmds/webchat.py | 9 +++++++++ aprsd/web/chat/static/js/gps.js | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/aprsd/cmds/webchat.py b/aprsd/cmds/webchat.py index 8843565..813bbc4 100644 --- a/aprsd/cmds/webchat.py +++ b/aprsd/cmds/webchat.py @@ -543,6 +543,14 @@ class SendMessageNamespace(Namespace): long = data["longitude"] LOG.debug(f"Lat {lat}") LOG.debug(f"Long {long}") + path = data.get("path", None) + if not path: + path = [] + elif "," in path: + path_opts = path.split(",") + path = [x.strip() for x in path_opts] + else: + path = [path] tx.send( packets.BeaconPacket( @@ -551,6 +559,7 @@ class SendMessageNamespace(Namespace): latitude=lat, longitude=long, comment="APRSD WebChat Beacon", + path=path, ), direct=True, ) diff --git a/aprsd/web/chat/static/js/gps.js b/aprsd/web/chat/static/js/gps.js index 9ce9329..c4b8970 100644 --- a/aprsd/web/chat/static/js/gps.js +++ b/aprsd/web/chat/static/js/gps.js @@ -64,9 +64,11 @@ function showError(error) { function showPosition(position) { console.log("showPosition Called"); + path = $('#pkt_path option:selected').val(); msg = { 'latitude': position.coords.latitude, - 'longitude': position.coords.longitude + 'longitude': position.coords.longitude, + 'path': path, } console.log(msg); $.toast({