Skip to content

Commit

Permalink
Merge pull request #790 from darksidelemm/testing
Browse files Browse the repository at this point in the history
Merge in proxy-fix branch.
  • Loading branch information
darksidelemm authored Jul 29, 2023
2 parents 72c98ed + 0079166 commit 6bc510f
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 37 deletions.
2 changes: 1 addition & 1 deletion auto_rx/autorx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions auto_rx/autorx/static/js/autorxapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -146,7 +146,7 @@ function disable_scanner(){

// Do the request
$.post(
"/disable_scanner",
"disable_scanner",
{"password": _api_password},
function(data){
//console.log(data);
Expand Down Expand Up @@ -183,7 +183,7 @@ function enable_scanner(){

// Do the request
$.post(
"/enable_scanner",
"enable_scanner",
{"password": _api_password},
function(data){
//console.log(data);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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.")
Expand All @@ -280,4 +280,4 @@ function start_decoder(){
$("#password-header").html("<h2>Incorrect Password</h2>");
}
});
}
}
4 changes: 2 additions & 2 deletions auto_rx/autorx/static/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
});
Expand Down
25 changes: 13 additions & 12 deletions auto_rx/autorx/templates/historical.html
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -64,7 +65,7 @@

$.ajax({
// Get list of sonde.
url: "/get_log_list",
url: "get_log_list",
dataType: 'json',
async: false,
success: function(data) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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];
Expand All @@ -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];
Expand All @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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');
}
}
}
Expand Down Expand Up @@ -1529,4 +1530,4 @@ <h2 style="display:inline; vertical-align:middle; margin-left: 35px; margin-bott
</div>
</div>
</body>
</html>
</html>
20 changes: 10 additions & 10 deletions auto_rx/autorx/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@

$( document ).ready(function() {

namespace = '/update_status';

var socket = io.connect(location.protocol + '//' + document.domain + ':' + location.port + namespace);

namespace = '/update_status';
var socket_path = "{{ url_for("static", filename="") }}".replace('static/', 'socket.io')
var socket = io.connect(location.origin+namespace, {'path': socket_path});
$.ajax({
// Get station.cfg file.
url: "/get_config",
url: "get_config",
dataType: 'json',
async: false,
success: function(data) {
Expand All @@ -129,7 +129,7 @@

$.ajax({
// Get local version number.
url: "/get_version",
url: "get_version",
dataType: 'json',
async: true,
success: function(data) {
Expand Down Expand Up @@ -196,7 +196,7 @@
socket.on('scan_event', function(msg) {
// There is Scan data ready for us!
// Grab the latest set of data.
$.getJSON("/get_scan_data", function(data){
$.getJSON("get_scan_data", function(data){
// Load the data into our data stores.
scan_chart_spectra.columns[0] = ['x_spectra'].concat(data.freq);
scan_chart_spectra.columns[1] = ['Spectra'].concat(data.power);
Expand Down Expand Up @@ -736,7 +736,7 @@
var initial_load_complete = false;
selected_sonde = "";
$.ajax({ // Get archived data.
url: "/get_telemetry_archive",
url: "get_telemetry_archive",
dataType: 'json',
async: true,
success: function(data) {
Expand Down Expand Up @@ -1571,7 +1571,7 @@ <h2 style="display:inline;vertical-align:middle;">Show Software Version</h2>
<h2 style="display:inline;vertical-align:middle;">Live KML</h2>
&nbsp;
<div style="display:inline;vertical-align:middle;">
<button onclick="window.location.href='/rs.kml'">SHOW</button>
<button onclick="window.location.href='rs.kml'">SHOW</button>
</div>
<br>
<br>
Expand All @@ -1592,7 +1592,7 @@ <h2 style="display:inline;vertical-align:middle;">Controls</h2>
<h2 style="display:inline;vertical-align:middle;">Historical View</h2>
&nbsp;
<div style="display:inline;vertical-align:middle;">
<button onclick="window.location.href='/historical.html'">OPEN</button>
<button onclick="window.location.href='historical.html'">OPEN</button>
</div>
<br>
<br>
Expand Down
2 changes: 1 addition & 1 deletion auto_rx/autorx/templates/skewt_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h2>auto_rx SkewT Plot Testing</h2>
_decim = $('#decimation-input').val();

$.post(
"/get_log_detail",
"get_log_detail",
{serial: _serial, decimation:_decim},
function(data){
console.log(data);
Expand Down
10 changes: 6 additions & 4 deletions auto_rx/autorx/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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"],
Expand All @@ -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)
Expand Down

0 comments on commit 6bc510f

Please sign in to comment.