From f033c9da62ddb3ccbc549ea9e26845a3d5a8e215 Mon Sep 17 00:00:00 2001 From: csd4ni3l Date: Tue, 12 Aug 2025 18:18:22 +0200 Subject: [PATCH] make the pages global and add navbar to each of them and dont require authentication, also add logout button --- main.py | 17 +++------- templates/app.jinja2 | 44 ------------------------ templates/home.jinja2 | 66 ++++++++++++++++++++++++++++++++++++ templates/leaderboard.jinja2 | 15 +++++++- templates/login.jinja2 | 29 ++++++++++++++++ templates/register.jinja2 | 29 ++++++++++++++++ 6 files changed, 142 insertions(+), 58 deletions(-) delete mode 100644 templates/app.jinja2 create mode 100644 templates/home.jinja2 diff --git a/main.py b/main.py index 9565b73..4866e43 100644 --- a/main.py +++ b/main.py @@ -131,17 +131,15 @@ def submit_challenge(): return Response(f"/uploads/{image_uuid}.{image_type}", 200) -@app.route("/app") -@flask_login.login_required +@app.route("/") def application(): - username = flask_login.current_user.id + username = flask_login.current_user.id if hasattr(flask_login.current_user, "id") else "" - return render_template("app.jinja2", username=username) + return render_template("home.jinja2", username=username) @app.route("/leaderboard") -@flask_login.login_required def leaderboard(): - username = flask_login.current_user.id + username = flask_login.current_user.id if hasattr(flask_login.current_user, "id") else "" cur = get_db().cursor() @@ -225,13 +223,6 @@ def uploads(filename): def info(): return redirect(RICKROLL_LINK) -@app.route("/") -def main(): - if flask_login.current_user.is_authenticated: - return redirect(url_for("application")) - else: - return redirect(url_for("login")) - @app.route('/logout') def logout(): flask_login.logout_user() diff --git a/templates/app.jinja2 b/templates/app.jinja2 deleted file mode 100644 index 899cd82..0000000 --- a/templates/app.jinja2 +++ /dev/null @@ -1,44 +0,0 @@ -{% extends "base.jinja2" %} -{% block title %}Grass Touching Dashboard{% endblock %} - -{% block body %} - - -
-
-

Welcome back, {{ username }}

-
Why are you here?
-
Why did you cheat?
-
I know you did!!!
-
No one touches grass!
-
I know you don't go outside you liar!
-
You are a discord moderator who plays League of Legends 24 hours a day!
-
But, if you really want to learn how to go outside and touch grass, check our unofficial guide
-
To prove you belong here, you have to touch grass each day or your account will be permanently banned with no exceptions.
-
To see how you fare against others, check the leaderboard
-
-
- -{% endblock %} \ No newline at end of file diff --git a/templates/home.jinja2 b/templates/home.jinja2 new file mode 100644 index 0000000..ca19068 --- /dev/null +++ b/templates/home.jinja2 @@ -0,0 +1,66 @@ +{% extends "base.jinja2" %} +{% block title %}Grass Touching Dashboard{% endblock %} + +{% block body %} + + +
+
+ {% if username %} +

Welcome back, {{ username }}

+
Why are you here?
+
Why did you cheat?
+
I know you did!!!
+
No one touches grass!
+
I know you don't go outside you liar!
+
You are a discord moderator who plays League of Legends 24 hours a day!
+
But, if you really want to learn how to go outside and touch grass, check our unofficial guide
+
To prove you belong here, you have to touch grass each day or your account will be permanently banned with no exceptions.
+
To see how you fare against others, check the leaderboard
+ {% else %} +

Welcome anonymous discord moderator on the internet!

+
Why are you here?
+
You should go outside and touch grass instead.
+
Even though i know you won't, if you want to learn how to go outside and touch grass, check our unofficial guide
+
After watching the guide, you should register on our website!
+
To prove you belong here, you have to touch grass each day or your account will be permanently banned with no exceptions.
+
To see how you fare against others, check the leaderboard
+ {% endif %} +
+
+ +{% endblock %} \ No newline at end of file diff --git a/templates/leaderboard.jinja2 b/templates/leaderboard.jinja2 index 6acffbe..0cb8d1b 100644 --- a/templates/leaderboard.jinja2 +++ b/templates/leaderboard.jinja2 @@ -13,7 +13,7 @@ +
diff --git a/templates/login.jinja2 b/templates/login.jinja2 index eeb12cc..411e7b8 100644 --- a/templates/login.jinja2 +++ b/templates/login.jinja2 @@ -1,6 +1,35 @@ {% extends "base.jinja2" %} {% block title %}Grass Touching Login{% endblock %} {% block body %} +
diff --git a/templates/register.jinja2 b/templates/register.jinja2 index c50d5ef..03c8f6d 100644 --- a/templates/register.jinja2 +++ b/templates/register.jinja2 @@ -1,6 +1,35 @@ {% extends "base.jinja2" %} {% block title %}Grass Touching Register{% endblock %} {% block body %} +