forked from MarseyWorld/MarseyWorld
RESTORE CACHE
parent
9f89e8a0aa
commit
3d193357ef
|
@ -59,10 +59,18 @@ def pusher_thread(interests, c, username):
|
|||
|
||||
@app.get("/comment/<cid>")
|
||||
@app.get("/post/<pid>/<anything>/<cid>")
|
||||
@app.get("/logged_out/comment/<cid>")
|
||||
@app.get("/logged_out/post/<pid>/<anything>/<cid>")
|
||||
@app.get("/h/<sub>/comment/<cid>")
|
||||
@app.get("/h/<sub>/post/<pid>/<anything>/<cid>")
|
||||
@app.get("/logged_out/h/<sub>/comment/<cid>")
|
||||
@app.get("/logged_out/h/<sub>/post/<pid>/<anything>/<cid>")
|
||||
@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}")
|
||||
|
||||
if v and request.path.startswith('/logged_out'): v = None
|
||||
|
||||
try: cid = int(cid)
|
||||
except: abort(404)
|
||||
|
|
|
@ -157,8 +157,11 @@ def notifications(v):
|
|||
|
||||
|
||||
@app.get("/")
|
||||
@app.get("/logged_out")
|
||||
@app.get("/h/<sub>")
|
||||
@app.get("/logged_out/h/<sub>")
|
||||
@app.get("/s/<sub>")
|
||||
@app.get("/logged_out/s/<sub>")
|
||||
@limiter.limit("3/second;30/minute;1000/hour;5000/day")
|
||||
@auth_desired
|
||||
def front_all(v, sub=None, subdomain=None):
|
||||
|
@ -169,6 +172,11 @@ def front_all(v, sub=None, subdomain=None):
|
|||
if g.webview and not session.get("session_id"):
|
||||
session["session_id"] = secrets.token_hex(49)
|
||||
|
||||
if not v and request.path == "/" and not request.headers.get("Authorization"):
|
||||
return redirect(f"/logged_out{request.full_path}")
|
||||
|
||||
if v and request.path.startswith('/logged_out'): v = None
|
||||
|
||||
try: page = max(int(request.values.get("page", 1)), 1)
|
||||
except: abort(400)
|
||||
|
||||
|
|
|
@ -114,10 +114,18 @@ def submit_get(v, sub=None):
|
|||
|
||||
@app.get("/post/<pid>")
|
||||
@app.get("/post/<pid>/<anything>")
|
||||
@app.get("/logged_out/post/<pid>")
|
||||
@app.get("/logged_out/post/<pid>/<anything>")
|
||||
@app.get("/h/<sub>/post/<pid>")
|
||||
@app.get("/h/<sub>/post/<pid>/<anything>")
|
||||
@app.get("/logged_out/h/<sub>/post/<pid>")
|
||||
@app.get("/logged_out/h/<sub>/post/<pid>/<anything>")
|
||||
@auth_desired
|
||||
def post_id(pid, anything=None, v=None, sub=None):
|
||||
if not v and not request.path.startswith('/logged_out') and not request.headers.get("Authorization"):
|
||||
return redirect(f"/logged_out{request.full_path}")
|
||||
|
||||
if v and request.path.startswith('/logged_out'): v = None
|
||||
|
||||
try: pid = int(pid)
|
||||
except Exception as e: pass
|
||||
|
|
|
@ -16,25 +16,6 @@ def rdrama(id, title):
|
|||
id = ''.join(f'{x}/' for x in id)
|
||||
return redirect(f'/archives/drama/comments/{id}{title}.html')
|
||||
|
||||
@app.get('/logged_out/')
|
||||
@app.get('/logged_out/<path:old>')
|
||||
def logged_out(old = ""):
|
||||
# Remove trailing question mark from request.full_path which flask adds if there are no query parameters
|
||||
redirect_url = request.full_path.replace("/logged_out", "", 1)
|
||||
if redirect_url.endswith("?"):
|
||||
redirect_url = redirect_url[:-1]
|
||||
|
||||
# Handle cases like /logged_out?asdf by adding a slash to the beginning
|
||||
if not redirect_url.startswith('/'):
|
||||
redirect_url = f"/{redirect_url}"
|
||||
|
||||
# Prevent redirect loop caused by visiting /logged_out/logged_out/logged_out/etc...
|
||||
if redirect_url.startswith('/logged_out'):
|
||||
abort(400)
|
||||
|
||||
return redirect(redirect_url)
|
||||
|
||||
|
||||
@app.get("/privacy")
|
||||
@auth_required
|
||||
def privacy(v):
|
||||
|
@ -63,13 +44,23 @@ def marsey_list():
|
|||
return str(marseys).replace("'",'"')
|
||||
|
||||
@app.get("/terms")
|
||||
@app.get("/logged_out/terms")
|
||||
@auth_desired
|
||||
def terms(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'): v = None
|
||||
|
||||
return render_template("terms.html", v=v)
|
||||
|
||||
@app.get('/sidebar')
|
||||
@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'): v = None
|
||||
|
||||
return render_template('sidebar.html', v=v)
|
||||
|
||||
|
||||
|
|
|
@ -833,10 +833,16 @@ def visitors(v):
|
|||
|
||||
|
||||
@app.get("/@<username>")
|
||||
@app.get("/logged_out/@<username>")
|
||||
@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'): v = None
|
||||
|
||||
|
||||
u = get_user(username, v=v)
|
||||
|
||||
|
||||
|
@ -920,9 +926,15 @@ def u_username(username, v=None):
|
|||
|
||||
|
||||
@app.get("/@<username>/comments")
|
||||
@app.get("/logged_out/@<username>/comments")
|
||||
@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'): v = None
|
||||
|
||||
user = get_user(username, v=v)
|
||||
|
||||
if username != user.username: return redirect(f'/@{user.username}/comments')
|
||||
|
@ -1101,8 +1113,11 @@ def remove_follow(username, v):
|
|||
return {"message": "Follower removed!"}
|
||||
|
||||
@app.get("/pp/<id>")
|
||||
@app.get("/logged_out/pp/<id>")
|
||||
@app.get("/uid/<id>/pic")
|
||||
@app.get("/logged_out/uid/<id>/pic")
|
||||
@app.get("/uid/<id>/pic/profile")
|
||||
@app.get("/logged_out/uid/<id>/pic/profile")
|
||||
@limiter.exempt
|
||||
@auth_desired
|
||||
def user_profile_uid(v, id):
|
||||
|
@ -1111,6 +1126,10 @@ def user_profile_uid(v, id):
|
|||
try: id = int(id, 36)
|
||||
except: abort(404)
|
||||
|
||||
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'): v = None
|
||||
|
||||
x=get_account(id)
|
||||
return redirect(x.profile_url)
|
||||
|
||||
|
|
|
@ -226,24 +226,30 @@
|
|||
<body id="{% if request.path != '/comments' %}{% block pagetype %}frontpage{% endblock %}{% endif %}" {% if SITE_NAME == 'rDrama' and not v or v and (v.shadowbanned or v.is_banned or v.agendaposter) %}style="overflow-x: hidden;background:url(/assets/images/backgrounds/anime/1.webp?v=3) center center fixed; background-color: var(--background)"{% elif v and v.background %}style="{% if path != '/formatting' %}overflow-x: hidden; {% endif %} background:url(/assets/images/backgrounds/{{v.background}}?v=3) center center fixed; background-color: var(--background){% if 'anime' not in v.background %};background-size: cover{% endif %}"{% endif %}>
|
||||
|
||||
{% block Banner %}
|
||||
{% if '@' not in request.path %}
|
||||
{% if sub %}
|
||||
<img alt="/h/{{sub.name}} banner" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{sub.banner_url}}')" loading="lazy" src="{{sub.banner_url}}" width=100% style="object-fit:cover;max-height:25vw">
|
||||
{% elif SITE_NAME == 'rDrama' %}
|
||||
{% set path = "assets/images/" + SITE_NAME + "/banners" %}
|
||||
{% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=24' %}
|
||||
{% if '@' not in request.path %}
|
||||
{% if v %}
|
||||
{% if sub %}
|
||||
<img alt="/h/{{sub.name}} banner" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{sub.banner_url}}')" loading="lazy" src="{{sub.banner_url}}" width=100% style="object-fit:cover;max-height:25vw">
|
||||
{% elif SITE_NAME == 'rDrama' %}
|
||||
{% set path = "assets/images/" + SITE_NAME + "/banners" %}
|
||||
{% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=24' %}
|
||||
|
||||
<a href="https://secure.transequality.org/site/Donation2?df_id=1480">
|
||||
{% if v and (v.shadowbanned or v.is_banned or v.agendaposter) %}
|
||||
<img alt="site banner" src="/assets/images/rDrama/banner2.webp?v=1" width="100%">
|
||||
{% else %}
|
||||
<img alt="site banner" src="{{image}}" width="100%">
|
||||
{% endif %}
|
||||
</a>
|
||||
<a href="https://secure.transequality.org/site/Donation2?df_id=1480">
|
||||
{% if v and (v.shadowbanned or v.is_banned or v.agendaposter) %}
|
||||
<img alt="site banner" src="/assets/images/rDrama/banner2.webp?v=1" width="100%">
|
||||
{% else %}
|
||||
<img alt="site banner" src="{{image}}" width="100%">
|
||||
{% endif %}
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="/">
|
||||
<img alt="site banner" src="/assets/images/{{SITE_NAME}}/banner.webp?v=1042" width="100%">
|
||||
</a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<a href="/">
|
||||
<img alt="site banner" src="/assets/images/{{SITE_NAME}}/banner.webp?v=1042" width="100%">
|
||||
</a>
|
||||
<a href="/login">
|
||||
<img class="banner" alt="site banner" src="/assets/images/{{SITE_NAME}}/cached.webp?v=1013" width="100%">
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
{% if g.webview %} <div class="custom-control custom-checkbox mt-4">
|
||||
<input autocomplete="off" type="checkbox" class="custom-control-input" id="termsCheck" required>
|
||||
<label class="custom-control-label terms" for="termsCheck">I accept the <a
|
||||
href="/terms" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %}>terms of use</a></label>
|
||||
href="/logged_out/terms" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %}>terms of use</a></label>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="text-center text-muted text-small mt-5 mb-3">
|
||||
|
|
|
@ -112,9 +112,9 @@
|
|||
<input autocomplete="off" type="checkbox" class="custom-control-input" id="termsCheck" required>
|
||||
<label class="custom-control-label terms" for="termsCheck">I accept the <a
|
||||
{% if g.webview %}
|
||||
href="/terms">terms of use
|
||||
href="/logged_out/terms">terms of use
|
||||
{% else %}
|
||||
href="/sidebar">rules
|
||||
href="/logged_out/sidebar">rules
|
||||
{% endif %}
|
||||
</a></label>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue