diff --git a/htdocs/include/header.include.html b/htdocs/include/header.include.html index 44e53a2..6e7beff 100644 --- a/htdocs/include/header.include.html +++ b/htdocs/include/header.include.html @@ -1,7 +1,7 @@
- - Receiver avatar + + Receiver avatar
@@ -10,8 +10,8 @@

Status

Log

Receiver
-
Map
-
Settings
+
Map
+
Settings
diff --git a/htdocs/lib/Header.js b/htdocs/lib/Header.js index b9ff471..ea64457 100644 --- a/htdocs/lib/Header.js +++ b/htdocs/lib/Header.js @@ -58,7 +58,8 @@ Header.prototype.toggle_rx_photo = function(ev) { Header.prototype.download_details = function() { var self = this; - $.ajax('api/receiverdetails').done(function(data){ + // TODO: make this use a relative URL again + $.ajax('/api/receiverdetails').done(function(data){ self.setDetails(data); }); }; diff --git a/htdocs/sdrsettings.html b/htdocs/sdrsettings.html deleted file mode 100644 index 74aa8b7..0000000 --- a/htdocs/sdrsettings.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - OpenWebRX Settings - - - - - - - -${header} -
-
-

SDR device settings

-
-
- ${devices} -
-
- \ No newline at end of file diff --git a/htdocs/settings.html b/htdocs/settings.html index 80dce91..ef2f564 100644 --- a/htdocs/settings.html +++ b/htdocs/settings.html @@ -15,10 +15,10 @@ ${header}

Settings

Feature report diff --git a/htdocs/generalsettings.html b/htdocs/settings/general.html similarity index 53% rename from htdocs/generalsettings.html rename to htdocs/settings/general.html index 4731a02..8b628b6 100644 --- a/htdocs/generalsettings.html +++ b/htdocs/settings/general.html @@ -2,11 +2,11 @@ OpenWebRX Settings - - - + + + - + diff --git a/htdocs/settings/sdr.html b/htdocs/settings/sdr.html new file mode 100644 index 0000000..f85dfde --- /dev/null +++ b/htdocs/settings/sdr.html @@ -0,0 +1,21 @@ + + + + OpenWebRX Settings + + + + + + + +${header} +
+
+

SDR device settings

+
+
+ ${devices} +
+
+ \ No newline at end of file diff --git a/owrx/controllers/settings.py b/owrx/controllers/settings.py index fb5795d..dd1281b 100644 --- a/owrx/controllers/settings.py +++ b/owrx/controllers/settings.py @@ -64,6 +64,11 @@ class SettingsController(AuthorizationMixin, WebpageController): class SdrSettingsController(AuthorizationMixin, WebpageController): + def header_variables(self): + variables = super().header_variables() + variables["assets_prefix"] = "../" + return variables + def template_variables(self): variables = super().template_variables() variables["devices"] = self.render_devices() @@ -94,7 +99,7 @@ class SdrSettingsController(AuthorizationMixin, WebpageController): ) def indexAction(self): - self.serve_template("sdrsettings.html", **self.template_variables()) + self.serve_template("settings/sdr.html", **self.template_variables()) class GeneralSettingsController(AuthorizationMixin, WebpageController): @@ -372,7 +377,12 @@ class GeneralSettingsController(AuthorizationMixin, WebpageController): ) def indexAction(self): - self.serve_template("generalsettings.html", **self.template_variables()) + self.serve_template("settings/general.html", **self.template_variables()) + + def header_variables(self): + variables = super().header_variables() + variables["assets_prefix"] = "../" + return variables def template_variables(self): variables = super().template_variables() @@ -417,4 +427,4 @@ class GeneralSettingsController(AuthorizationMixin, WebpageController): else: config[k] = v config.store() - self.send_redirect("/generalsettings") + self.send_redirect("/settings/general") diff --git a/owrx/controllers/template.py b/owrx/controllers/template.py index 6746012..2213b83 100644 --- a/owrx/controllers/template.py +++ b/owrx/controllers/template.py @@ -18,8 +18,11 @@ class TemplateController(Controller): class WebpageController(TemplateController): + def header_variables(self): + return {"assets_prefix": ""} + def template_variables(self): - header = self.render_template("include/header.include.html") + header = self.render_template("include/header.include.html", **self.header_variables()) return {"header": header} diff --git a/owrx/form/gfx.py b/owrx/form/gfx.py index 05a01f3..99a2ca6 100644 --- a/owrx/form/gfx.py +++ b/owrx/form/gfx.py @@ -36,7 +36,7 @@ class ImageInput(Input, metaclass=ABCMeta): class AvatarInput(ImageInput): def getUrl(self) -> str: - return "static/gfx/openwebrx-avatar.png" + return "../static/gfx/openwebrx-avatar.png" def getImgClasses(self) -> list: return ["webrx-rx-avatar"] @@ -44,7 +44,7 @@ class AvatarInput(ImageInput): class TopPhotoInput(ImageInput): def getUrl(self) -> str: - return "static/gfx/openwebrx-top-photo.jpg" + return "../static/gfx/openwebrx-top-photo.jpg" def getImgClasses(self) -> list: return ["webrx-top-photo"] diff --git a/owrx/http.py b/owrx/http.py index ec791d8..d816a37 100644 --- a/owrx/http.py +++ b/owrx/http.py @@ -103,11 +103,11 @@ class Router(object): StaticRoute("/metrics", MetricsController, options={"action": "prometheusAction"}), StaticRoute("/metrics.json", MetricsController), StaticRoute("/settings", SettingsController), - StaticRoute("/generalsettings", GeneralSettingsController), + StaticRoute("/settings/general", GeneralSettingsController), StaticRoute( - "/generalsettings", GeneralSettingsController, method="POST", options={"action": "processFormData"} + "/settings/general", GeneralSettingsController, method="POST", options={"action": "processFormData"} ), - StaticRoute("/sdrsettings", SdrSettingsController), + StaticRoute("/settings/sdr", SdrSettingsController), StaticRoute("/login", SessionController, options={"action": "loginAction"}), StaticRoute("/login", SessionController, method="POST", options={"action": "processLoginAction"}), StaticRoute("/logout", SessionController, options={"action": "logoutAction"}),