From 8e48287edf2a803e0b41281010574d607fe4122a Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Sun, 16 Aug 2026 14:02:22 +0100 Subject: [PATCH] Bug fixes --- core/sig_lookup_helper.py | 2 +- data/spot.py | 12 ++++++------ server/handlers/api/v1_compatability.py | 2 +- server/webserver.py | 10 +++++++++- templates/add_spot.html | 2 +- templates/alerts.html | 2 +- templates/bands.html | 4 ++-- templates/base.html | 10 +++++----- templates/conditions.html | 2 +- templates/map.html | 4 ++-- templates/spots.html | 4 ++-- templates/status.html | 2 +- 12 files changed, 32 insertions(+), 24 deletions(-) diff --git a/core/sig_lookup_helper.py b/core/sig_lookup_helper.py index 5c2c2fe..e6b11cf 100644 --- a/core/sig_lookup_helper.py +++ b/core/sig_lookup_helper.py @@ -45,7 +45,7 @@ def get_sig_ref_info(sig, ref_id): sig_ref.name = sig_ref.id if not sig_ref.grid: sig_ref.grid = sig_ref.id - if sig_ref.grid and not sig_ref.latitude: + if sig_ref.grid and (not sig_ref.latitude or not sig_ref.longitude): ll = locator_to_latlong(str(sig_ref.grid)) sig_ref.latitude = ll[0] sig_ref.longitude = ll[1] diff --git a/data/spot.py b/data/spot.py index dbcadde..62e1bba 100644 --- a/data/spot.py +++ b/data/spot.py @@ -307,7 +307,7 @@ class Spot: # If the spot itself doesn't have location yet, but the SIG ref does, extract it if sig_ref.grid and not self.dx_grid: self.dx_grid = sig_ref.grid - if sig_ref.latitude and not self.dx_latitude: + if sig_ref.latitude and not self.dx_latitude and sig_ref.longitude and not self.dx_longitude: self.dx_latitude = sig_ref.latitude self.dx_longitude = sig_ref.longitude if self.sig == "WAB" or self.sig == "WAI" or self.sig == "Tiles": @@ -360,7 +360,7 @@ class Spot: self.de_grid = grid_mode_grid_match.group(2).upper() # DX Grid to lat/lon and vice versa in case one is missing - if self.dx_grid and not self.dx_latitude: + if self.dx_grid and (not self.dx_latitude or not self.dx_longitude): try: ll = locator_to_latlong(self.dx_grid) self.dx_latitude = ll[0] @@ -393,7 +393,7 @@ class Spot: # instead of the one from the park reference they're at. if self.dx_call and not self.dx_name: self.dx_name = dx_call_info.name - if self.dx_call and not self.dx_latitude: + if self.dx_call and (not self.dx_latitude or not self.dx_longitude): self.dx_latitude = dx_call_info.latitude self.dx_longitude = dx_call_info.longitude self.dx_grid = dx_call_info.grid @@ -411,12 +411,12 @@ class Spot: # CQ and ITU zone lookup, preferably from location but failing that, from callsign if not self.dx_cq_zone: - if self.dx_latitude: + if self.dx_latitude and self.dx_longitude: self.dx_cq_zone = lat_lon_to_cq_zone(self.dx_latitude, self.dx_longitude) elif self.dx_call: self.dx_cq_zone = dx_call_info.cq_zone if not self.dx_itu_zone: - if self.dx_latitude: + if self.dx_latitude and self.dx_longitude: self.dx_itu_zone = lat_lon_to_itu_zone(self.dx_latitude, self.dx_longitude) elif self.dx_call: self.dx_itu_zone = dx_call_info.itu_zone @@ -439,7 +439,7 @@ class Spot: self.de_call and any(char.isdigit() for char in str(self.de_call)) and not (self.de_call.startswith("T2") and self.source == "APRS-IS") - and not self.de_latitude + and (not self.de_latitude or not self.de_longitude) ): # DE operator location lookup self.de_latitude = de_call_info.latitude diff --git a/server/handlers/api/v1_compatability.py b/server/handlers/api/v1_compatability.py index 514f61a..deb76b5 100644 --- a/server/handlers/api/v1_compatability.py +++ b/server/handlers/api/v1_compatability.py @@ -1,6 +1,7 @@ import tornado from tornado.httpclient import AsyncHTTPClient from tornado.httputil import HTTPHeaders +from tornado.iostream import StreamClosedError class V1RedirectHandler(tornado.web.RequestHandler): @@ -43,7 +44,6 @@ class V1RedirectHandler(tornado.web.RequestHandler): self.add_header(name, value) if response.body: self.write(response.body) - await self.finish() async def get(self, path): await self._proxy(path) diff --git a/server/webserver.py b/server/webserver.py index 28c454f..59c296c 100644 --- a/server/webserver.py +++ b/server/webserver.py @@ -155,7 +155,15 @@ class WebServer: V1APISpotsStreamHandler, {"sse_spot_broadcaster": self._spot_broadcaster, **handler_opts}, ), - (r"/api/v1/spot", V1APISpotHandler), + ( + r"/api/v1/spot", + V1APISpotHandler, + { + "spots": self._data_store.spots, + "spot_providers": self._data_providers, + **handler_opts, + }, + ), (r"/api/v1/(.*)", V1RedirectHandler), ] diff --git a/templates/add_spot.html b/templates/add_spot.html index e30ecb2..b163984 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -76,7 +76,7 @@ - + diff --git a/templates/alerts.html b/templates/alerts.html index 5ac6a0a..eb36de5 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -84,7 +84,7 @@ - + diff --git a/templates/bands.html b/templates/bands.html index 6497044..b553c00 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -76,8 +76,8 @@ - - + + diff --git a/templates/base.html b/templates/base.html index 4b8b140..9000c25 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,6 +1,6 @@ {% extends "skeleton.html" %} {% block head_extra %} - + @@ -15,10 +15,10 @@ window.fetchEventSource = fetchEventSource; - - - - + + + + {% end %} {% block body %}
diff --git a/templates/conditions.html b/templates/conditions.html index 0646d4b..e6d9e59 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -284,7 +284,7 @@
- + diff --git a/templates/map.html b/templates/map.html index 1eaf289..4723190 100644 --- a/templates/map.html +++ b/templates/map.html @@ -109,8 +109,8 @@ - - + + diff --git a/templates/spots.html b/templates/spots.html index 5997d55..6d23d6d 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -113,8 +113,8 @@ - - + + diff --git a/templates/status.html b/templates/status.html index ad3d870..406ebc1 100644 --- a/templates/status.html +++ b/templates/status.html @@ -86,7 +86,7 @@ - +