remotes/1693045480750635534/spooky-22
Aevann1 2021-08-13 03:38:51 +02:00
parent 6acb07bc92
commit abda32d753
3 changed files with 16 additions and 1 deletions

View File

@ -26,11 +26,14 @@ beams_client = PushNotifications(
@app.get("/comment/<cid>")
@app.get("/post/<pid>/<anything>/<cid>")
@app.get("/logged_out/comment/<cid>")
@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)

View File

@ -45,8 +45,14 @@ def submit_get(v):
@app.get("/post/<pid>")
@app.get("/post/<pid>/<anything>")
@app.get("/logged_out/post/<pid>")
@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

View File

@ -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("/@<username>")
@app.get("/logged_out/@<username>")
@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("/@<username>/comments")
@app.get("/logged_out/@<username>/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