fixing infinite redirections

master
Aevann1 2022-07-23 09:22:17 +02:00
parent de011ef7b1
commit ddeba62aeb
5 changed files with 12 additions and 17 deletions

View File

@ -37,8 +37,8 @@ WORDLE_COLOR_MAPPINGS = {-1: "🟥", 0: "🟨", 1: "🟩"}
@auth_desired
def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}#context")
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out','') + '#context')
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path.rstrip('?')}#context")
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out','').rstrip('?') + '#context')
try: cid = int(cid)
except: abort(404)

View File

@ -20,17 +20,12 @@ from files.helpers.awards import award_timers
def front_all(v, sub=None, subdomain=None):
if not v and not request.path.startswith('/logged_out'):
r = request.full_path
if r == '/?': r = '/'
return redirect(f"/logged_out{r}")
return redirect(f"/logged_out{request.full_path.rstrip('?')}")
if v and v.is_banned and not v.unban_utc: return redirect('https://deuxrama.net')
if v and request.path.startswith('/logged_out'):
if v.id == AEVANN_ID:
r = request.full_path.replace('/logged_out','')
print(r)
return redirect(r)
return redirect(request.full_path.replace('/logged_out','').rstrip('?'))
if sub: sub = g.db.query(Sub).filter_by(name=sub.strip().lower()).one_or_none()

View File

@ -106,8 +106,8 @@ def submit_get(v, sub=None):
@auth_desired
def post_id(pid, anything=None, v=None, sub=None):
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}")
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out',''))
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path.rstrip('?')}")
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out','').rstrip('?'))
try: pid = int(pid)
except Exception as e: pass

View File

@ -59,8 +59,8 @@ def marsey_list():
@app.get('/logged_out/sidebar')
@auth_desired
def sidebar(v):
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}")
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out',''))
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path.rstrip('?')}")
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out','').rstrip('?'))
return render_template('sidebar.html', v=v)

View File

@ -906,8 +906,8 @@ def visitors(v):
@auth_desired
def u_username(username, v=None):
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}")
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out',''))
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path.rstrip('?')}")
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out','').rstrip('?'))
u = get_user(username, v=v, rendered=True)
@ -1002,8 +1002,8 @@ def u_username(username, v=None):
@auth_desired
def u_username_comments(username, v=None):
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}")
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out',''))
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path.rstrip('?')}")
if v and request.path.startswith('/logged_out'): return redirect(request.full_path.replace('/logged_out','').rstrip('?'))
user = get_user(username, v=v, rendered=True)