From 60d1eb4a1a53e58a266a49b6300e12dc9d81591b Mon Sep 17 00:00:00 2001 From: lare Date: Tue, 27 Dec 2022 19:01:07 +0100 Subject: [PATCH] [hotfix][web] add config["base-dir"] to work in subdirs --- web/backend/main.py | 5 +++-- web/frontend/base.html | 2 +- web/frontend/login.html | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/web/backend/main.py b/web/backend/main.py index 8929759..48b5af1 100644 --- a/web/backend/main.py +++ b/web/backend/main.py @@ -205,7 +205,8 @@ def auth_required(): @wraps(f) def decorated(*args, **kwargs): if not "login" in session: - return redirect(f"{config['base-dir']}login?return={request.url}") + request_url = f"{config['base-dir']}{request.url}".replace("//", "/") + return redirect(f"{config['base-dir']}login?return={request_url}") else: return f(*args, **kwargs) return decorated @@ -243,7 +244,7 @@ def kioubit_auth(): @app.route("/logout") def logout(): session.clear() - return redirect("/") + return redirect(config["base-dir"]) @app.route("/login", methods=["GET", "POST"]) diff --git a/web/frontend/base.html b/web/frontend/base.html index 31242a2..b4cd368 100644 --- a/web/frontend/base.html +++ b/web/frontend/base.html @@ -17,7 +17,7 @@ logout {% else %} - login{%endif%} + login{%endif%}
{% block content %} {% endblock %}