From de5e5d543b656d1ed7d86b37694dd2654bac2149 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 24 Jan 2022 23:44:31 +0200 Subject: [PATCH] vc --- files/__main__.py | 6 +++++- files/routes/front.py | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/files/__main__.py b/files/__main__.py index 0d0bc4d28..a36cbcd06 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -85,6 +85,10 @@ mail = Mail(app) @app.before_request def before_request(): + if not session.get("session_id") and not request.path.startswith("/assets") and not request.path.startswith("/images") and not request.path.startswith("/hostedimages") and not request.path.startswith("/static") and not request.path.startswith("/song"): + session.permanent = True + session["session_id"] = secrets.token_hex(49) + if request.method.lower() != "get" and app.config["READ_ONLY"]: return {"error":f"{app.config['SITE_NAME']} is currently in read-only mode."}, 500 @@ -101,7 +105,7 @@ def before_request(): if 'iphone' in ua or 'ipad' in ua or 'ipod' in ua or 'mac os' in ua or ' firefox/' in ua: g.seal = True else: g.seal = False - + @app.teardown_appcontext def teardown_request(error): diff --git a/files/routes/front.py b/files/routes/front.py index 2b465247e..0ea87cd3c 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -135,10 +135,6 @@ def notifications(v): @auth_desired def front_all(v): - if not session.get("session_id"): - session.permanent = True - session["session_id"] = secrets.token_hex(49) - if not v and request.path == "/" and not request.headers.get("Authorization"): return redirect(f"{SITE_FULL}/logged_out{request.full_path}")