fix annoying 500 errors

master
Aevann1 2022-11-20 18:46:15 +02:00
parent 71807f7a27
commit f62a9769fd
2 changed files with 3 additions and 3 deletions

View File

@ -32,9 +32,6 @@ def before_request():
if not request.path: request.path = '/'
request.full_path = request.full_path.rstrip('?').rstrip('/')
if not request.full_path: request.full_path = '/'
if not session.get("session_id"):
session.permanent = True
session["session_id"] = secrets.token_hex(49)
@app.after_request
def after_request(response):

View File

@ -21,6 +21,9 @@ def calc_users(v):
else:
ua = str(user_agents.parse(g.agent))
if 'spider' not in ua.lower() and 'bot' not in ua.lower():
if not session.get("session_id"):
session.permanent = True
session["session_id"] = secrets.token_hex(49)
loggedout[session["session_id"]] = (timestamp, ua)
loggedin = {k: v for k, v in loggedin.items() if (timestamp - v) < LOGGEDIN_ACTIVE_TIME}