mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Instantiate but disable providers. Closes #16
This commit is contained in:
@@ -30,7 +30,6 @@ class WebServer:
|
||||
bottle.get("/api/options")(self.serve_api_options)
|
||||
bottle.get("/api/status")(self.serve_api_status)
|
||||
bottle.get("/")(self.serve_index)
|
||||
bottle.get("/apidocs")(self.serve_apidocs)
|
||||
bottle.get("/<filepath:path>")(self.serve_static_file)
|
||||
|
||||
# Start the web server
|
||||
@@ -69,20 +68,21 @@ class WebServer:
|
||||
|
||||
# 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):
|
||||
self.last_page_access_time = datetime.now(pytz.UTC)
|
||||
self.status = "OK"
|
||||
return bottle.static_file("index.html", root="webassets")
|
||||
return self.serve_static_file("")
|
||||
|
||||
# Serve the API docs page. This would be accessible as /apidocs/index.html but we need this workaround to make it
|
||||
# available as /apidocs
|
||||
def serve_apidocs(self):
|
||||
self.last_page_access_time = datetime.now(pytz.UTC)
|
||||
self.status = "OK"
|
||||
return bottle.static_file("index.html", root="webassets/apidocs")
|
||||
|
||||
# Serve general static files from "webassets" directory
|
||||
# Serve general static files from "webassets" directory, along with some extra workarounds to make URLs such as
|
||||
# "/", "/about" and "/apidocs" work.
|
||||
def serve_static_file(self, filepath):
|
||||
return bottle.static_file(filepath, root="webassets")
|
||||
self.last_page_access_time = datetime.now(pytz.UTC)
|
||||
self.status = "OK"
|
||||
if filepath == "":
|
||||
return bottle.static_file("index.html", root="webassets")
|
||||
elif filepath == "about":
|
||||
return bottle.static_file("about.html", root="webassets")
|
||||
elif filepath == "apidocs":
|
||||
return bottle.static_file("index.html", root="webassets/apidocs")
|
||||
else:
|
||||
return bottle.static_file(filepath, root="webassets")
|
||||
|
||||
# Utility method to apply filters to the overall spot list and return only a subset. Enables query parameters in
|
||||
# the main "spots" GET call. The "query" parameter should be the result of bottle's request.query, and is a MultiDict
|
||||
|
||||
Reference in New Issue
Block a user