diff --git a/aprsd/cmds/webchat.py b/aprsd/cmds/webchat.py index 3c20f39..a7552f4 100644 --- a/aprsd/cmds/webchat.py +++ b/aprsd/cmds/webchat.py @@ -239,6 +239,13 @@ def index(): stats["transport"] = transport stats["aprs_connection"] = aprs_connection LOG.debug(f"initial stats = {stats}") + latitude = CONF.webchat.latitude + if latitude: + latitude = float(CONF.webchat.latitude) + + longitude = CONF.webchat.longitude + if longitude: + longitude = float(longitude) return flask.render_template( html_template, @@ -246,6 +253,8 @@ def index(): aprs_connection=aprs_connection, callsign=CONF.callsign, version=aprsd.__version__, + latitude=latitude, + longitude=longitude, ) diff --git a/aprsd/web/chat/static/js/gps.js b/aprsd/web/chat/static/js/gps.js index dbe0229..85329ba 100644 --- a/aprsd/web/chat/static/js/gps.js +++ b/aprsd/web/chat/static/js/gps.js @@ -1,9 +1,17 @@ function init_gps() { console.log("init_gps Called.") + console.log("latitude: "+latitude) + console.log("longitude: "+longitude) $("#send_beacon").click(function() { console.log("Send a beacon!") - getLocation(); + if (!isNaN(latitude) && !isNaN(longitude)) { + // webchat admin has hard coded lat/long in the config file + showPosition({'coords': {'latitude': latitude, 'longitude': longitude}}) + } else { + // Try to get the current location from the browser + getLocation(); + } }); } diff --git a/aprsd/web/chat/static/js/send-message-mobile.js b/aprsd/web/chat/static/js/send-message-mobile.js index d5fd126..7dc92e6 100644 --- a/aprsd/web/chat/static/js/send-message-mobile.js +++ b/aprsd/web/chat/static/js/send-message-mobile.js @@ -43,7 +43,6 @@ function init_chat() { } socket.emit("send", msg); $('#message').val(''); - $('#to_call').val(''); }); init_gps(); diff --git a/aprsd/web/chat/templates/index.html b/aprsd/web/chat/templates/index.html index 0388475..cf45909 100644 --- a/aprsd/web/chat/templates/index.html +++ b/aprsd/web/chat/templates/index.html @@ -17,6 +17,8 @@