enable web config

This commit is contained in:
Jakob Ketterl 2021-02-11 19:37:45 +01:00
parent f23fa59ac3
commit a8c93fd8d1
4 changed files with 2 additions and 17 deletions

View File

@ -375,8 +375,3 @@ pskreporter_callsign = "N0CALL"
# in addition to these settings also make sure that receiver_gps contains your correct location # in addition to these settings also make sure that receiver_gps contains your correct location
wsprnet_enabled = False wsprnet_enabled = False
wsprnet_callsign = "N0CALL" wsprnet_callsign = "N0CALL"
# === Web admin settings ===
# this feature is experimental at the moment. it should not be enabled on shared receivers since it allows remote
# changes to the receiver settings. enable for testing in controlled environment only.
# webadmin_enabled = False

View File

@ -11,7 +11,7 @@
<div class="button" data-toggle-panel="openwebrx-panel-log"><span class="sprite sprite-panel-log"></span><br/>Log</div> <div class="button" data-toggle-panel="openwebrx-panel-log"><span class="sprite sprite-panel-log"></span><br/>Log</div>
<div class="button" data-toggle-panel="openwebrx-panel-receiver"><span class="sprite sprite-panel-receiver"></span><br/>Receiver</div> <div class="button" data-toggle-panel="openwebrx-panel-receiver"><span class="sprite sprite-panel-receiver"></span><br/>Receiver</div>
<a class="button" href="map" target="openwebrx-map"><span class="sprite sprite-panel-map"></span><br/>Map</a> <a class="button" href="map" target="openwebrx-map"><span class="sprite sprite-panel-map"></span><br/>Map</a>
${settingslink} <a class="button" href="settings" target="openwebrx-settings"><span class="sprite sprite-panel-settings"></span><br/>Settings</a>
</section> </section>
</div> </div>
<div class="openwebrx-description-container"> <div class="openwebrx-description-container">

View File

@ -1,5 +1,4 @@
from .session import SessionStorage from .session import SessionStorage
from owrx.config import Config
from owrx.users import UserList from owrx.users import UserList
from urllib import parse from urllib import parse
@ -34,10 +33,6 @@ class AuthorizationMixin(object):
return self.user is not None and self.user.is_enabled() and not self.user.must_change_password return self.user is not None and self.user.is_enabled() and not self.user.must_change_password
def handle_request(self): def handle_request(self):
config = Config.get()
if "webadmin_enabled" not in config or not config["webadmin_enabled"]:
self.send_response("Web Admin is disabled", code=403)
return
if self.isAuthorized(): if self.isAuthorized():
super().handle_request() super().handle_request()
else: else:

View File

@ -1,7 +1,6 @@
from . import Controller from . import Controller
import pkg_resources import pkg_resources
from string import Template from string import Template
from owrx.config import Config
class TemplateController(Controller): class TemplateController(Controller):
@ -20,11 +19,7 @@ class TemplateController(Controller):
class WebpageController(TemplateController): class WebpageController(TemplateController):
def template_variables(self): def template_variables(self):
settingslink = "" header = self.render_template("include/header.include.html")
pm = Config.get()
if "webadmin_enabled" in pm and pm["webadmin_enabled"]:
settingslink = """<a class="button" href="settings" target="openwebrx-settings"><span class="sprite sprite-panel-settings"></span><br/>Settings</a>"""
header = self.render_template("include/header.include.html", settingslink=settingslink)
return {"header": header} return {"header": header}