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 %}