Start of web interface

This commit is contained in:
Ian Renton
2025-09-27 16:03:48 +01:00
parent cf1798663d
commit 78871902ad
6 changed files with 59 additions and 12 deletions

View File

@@ -20,6 +20,8 @@ class WebServer:
# Set up routing
bottle.get("/api/spots")(self.serve_api_spots)
bottle.get("/")(self.serve_index)
bottle.get("/<filepath:path>")(self.serve_static_file)
# Start the web server
def start(self):
@@ -36,8 +38,16 @@ class WebServer:
response.content_type = 'application/json'
return spots_json
# Serve the home page. This would be accessible as /index.html but we need this workaround to make it available as /
def serve_index(self):
return bottle.static_file("index.html", root="webassets")
# Todo spot API arguments e.g. "since" based on received_time of spots, sources, sigs, dx cont, dxcc, de cont, band, mode, filter out qrt, filter pre-qsy
# Serve general static files from "webassets" directory
def serve_static_file(self, filepath):
return bottle.static_file(filepath, root="webassets")
# Todo spot API arguments e.g. "since" based on received_time of spots, sources, sigs, dx cont, dxcc, de cont, band, mode, filter out qrt, filter pre-qsy, sort order, list of fields
# Todo serve status API
# Todo serve apidocs
# Todo serve website