From abda32d753dac4181a292e77b10f4e05d700a0c4 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 13 Aug 2021 03:38:51 +0200 Subject: [PATCH] fdfddf --- files/routes/comments.py | 3 +++ files/routes/posts.py | 6 ++++++ files/routes/users.py | 8 +++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index a3c995fcb..cb89930d7 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -26,11 +26,14 @@ beams_client = PushNotifications( @app.get("/comment/") @app.get("/post///") +@app.get("/logged_out/comment/") @auth_desired def post_pid_comment_cid(cid, pid=None, anything=None, v=None): if v and v.is_banned and not v.unban_utc: return render_template("seized.html") + if not v and "logged_out" not in request.path: return redirect(f"/logged_out/comment/{cid}") + try: cid = int(cid) except: try: cid = int(cid, 36) diff --git a/files/routes/posts.py b/files/routes/posts.py index 132ac20bd..e4a99dc8c 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -45,8 +45,14 @@ def submit_get(v): @app.get("/post/") @app.get("/post//") +@app.get("/logged_out/post/") @auth_desired def post_id(pid, anything=None, v=None): + + if v and v.is_banned and not v.unban_utc: return render_template("seized.html") + + if not v and "logged_out" not in request.path: return redirect(f"/logged_out/post/{pid}") + try: pid = int(pid) except Exception as e: pass diff --git a/files/routes/users.py b/files/routes/users.py index 6aa65f08c..afefb131a 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -272,11 +272,15 @@ def visitors(v): viewers=sorted(v.viewers, key = lambda x: x.last_view_utc, reverse=True) return render_template("viewers.html", v=v, viewers=viewers) + @app.get("/@") +@app.get("/logged_out/@") @auth_desired def u_username(username, v=None): if v and v.is_banned and not v.unban_utc: return render_template("seized.html") + if not v and "logged_out" not in request.path: return redirect(f"/logged_out/@{username}") + # username is unique so at most this returns one result. Otherwise 404 # case insensitive search @@ -388,12 +392,14 @@ def u_username(username, v=None): is_following=(v and u.has_follower(v))) - @app.get("/@/comments") +@app.get("/logged_out/@/comments") @auth_desired def u_username_comments(username, v=None): if v and v.is_banned and not v.unban_utc: return render_template("seized.html") + if not v and "logged_out" not in request.path: return redirect(f"/logged_out/@{username}/comments") + # username is unique so at most this returns one result. Otherwise 404 # case insensitive search