master
Aevann1 2022-05-22 19:23:52 +02:00
parent a4ca9fc1aa
commit 9bc310a6a4
2 changed files with 6 additions and 0 deletions

View File

@ -441,6 +441,7 @@ def archives(path):
return resp return resp
@app.get('/e/<emoji>') @app.get('/e/<emoji>')
@limiter.exempt
def emoji(emoji): def emoji(emoji):
if not emoji.endswith('.webp'): abort(404) if not emoji.endswith('.webp'): abort(404)
resp = make_response(send_from_directory('assets/images/emojis', emoji)) resp = make_response(send_from_directory('assets/images/emojis', emoji))
@ -452,6 +453,7 @@ def emoji(emoji):
@app.get('/assets/<path:path>') @app.get('/assets/<path:path>')
@app.get('/static/assets/<path:path>') @app.get('/static/assets/<path:path>')
@limiter.exempt
def static_service(path): def static_service(path):
resp = make_response(send_from_directory('assets', path)) resp = make_response(send_from_directory('assets', path))
if request.path.endswith('.webp') or request.path.endswith('.gif') or request.path.endswith('.ttf') or request.path.endswith('.woff2'): if request.path.endswith('.webp') or request.path.endswith('.gif') or request.path.endswith('.ttf') or request.path.endswith('.woff2'):
@ -467,6 +469,7 @@ def static_service(path):
@app.get('/images/<path>') @app.get('/images/<path>')
@app.get('/hostedimages/<path>') @app.get('/hostedimages/<path>')
@app.get("/static/images/<path>") @app.get("/static/images/<path>")
@limiter.exempt
def images(path): def images(path):
resp = make_response(send_from_directory('/images', path.replace('.WEBP','.webp'))) resp = make_response(send_from_directory('/images', path.replace('.WEBP','.webp')))
resp.headers.remove("Cache-Control") resp.headers.remove("Cache-Control")
@ -476,6 +479,7 @@ def images(path):
return resp return resp
@app.get('/videos/<path>') @app.get('/videos/<path>')
@limiter.exempt
def videos(path): def videos(path):
resp = make_response(send_from_directory('/videos', path.replace('.MP4','.mp4'))) resp = make_response(send_from_directory('/videos', path.replace('.MP4','.mp4')))
resp.headers.remove("Cache-Control") resp.headers.remove("Cache-Control")

View File

@ -1141,6 +1141,7 @@ def remove_follow(username, v):
@app.get("/logged_out/pp/<id>") @app.get("/logged_out/pp/<id>")
@app.get("/logged_out/uid/<id>/pic") @app.get("/logged_out/uid/<id>/pic")
@app.get("/logged_out/uid/<id>/pic/profile") @app.get("/logged_out/uid/<id>/pic/profile")
@limiter.exempt
@auth_desired @auth_desired
def user_profile_uid(v, id): def user_profile_uid(v, id):
if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}") if not v and not request.path.startswith('/logged_out'): return redirect(f"/logged_out{request.full_path}")
@ -1155,6 +1156,7 @@ def user_profile_uid(v, id):
return redirect(x.profile_url) return redirect(x.profile_url)
@app.get("/@<username>/pic") @app.get("/@<username>/pic")
@limiter.exempt
@auth_required @auth_required
def user_profile_name(v, username): def user_profile_name(v, username):
x = get_user(username) x = get_user(username)