Session timeout feature works now.

This commit is contained in:
Marat Fayzullin 2023-01-04 22:52:41 -05:00
parent d5e64e2dc0
commit d6e25e08b6
6 changed files with 32 additions and 4 deletions

View File

@ -19,7 +19,7 @@
var path = window.location.pathname; var path = window.location.pathname;
var page = path.split("/").pop(); var page = path.split("/").pop();
document.getElementById("pstt").innerHTML = document.getElementById("pstt").innerHTML =
(page==="") && (${session_timeout}>0)? ((page==="") && (${session_timeout}>0))?
"<meta http-equiv=\"refresh\" content=\"${session_timeout}; url=${usage_policy_url}\">" : ""; "<meta http-equiv=\"refresh\" content=\"${session_timeout}; url=${usage_policy_url}\">" : "";
</script> </script>
</section> </section>

19
htdocs/policy.html Normal file
View File

@ -0,0 +1,19 @@
<!DOCTYPE HTML>
<html>
<head>
<title>OpenWebRX+ Usage Policy</title>
<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico" />
<link rel="stylesheet" href="static/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="static/css/admin.css" />
<meta charset="utf-8">
</head>
<body style="background-color:#000000;">
${header}
<div style="margin: 20% 20% 20% 20%;">
<h1 style="color:#ff0000;">OpenWebRX+ Usage Policy</h1>
<h2 style="text-align:justify;">
Please, do not leave the receiver unattended for prolonged time. The receiver
will stop after a while to allow other users to connect.
</h2>
</div>
</body>

View File

@ -1,7 +1,7 @@
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
<head> <head>
<title>OpenWebRX Settings</title> <title>OpenWebRX+ Settings</title>
<link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico" /> <link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico" />
<link rel="stylesheet" href="static/css/bootstrap.min.css" /> <link rel="stylesheet" href="static/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="static/css/admin.css" /> <link rel="stylesheet" type="text/css" href="static/css/admin.css" />
@ -38,4 +38,4 @@ ${header}
</div> </div>
</div> </div>
</div> </div>
</body> </body>

View File

@ -160,6 +160,8 @@ defaultConfig = PropertyLayer(
google_maps_api_key="", google_maps_api_key="",
map_position_retention_time=2 * 60 * 60, map_position_retention_time=2 * 60 * 60,
callsign_url="https://www.qrzcq.com/call/{}", callsign_url="https://www.qrzcq.com/call/{}",
usage_policy_url="policy",
session_timeout=0,
decoding_queue_workers=2, decoding_queue_workers=2,
decoding_queue_length=10, decoding_queue_length=10,
wsjt_decoding_depth=3, wsjt_decoding_depth=3,

View File

@ -43,3 +43,9 @@ class MapController(WebpageController):
def indexAction(self): def indexAction(self):
# TODO check if we have a google maps api key first? # TODO check if we have a google maps api key first?
self.serve_template("map.html", **self.template_variables()) self.serve_template("map.html", **self.template_variables())
class PolicyController(WebpageController):
def indexAction(self):
self.serve_template("policy.html", **self.template_variables())

View File

@ -1,5 +1,5 @@
from owrx.controllers.status import StatusController 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.feature import FeatureController
from owrx.controllers.assets import OwrxAssetsController, AprsSymbolsController, CompiledAssetsController from owrx.controllers.assets import OwrxAssetsController, AprsSymbolsController, CompiledAssetsController
from owrx.controllers.websocket import WebSocketController from owrx.controllers.websocket import WebSocketController
@ -94,6 +94,7 @@ class Router(object):
StaticRoute("/ws/", WebSocketController), StaticRoute("/ws/", WebSocketController),
RegexRoute("^(/favicon.ico)$", OwrxAssetsController), RegexRoute("^(/favicon.ico)$", OwrxAssetsController),
StaticRoute("/map", MapController), StaticRoute("/map", MapController),
StaticRoute("/policy", PolicyController),
StaticRoute("/features", FeatureController), StaticRoute("/features", FeatureController),
StaticRoute("/api/features", ApiController), StaticRoute("/api/features", ApiController),
StaticRoute("/metrics", MetricsController, options={"action": "prometheusAction"}), StaticRoute("/metrics", MetricsController, options={"action": "prometheusAction"}),