mirror of
https://github.com/craigerl/aprsd.git
synced 2025-04-13 15:08:33 -04:00
Make use of webchat gps config options
This patch makes use of the gps settings in the webchat section. If the user sets the latitude and longitude in the config file, then the gps beacon button will be enabled. The gps button will still be enabled if the http connection is over SSL.
This commit is contained in:
parent
f922b3f97b
commit
2e9a204c74
@ -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,
|
||||
)
|
||||
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@ function init_chat() {
|
||||
}
|
||||
socket.emit("send", msg);
|
||||
$('#message').val('');
|
||||
$('#to_call').val('');
|
||||
});
|
||||
|
||||
init_gps();
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
var initial_stats = {{ initial_stats|tojson|safe }};
|
||||
var latitude = parseFloat('{{ latitude|safe }}');
|
||||
var longitude = parseFloat('{{ longitude|safe }}');
|
||||
|
||||
var memory_chart = null
|
||||
var message_chart = null
|
||||
@ -27,7 +29,10 @@
|
||||
init_chat();
|
||||
reset_Tabs();
|
||||
|
||||
if (location.protocol != 'https:') {
|
||||
console.log("latitude", latitude);
|
||||
console.log("longitude", longitude);
|
||||
|
||||
if (isNaN(latitude) || isNaN(longitude) && location.protocol != 'https:') {
|
||||
// Have to disable the beacon button.
|
||||
$('#send_beacon').prop('disabled', true);
|
||||
}
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
var initial_stats = {{ initial_stats|tojson|safe }};
|
||||
var latitude = parseFloat('{{ latitude|safe }}');
|
||||
var longitude = parseFloat('{{ longitude|safe }}');
|
||||
|
||||
var memory_chart = null
|
||||
var message_chart = null
|
||||
@ -24,6 +26,14 @@
|
||||
console.log(initial_stats);
|
||||
start_update();
|
||||
init_chat();
|
||||
|
||||
console.log("latitude", latitude);
|
||||
console.log("longitude", longitude);
|
||||
|
||||
if (isNaN(latitude) || isNaN(longitude) && location.protocol != 'https:') {
|
||||
// Have to disable the beacon button.
|
||||
$('#send_beacon').prop('disabled', true);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
Loading…
Reference in New Issue
Block a user