Backwards compatibility for critical v1 APIs. Closes #119

This commit is contained in:
Ian Renton
2026-08-08 14:15:29 +01:00
parent 43763bf76f
commit 4be4e4550a
5 changed files with 177 additions and 6 deletions
+7 -2
View File
@@ -16,7 +16,9 @@ from server.handlers.api.options import APIOptionsHandler
from server.handlers.api.solar_conditions import APISolarConditionsHandler
from server.handlers.api.spots import APISpotsHandler, APISpotsStreamHandler
from server.handlers.api.status import APIStatusHandler
from server.handlers.api.v1_compatability import V1RedirectHandler, V1GoneHandler
from server.handlers.api.v1_addspot import V1APISpotHandler
from server.handlers.api.v1_compatability import V1RedirectHandler
from server.handlers.api.v1_spots import V1APISpotsHandler, V1APISpotsStreamHandler
from server.handlers.manifesthandler import ManifestHandler
from server.handlers.metrics import PrometheusMetricsHandler
from server.handlers.pagetemplate import PageTemplateHandler
@@ -95,7 +97,10 @@ 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_compat_routes = [
(r"/api/v1/spot", V1GoneHandler),
(r"/api/v1/spots", V1APISpotsHandler, {"spots": self._data_store.spots, **handler_opts}),
(r"/api/v1/spots/stream", V1APISpotsStreamHandler,
{"sse_spot_broadcaster": self._spot_broadcaster, **handler_opts}),
(r"/api/v1/spot", V1APISpotHandler),
(r"/api/v1/(.*)", V1RedirectHandler),
]