master
Aevann1 2021-12-16 20:12:26 +02:00
parent 28babbee6b
commit 2357c422ba
7 changed files with 18 additions and 13 deletions

View File

@ -168,7 +168,7 @@ def buy(v, award):
@validate_formkey
def award_post(pid, v):
if v.shadowbanned: return render_template('errors/500.html', v=v), 500
if v.shadowbanned: return render_template('errors/500.html', error=True, v=v), 500
if v.is_banned and not v.unban_utc: return {"error": "forbidden."}, 403
@ -339,7 +339,7 @@ def award_post(pid, v):
@validate_formkey
def award_comment(cid, v):
if v.shadowbanned: return render_template('errors/500.html', v=v), 500
if v.shadowbanned: return render_template('errors/500.html', error=True, v=v), 500
if v.is_suspended and v.unban_utc == 0: return {"error": "forbidden"}, 403

View File

@ -15,7 +15,7 @@ from files.__main__ import app, limiter
@auth_desired
def error_400(e, v):
if request.headers.get("Authorization"): return {"error": "400 Bad Request"}, 400
else: return render_template('errors/400.html', v=v), 400
else: return render_template('errors/400.html', error=True, v=v), 400
@app.errorhandler(401)
def error_401(e):
@ -33,28 +33,28 @@ def error_401(e):
@auth_desired
def error_403(e, v):
if request.headers.get("Authorization"): return {"error": "403 Forbidden"}, 403
else: return render_template('errors/403.html', v=v), 403
else: return render_template('errors/403.html', error=True, v=v), 403
@app.errorhandler(404)
@auth_desired
def error_404(e, v):
if request.headers.get("Authorization"): return {"error": "404 Not Found"}, 404
else: return render_template('errors/404.html', v=v), 404
else: return render_template('errors/404.html', error=True, v=v), 404
@app.errorhandler(405)
@auth_desired
def error_405(e, v):
if request.headers.get("Authorization"): return {"error": "405 Method Not Allowed"}, 405
else: return render_template('errors/405.html', v=v), 405
else: return render_template('errors/405.html', error=True, v=v), 405
@app.errorhandler(429)
@auth_desired
def error_429(e, v):
if request.headers.get("Authorization"): return {"error": "429 Too Many Requests"}, 429
else: return render_template('errors/429.html', v=v), 429
else: return render_template('errors/429.html', error=True, v=v), 429
@app.errorhandler(500)
@ -63,7 +63,7 @@ def error_500(e, v):
g.db.rollback()
if request.headers.get("Authorization"): return {"error": "500 Internal Server Error"}, 500
else: return render_template('errors/500.html', v=v), 500
else: return render_template('errors/500.html', error=True, v=v), 500
@app.post("/allow_nsfw")
@ -78,7 +78,7 @@ def allow_nsfw():
def error_all_preview(error, v):
try:
return render_template(f"errors/{error}.html", v=v)
return render_template(f"errors/{error}.html", error=True, v=v)
except jinja2.exceptions.TemplateNotFound:
abort(400)

View File

@ -125,7 +125,7 @@ def front_all(v):
if not v and request.path == "/" and not request.headers.get("Authorization"): return redirect(f"/logged_out{request.full_path}")
if v and v.is_banned and not v.unban_utc: return render_template('errors/500.html', v=v), 500
if v and v.is_banned and not v.unban_utc: return render_template('errors/500.html', error=True, v=v), 500
if v and request.path.startswith('/logged_out'): v = None

View File

@ -16,7 +16,7 @@ defaultcolor = environ.get("DEFAULT_COLOR").strip()
@auth_desired
def admin_vote_info_get(v):
if v and v.shadowbanned: return render_template('errors/500.html', v=v), 500
if v and v.shadowbanned: return render_template('errors/500.html', error=True, v=v), 500
link = request.values.get("link")
if not link: return render_template("votes.html", v=v)
@ -27,7 +27,7 @@ def admin_vote_info_get(v):
else: abort(400)
except: abort(400)
if thing.author.shadowbanned and not (v and v.admin_level): return render_template('errors/500.html', v=v), 500
if thing.author.shadowbanned and not (v and v.admin_level): return render_template('errors/500.html', error=True, v=v), 500
if isinstance(thing, Submission):

View File

@ -4,6 +4,7 @@
<nav class="fixed top-0 w-full bg-gray-700" style="z-index: 1030;">
<div class="w-full max-w-screen-2xl mx-auto grid grid-cols-12 px-4">
<div class="relative col-span-full flex items-center justify-between h-16 px-4 snowcaps">
{% if not error %}
<div class="absolute inset-y-0 left-0 flex items-center sm:hidden">
<!-- Mobile menu button-->
<button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white" data-bs-toggle="offcanvas" data-bs-target="#offcanvasNavbar" aria-controls="offcanvasNavbar">
@ -30,6 +31,7 @@
</svg>
</button>
</div>
{% endif %}
<div class="flex-1 flex items-center justify-center sm:items-stretch sm:justify-start">
<div class="flex-shrink-0 flex items-center">
<a href="{{ '/' if v else '/logged_out'}}">
@ -69,6 +71,7 @@
</div>
</div>
{% if not error %}
<div class="absolute inset-y-0 right-0 flex items-center space-x-3 sm:static sm:inset-auto sm:ml-6 sm:pr-0">
<!-- Logged in -->
{% if v %}
@ -118,6 +121,7 @@
</a>
{% endif %}
</div>
{% endif %}
</div>
</div>

View File

@ -214,7 +214,6 @@
{% include "header.html" %}
{% block mobileUserBanner %}
{% endblock %}

View File

@ -26,6 +26,7 @@
</span>
</form>
</div>
{% if not error %}
<a class="mobile-nav-icon d-md-none" href="/random"><i class="fas fa-random align-middle text-gray-500 black"></i></a>
{% if v and v.admin_level > 0 %}
<a class="mobile-nav-icon d-md-none" href="/admin"><i class="fas fa-crown align-middle text-gray-500 black"></i></a>
@ -208,6 +209,7 @@
{% endif %}
</ul>
</div>
{% endif %}
</div>
</div>
</nav>