diff --git a/auto_rx/autorx/__init__.py b/auto_rx/autorx/__init__.py index e7065df5..d0c2d927 100644 --- a/auto_rx/autorx/__init__.py +++ b/auto_rx/autorx/__init__.py @@ -12,7 +12,7 @@ # MINOR - New sonde type support, other fairly big changes that may result in telemetry or config file incompatability issus. # PATCH - Small changes, or minor feature additions. -__version__ = "1.6.2-beta6" +__version__ = "1.6.2-beta7" # Global Variables diff --git a/auto_rx/autorx/static/js/autorxapi.js b/auto_rx/autorx/static/js/autorxapi.js index 14d5ab6e..340cfcff 100644 --- a/auto_rx/autorx/static/js/autorxapi.js +++ b/auto_rx/autorx/static/js/autorxapi.js @@ -2,7 +2,7 @@ function update_task_list(){ // Grab the latest task list. - $.getJSON("/get_task_list", function(data){ + $.getJSON("get_task_list", function(data){ var task_info = ""; $('#stop-frequency-select').children().remove(); @@ -117,7 +117,7 @@ function verify_password(){ // Do the request $.post( - "/check_password", + "check_password", {"password": _api_password}, function(data){ // If OK, update the header to indicate the password was OK. @@ -146,7 +146,7 @@ function disable_scanner(){ // Do the request $.post( - "/disable_scanner", + "disable_scanner", {"password": _api_password}, function(data){ //console.log(data); @@ -183,7 +183,7 @@ function enable_scanner(){ // Do the request $.post( - "/enable_scanner", + "enable_scanner", {"password": _api_password}, function(data){ //console.log(data); @@ -215,7 +215,7 @@ function stop_decoder(){ // Do the request $.post( - "/stop_decoder", + "stop_decoder", {password: _api_password, freq: _decoder}, function(data){ //console.log(data); @@ -266,7 +266,7 @@ function start_decoder(){ // Do the request $.post( - "/start_decoder", + "start_decoder", {password: _api_password, freq: _freq_hz, type: _type}, function(data){ alert("Added requested decoder to results queue.") @@ -280,4 +280,4 @@ function start_decoder(){ $("#password-header").html("

Incorrect Password

"); } }); -} \ No newline at end of file +} diff --git a/auto_rx/autorx/static/js/utils.js b/auto_rx/autorx/static/js/utils.js index 8ecb224c..270281cb 100644 --- a/auto_rx/autorx/static/js/utils.js +++ b/auto_rx/autorx/static/js/utils.js @@ -16,12 +16,12 @@ var sondeDescentIcons = {}; // TODO: Make these /static URLS be filled in with templates (or does it not matter?) for (_col in colour_values){ sondeAscentIcons[colour_values[_col]] = L.icon({ - iconUrl: "/static/img/balloon-" + colour_values[_col] + '.png', + iconUrl: "static/img/balloon-" + colour_values[_col] + '.png', iconSize: [46, 85], iconAnchor: [23, 76] }); sondeDescentIcons[colour_values[_col]] = L.icon({ - iconUrl: "/static/img/parachute-" + colour_values[_col] + '.png', + iconUrl: "static/img/parachute-" + colour_values[_col] + '.png', iconSize: [46, 84], iconAnchor: [23, 76] }); diff --git a/auto_rx/autorx/templates/historical.html b/auto_rx/autorx/templates/historical.html index 03551908..95d7b577 100644 --- a/auto_rx/autorx/templates/historical.html +++ b/auto_rx/autorx/templates/historical.html @@ -46,12 +46,13 @@ quickLandings = false; namespace = '/update_status'; + var socket_path = "{{ url_for("static", filename="") }}".replace('static/', 'socket.io') + var socket = io.connect(location.origin+namespace, {'path': socket_path}); + - var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port + namespace); - $.ajax({ // Get station.cfg file. - url: "/get_config", + url: "get_config", dataType: 'json', async: false, success: function(data) { @@ -64,7 +65,7 @@ $.ajax({ // Get list of sonde. - url: "/get_log_list", + url: "get_log_list", dataType: 'json', async: false, success: function(data) { @@ -462,7 +463,7 @@ highest = i; } $.ajax({ - url: "/get_log_by_serial/" + selectedrows[i]['serial'], + url: "get_log_by_serial/" + selectedrows[i]['serial'], dataType: 'json', async: true, success: function(data) { @@ -731,7 +732,7 @@ table.selectRow(); mymap.eachLayer(function(layer){ try { - if (layer['options']['icon']['options']['iconUrl'] == "/static/img/landing_marker.png" || layer['options']['icon']['options']['iconUrl'] == "/static/img/launch_marker.png") { + if (layer['options']['icon']['options']['iconUrl'] == "static/img/landing_marker.png" || layer['options']['icon']['options']['iconUrl'] == "static/img/launch_marker.png") { new_icon = layer['options']['icon']; new_icon.options.iconSize = [20, 20]; new_icon.options.iconAnchor = [10, 10]; @@ -746,7 +747,7 @@ table.deselectRow(); mymap.eachLayer(function(layer){ try { - if (layer['options']['icon']['options']['iconUrl'] == "/static/img/landing_marker.png" || layer['options']['icon']['options']['iconUrl'] == "/static/img/launch_marker.png") { + if (layer['options']['icon']['options']['iconUrl'] == "static/img/landing_marker.png" || layer['options']['icon']['options']['iconUrl'] == "static/img/launch_marker.png") { new_icon = layer['options']['icon']; new_icon.options.iconSize = [15, 15]; new_icon.options.iconAnchor = [7.5, 7.5]; @@ -770,7 +771,7 @@ mymap.eachLayer(function(layer){ try { - if (layer['options']['icon']['options']['iconUrl'] == "/static/img/landing_marker.png" || layer['options']['icon']['options']['iconUrl'] == "/static/img/launch_marker.png") { + if (layer['options']['icon']['options']['iconUrl'] == "static/img/landing_marker.png" || layer['options']['icon']['options']['iconUrl'] == "static/img/launch_marker.png") { if (layer['options']['icon']['options']['iconSize'][0] == 15) { if (!shown.includes(layer['options']['title'])) { mymap.removeLayer(layer); @@ -857,7 +858,7 @@ _serial = selectedrows[selectedrows.length-1]['serial']; _type = selectedrows[selectedrows.length-1]['type']; $.post( - "/get_log_detail", + "get_log_detail", {serial: _serial, decimation:decimation}, async function(data){ try { @@ -947,13 +948,13 @@ if(_serial_list.length == table.getData().length){ // Request all log files - window.open("/export_all_log_files" , '_blank'); + window.open("export_all_log_files" , '_blank'); }else { // Just request the selected ones. // Convert the list to JSON, and then to base64 b64 = btoa(JSON.stringify(_serial_list)); // Make the request in a new tab - window.open("/export_log_files/"+b64 , '_blank'); + window.open("export_log_files/"+b64 , '_blank'); } } } @@ -1529,4 +1530,4 @@

Show Software Version

Live KML

 
- +


@@ -1592,7 +1592,7 @@

Controls

Historical View

 
- +


diff --git a/auto_rx/autorx/templates/skewt_test.html b/auto_rx/autorx/templates/skewt_test.html index 7fe28d63..ea2ceba9 100644 --- a/auto_rx/autorx/templates/skewt_test.html +++ b/auto_rx/autorx/templates/skewt_test.html @@ -59,7 +59,7 @@

auto_rx SkewT Plot Testing

_decim = $('#decimation-input').val(); $.post( - "/get_log_detail", + "get_log_detail", {serial: _serial, decimation:_decim}, function(data){ console.log(data); diff --git a/auto_rx/autorx/web.py b/auto_rx/autorx/web.py index b86252e9..94a4cda9 100644 --- a/auto_rx/autorx/web.py +++ b/auto_rx/autorx/web.py @@ -27,6 +27,7 @@ import flask from flask import request, abort, make_response, send_file from flask_socketio import SocketIO +from werkzeug.middleware.proxy_fix import ProxyFix import re try: @@ -44,6 +45,7 @@ # Instantiate our Flask app. app = flask.Flask(__name__) +app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1, x_prefix=1) app.config["SECRET_KEY"] = "secret!" app.config["TEMPLATES_AUTO_RELOAD"] = True app.jinja_env.auto_reload = True @@ -148,7 +150,7 @@ def flask_get_kml(): kml = Kml() netlink = kml.newnetworklink(name="Radiosonde Auto-RX Live Telemetry") netlink.open = 1 - netlink.link.href = flask.request.host_url + "rs_feed.kml" + netlink.link.href = flask.request.url_root + "rs_feed.kml" try: netlink.link.refreshinterval = _config["kml_refresh_rate"] except KeyError: @@ -171,7 +173,7 @@ def flask_get_kml_feed(): description="AutoRX Ground Station", ) pnt.open = 1 - pnt.iconstyle.icon.href = flask.request.host_url + "static/img/antenna-green.png" + pnt.iconstyle.icon.href = flask.request.url_root + "static/img/antenna-green.png" pnt.coords = [ ( autorx.config.global_config["station_lon"], @@ -198,9 +200,9 @@ def flask_get_kml_feed(): Pressure: {pressure:.1f} hPa """ if flask_telemetry_store[rs_id]["latest_telem"]["vel_v"] > -5: - icon = flask.request.host_url + "static/img/balloon-green.png" + icon = flask.request.url_root + "static/img/balloon-green.png" else: - icon = flask.request.host_url + "static/img/parachute-green.png" + icon = flask.request.url_root + "static/img/parachute-green.png" # Add folder fol = kml.newfolder(name=rs_id)