From d6e25e08b6e7d876f8092debc682d2ee1dde49cf Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Wed, 4 Jan 2023 22:52:41 -0500 Subject: [PATCH] Session timeout feature works now. --- htdocs/include/header.include.html | 2 +- htdocs/policy.html | 19 +++++++++++++++++++ htdocs/settings.html | 4 ++-- owrx/config/defaults.py | 2 ++ owrx/controllers/template.py | 6 ++++++ owrx/http.py | 3 ++- 6 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 htdocs/policy.html diff --git a/htdocs/include/header.include.html b/htdocs/include/header.include.html index bbd6490..ea9de17 100644 --- a/htdocs/include/header.include.html +++ b/htdocs/include/header.include.html @@ -19,7 +19,7 @@ var path = window.location.pathname; var page = path.split("/").pop(); document.getElementById("pstt").innerHTML = - (page==="") && (${session_timeout}>0)? + ((page==="") && (${session_timeout}>0))? "" : ""; diff --git a/htdocs/policy.html b/htdocs/policy.html new file mode 100644 index 0000000..4f526f0 --- /dev/null +++ b/htdocs/policy.html @@ -0,0 +1,19 @@ + + + + OpenWebRX+ Usage Policy + + + + + + +${header} +
+

OpenWebRX+ Usage Policy

+

+Please, do not leave the receiver unattended for prolonged time. The receiver +will stop after a while to allow other users to connect. +

+
+ diff --git a/htdocs/settings.html b/htdocs/settings.html index 1bdaff4..34e609b 100644 --- a/htdocs/settings.html +++ b/htdocs/settings.html @@ -1,7 +1,7 @@ - OpenWebRX Settings + OpenWebRX+ Settings @@ -38,4 +38,4 @@ ${header} - \ No newline at end of file + diff --git a/owrx/config/defaults.py b/owrx/config/defaults.py index cd7f5d6..e028e4d 100644 --- a/owrx/config/defaults.py +++ b/owrx/config/defaults.py @@ -160,6 +160,8 @@ defaultConfig = PropertyLayer( google_maps_api_key="", map_position_retention_time=2 * 60 * 60, callsign_url="https://www.qrzcq.com/call/{}", + usage_policy_url="policy", + session_timeout=0, decoding_queue_workers=2, decoding_queue_length=10, wsjt_decoding_depth=3, diff --git a/owrx/controllers/template.py b/owrx/controllers/template.py index f7e1a53..4fbc82e 100644 --- a/owrx/controllers/template.py +++ b/owrx/controllers/template.py @@ -43,3 +43,9 @@ class MapController(WebpageController): def indexAction(self): # TODO check if we have a google maps api key first? self.serve_template("map.html", **self.template_variables()) + + +class PolicyController(WebpageController): + def indexAction(self): + self.serve_template("policy.html", **self.template_variables()) + diff --git a/owrx/http.py b/owrx/http.py index 050e5ef..347bacf 100644 --- a/owrx/http.py +++ b/owrx/http.py @@ -1,5 +1,5 @@ from owrx.controllers.status import StatusController -from owrx.controllers.template import IndexController, MapController +from owrx.controllers.template import IndexController, MapController, PolicyController from owrx.controllers.feature import FeatureController from owrx.controllers.assets import OwrxAssetsController, AprsSymbolsController, CompiledAssetsController from owrx.controllers.websocket import WebSocketController @@ -94,6 +94,7 @@ class Router(object): StaticRoute("/ws/", WebSocketController), RegexRoute("^(/favicon.ico)$", OwrxAssetsController), StaticRoute("/map", MapController), + StaticRoute("/policy", PolicyController), StaticRoute("/features", FeatureController), StaticRoute("/api/features", ApiController), StaticRoute("/metrics", MetricsController, options={"action": "prometheusAction"}),