From 2026b46113c199c669180d61690e59a2f51d3a8b Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Fri, 15 May 2026 14:59:19 +0100 Subject: [PATCH] Only include credentials (if we have them) on map page and on the SSE aspect of the spots page, to prevent first-time load delays on spots --- templates/about.html | 2 +- templates/add_spot.html | 4 ++-- templates/alerts.html | 4 ++-- templates/bands.html | 6 +++--- templates/base.html | 8 ++++---- templates/conditions.html | 4 ++-- templates/map.html | 6 +++--- templates/spots.html | 6 +++--- templates/status.html | 4 ++-- webassets/js/alerts.js | 8 +++++--- webassets/js/bands.js | 8 +++++--- webassets/js/map.js | 8 +++++--- webassets/js/spots.js | 10 ++++++---- 13 files changed, 43 insertions(+), 35 deletions(-) diff --git a/templates/about.html b/templates/about.html index 8aa094f..fae2e95 100644 --- a/templates/about.html +++ b/templates/about.html @@ -69,7 +69,7 @@

This software is dedicated to the memory of Tom G1PJB, SK, a friend and colleague who sadly passed away around the time I started writing it in Autumn 2025. I was looking forward to showing it to you when it was done.

- + {% end %} \ No newline at end of file diff --git a/templates/add_spot.html b/templates/add_spot.html index 902fa1a..875f992 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -69,8 +69,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/alerts.html b/templates/alerts.html index 2630e05..1fbf306 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -70,8 +70,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/bands.html b/templates/bands.html index 17fcbce..c2fed6f 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -76,9 +76,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index a068fb3..3d0f179 100644 --- a/templates/base.html +++ b/templates/base.html @@ -24,7 +24,7 @@ Spothole - + @@ -52,9 +52,9 @@ integrity="sha384-L1eE4eD41kpBIWe2I0eHy+GnEUC4RIpcvibVW2JCminuPlTl+2Bc528iPdVMg5Dn" crossorigin="anonymous"> - - - + + + diff --git a/templates/conditions.html b/templates/conditions.html index 5c2abe4..07ecf5a 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -230,8 +230,8 @@ - - + + diff --git a/templates/map.html b/templates/map.html index f2569a6..3ea8bfb 100644 --- a/templates/map.html +++ b/templates/map.html @@ -94,9 +94,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/spots.html b/templates/spots.html index 12d3194..862d458 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -104,9 +104,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/status.html b/templates/status.html index 3e849cf..abdc528 100644 --- a/templates/status.html +++ b/templates/status.html @@ -59,8 +59,8 @@ - - + + diff --git a/webassets/js/alerts.js b/webassets/js/alerts.js index 362e030..0bad002 100644 --- a/webassets/js/alerts.js +++ b/webassets/js/alerts.js @@ -6,7 +6,7 @@ var alerts = [] // Load alerts and populate the table. function loadAlerts() { - $.getJSON('/api/v1/alerts' + buildQueryString(), function(jsonData) { + $.getJSON('/api/v1/alerts' + buildQueryString(false), function(jsonData) { // Store last updated time lastUpdateTime = moment.utc(); updateRefreshDisplay(); @@ -18,7 +18,7 @@ function loadAlerts() { } // Build a query string for the API, based on the filters that the user has selected. -function buildQueryString() { +function buildQueryString(includeCredentials) { var str = "?"; ["dx_continent", "source"].forEach(fn => { if (!allFilterOptionsSelected(fn)) { @@ -33,7 +33,9 @@ function buildQueryString() { if ($("#dxpeditions_skip_max_duration_check")[0].checked) { str = str + "&dxpeditions_skip_max_duration_check=true"; } - str = str + getCredentialQueryString(); + if (includeCredentials) { + str = str + getCredentialQueryString(); + } return str; } diff --git a/webassets/js/bands.js b/webassets/js/bands.js index 568a7eb..3ee7c7a 100644 --- a/webassets/js/bands.js +++ b/webassets/js/bands.js @@ -12,7 +12,7 @@ BAND_COLUMN_SPOT_DIV_HEIGHT_PX = BAND_COLUMN_FONT_SIZE * 1.6; // Load spots and populate the bands display. function loadSpots() { - $.getJSON('/api/v1/spots' + buildQueryString(), function(jsonData) { + $.getJSON('/api/v1/spots' + buildQueryString(false), function(jsonData) { // Store last updated time lastUpdateTime = moment.utc(); updateRefreshDisplay(); @@ -24,7 +24,7 @@ function loadSpots() { } // Build a query string for the API, based on the filters that the user has selected. -function buildQueryString() { +function buildQueryString(includeCredentials) { var str = "?"; ["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => { if (!allFilterOptionsSelected(fn)) { @@ -34,7 +34,9 @@ function buildQueryString() { str = str + "max_age=" + $("#max-spot-age option:selected").val(); // Additional filters for the bands view: No dupes, no QRT str = str + "&dedupe=true&allow_qrt=false"; - str = str + getCredentialQueryString(); + if (includeCredentials) { + str = str + getCredentialQueryString(); + } return str; } diff --git a/webassets/js/map.js b/webassets/js/map.js index 55126fd..d0e1ddd 100644 --- a/webassets/js/map.js +++ b/webassets/js/map.js @@ -28,7 +28,7 @@ var firstLoad = true; // Load spots and populate the map. function loadSpots() { - $.getJSON('/api/v1/spots' + buildQueryString(), function(jsonData) { + $.getJSON('/api/v1/spots' + buildQueryString(true), function(jsonData) { // Store data spots = jsonData; // Update map @@ -40,7 +40,7 @@ function loadSpots() { } // Build a query string for the API, based on the filters that the user has selected. -function buildQueryString() { +function buildQueryString(includeCredentials) { var str = "?"; ["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => { if (!allFilterOptionsSelected(fn)) { @@ -50,7 +50,9 @@ function buildQueryString() { str = str + "max_age=" + $("#max-spot-age option:selected").val(); // Additional filters for the map view: No dupes, no QRT, only spots with good locations str = str + "&dedupe=true&allow_qrt=false"; - str = str + getCredentialQueryString(); + if (includeCredentials) { + str = str + getCredentialQueryString(); + } return str; } diff --git a/webassets/js/spots.js b/webassets/js/spots.js index ee84f46..104ce87 100644 --- a/webassets/js/spots.js +++ b/webassets/js/spots.js @@ -12,7 +12,7 @@ function loadSpots() { } // Make the new query - $.getJSON('/api/v1/spots' + buildQueryString(), function(jsonData) { + $.getJSON('/api/v1/spots' + buildQueryString(false), function(jsonData) { // Store data spots = jsonData; // Update table @@ -31,7 +31,7 @@ function startSSEConnection() { if (evtSource != null) { evtSource.close(); } - evtSource = new EventSource('/api/v1/spots/stream' + buildQueryString()); + evtSource = new EventSource('/api/v1/spots/stream' + buildQueryString(true)); evtSource.onmessage = function(event) { // Get the new spot @@ -78,7 +78,7 @@ function startSSEConnection() { } // Build a query string for the API, based on the filters that the user has selected. -function buildQueryString() { +function buildQueryString(includeCredentials) { var str = "?"; ["dx_continent", "de_continent", "mode", "source", "band", "sig"].forEach(fn => { if (!allFilterOptionsSelected(fn)) { @@ -89,7 +89,9 @@ function buildQueryString() { if ($("#search").val() != "") { str = str + "&text_includes=" + encodeURIComponent($("#search").val()); } - str = str + getCredentialQueryString(); + if (includeCredentials) { + str = str + getCredentialQueryString(); + } return str; }