First attempt at converting "sig" to "activity" for v3

This commit is contained in:
Ian Renton
2026-09-24 07:09:37 +01:00
parent 1d0129f7bb
commit d91fa70655
90 changed files with 822 additions and 496 deletions
+76 -11
View File
@@ -30,6 +30,16 @@ from webserver.handlers.api.status import APIStatusHandler
from webserver.handlers.api.v1_addspot import V1APISpotHandler
from webserver.handlers.api.v1_compatability import V1RedirectHandler
from webserver.handlers.api.v1_spots import V1APISpotsHandler, V1APISpotsStreamHandler
from webserver.handlers.api.v2_compatibility import (
V2APIAlertsHandler,
V2APIAlertsStreamHandler,
V2APILookupSigRefHandler,
V2APIOptionsHandler,
V2APISpotHandler,
V2APISpotsHandler,
V2APISpotsStreamHandler,
V2APIStatusHandler,
)
from webserver.handlers.manifesthandler import ManifestHandler
from webserver.handlers.metrics import PrometheusMetricsHandler
from webserver.handlers.pagetemplate import PageTemplateHandler
@@ -107,25 +117,80 @@ class WebServer:
# API endpoints are always enabled
api_routes = [
(
r"/api/v2/spots",
r"/api/v3/spots",
APISpotsHandler,
{"spots": self._data_store.spots},
),
(
r"/api/v2/alerts",
r"/api/v3/alerts",
APIAlertsHandler,
{"alerts": self._data_store.alerts},
),
(
r"/api/v2/spots/stream",
r"/api/v3/spots/stream",
APISpotsStreamHandler,
{"sse_spot_broadcaster": self._spot_broadcaster},
),
(
r"/api/v2/alerts/stream",
r"/api/v3/alerts/stream",
APIAlertsStreamHandler,
{"sse_alert_broadcaster": self._alert_broadcaster},
),
(
r"/api/v3/solar",
APISolarConditionsHandler,
{"solar_conditions": self._data_store.solar_conditions.get()},
),
(
r"/api/v3/dxstats",
APIDxStatsHandler,
{"spots": self._data_store.spots},
),
(
r"/api/v3/options",
APIOptionsHandler,
{"status_data": self._data_store.status.get()},
),
(
r"/api/v3/status",
APIStatusHandler,
{"status_data": self._data_store.status.get()},
),
(r"/api/v3/lookup/call", APILookupCallHandler),
(r"/api/v3/lookup/activityref", APILookupActivityRefHandler),
(r"/api/v3/lookup/grid", APILookupGridHandler),
(
r"/api/v3/spot",
APISpotHandler,
{
"spots": self._data_store.spots,
"spot_providers": self._data_providers,
},
),
]
# v2 API compatibility routes
v2_compat_routes = [
(
r"/api/v2/spots",
V2APISpotsHandler,
{"spots": self._data_store.spots},
),
(
r"/api/v2/alerts",
V2APIAlertsHandler,
{"alerts": self._data_store.alerts},
),
(
r"/api/v2/spots/stream",
V2APISpotsStreamHandler,
{"sse_spot_broadcaster": self._spot_broadcaster},
),
(
r"/api/v2/alerts/stream",
V2APIAlertsStreamHandler,
{"sse_alert_broadcaster": self._alert_broadcaster},
),
(
r"/api/v2/solar",
APISolarConditionsHandler,
@@ -138,20 +203,20 @@ class WebServer:
),
(
r"/api/v2/options",
APIOptionsHandler,
V2APIOptionsHandler,
{"status_data": self._data_store.status.get()},
),
(
r"/api/v2/status",
APIStatusHandler,
V2APIStatusHandler,
{"status_data": self._data_store.status.get()},
),
(r"/api/v2/lookup/call", APILookupCallHandler),
(r"/api/v2/lookup/sigref", APILookupActivityRefHandler),
(r"/api/v2/lookup/sigref", V2APILookupSigRefHandler),
(r"/api/v2/lookup/grid", APILookupGridHandler),
(
r"/api/v2/spot",
APISpotHandler,
V2APISpotHandler,
{
"spots": self._data_store.spots,
"spot_providers": self._data_providers,
@@ -159,8 +224,8 @@ class WebServer:
),
]
# v1 API redirects. Most v1 enpoints are unchanged in v2, and get an HTTP 308 redirect to the v2 API. The ones
# that have the major breaking changes get a bespoke handler.
# v1 API redirects. Most v1 enpoints are unchanged in v2, and are proxied to the v2 API (which in turn is
# translated from v3). The ones that have the major breaking changes get a bespoke handler.
v1_compat_routes = [
(
r"/api/v1/spots",
@@ -253,7 +318,7 @@ class WebServer:
]
app = tornado.web.Application(
api_routes + v1_compat_routes + ui_routes + misc_routes,
api_routes + v2_compat_routes + v1_compat_routes + ui_routes + misc_routes,
template_path=os.path.join(_HERE, "../templates"),
log_function=request_log,
debug=False,