image size for patrons

master
Aevann1 2021-11-11 21:14:11 +02:00
parent 8ae70b9b04
commit 9e6b2b4eb4
4 changed files with 19 additions and 7 deletions

View File

@ -34,7 +34,7 @@ app.config["SERVER_NAME"] = environ.get("DOMAIN").strip()
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 86400 app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 86400
app.config["SESSION_COOKIE_NAME"] = "session_" + environ.get("SITE_NAME").strip().lower() app.config["SESSION_COOKIE_NAME"] = "session_" + environ.get("SITE_NAME").strip().lower()
app.config["VERSION"] = "1.0.0" app.config["VERSION"] = "1.0.0"
app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 app.config['MAX_CONTENT_LENGTH'] = 8 * 1024 * 1024
app.config["SESSION_COOKIE_SECURE"] = bool(int(environ.get("FORCE_HTTPS", 1))) app.config["SESSION_COOKIE_SECURE"] = bool(int(environ.get("FORCE_HTTPS", 1)))
app.config["SESSION_COOKIE_SAMESITE"] = "Lax" app.config["SESSION_COOKIE_SAMESITE"] = "Lax"
app.config["PERMANENT_SESSION_LIFETIME"] = 60 * 60 * 24 * 365 app.config["PERMANENT_SESSION_LIFETIME"] = 60 * 60 * 24 * 365

View File

@ -133,7 +133,9 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
@is_not_banned @is_not_banned
@validate_formkey @validate_formkey
def api_comment(v): def api_comment(v):
if request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413 if v and v.patron:
if request.content_length > 8 * 1024 * 1024: return "Max file size is 8 MB.", 413
elif request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413
parent_submission = request.values.get("submission").strip() parent_submission = request.values.get("submission").strip()
parent_fullname = request.values.get("parent_fullname").strip() parent_fullname = request.values.get("parent_fullname").strip()
@ -589,7 +591,9 @@ def api_comment(v):
@auth_required @auth_required
@validate_formkey @validate_formkey
def edit_comment(cid, v): def edit_comment(cid, v):
if request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413 if v and v.patron:
if request.content_length > 8 * 1024 * 1024: return "Max file size is 8 MB.", 413
elif request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413
c = get_comment(cid, v=v) c = get_comment(cid, v=v)

View File

@ -506,7 +506,9 @@ def thumbnail_thread(pid):
@is_not_banned @is_not_banned
@validate_formkey @validate_formkey
def submit_post(v): def submit_post(v):
if request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413 if v and v.patron:
if request.content_length > 8 * 1024 * 1024: return "Max file size is 8 MB.", 413
elif request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413
title = request.values.get("title", "").strip() title = request.values.get("title", "").strip()
url = request.values.get("url", "").strip() url = request.values.get("url", "").strip()

View File

@ -45,7 +45,9 @@ def removebackground(v):
@auth_required @auth_required
@validate_formkey @validate_formkey
def settings_profile_post(v): def settings_profile_post(v):
if request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413 if v and v.patron:
if request.content_length > 8 * 1024 * 1024: return "Max file size is 8 MB.", 413
elif request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413
updated = False updated = False
@ -677,7 +679,9 @@ def settings_log_out_others(v):
@auth_required @auth_required
@validate_formkey @validate_formkey
def settings_images_profile(v): def settings_images_profile(v):
if request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413 if v and v.patron:
if request.content_length > 8 * 1024 * 1024: return "Max file size is 8 MB.", 413
elif request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403 if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403
@ -711,7 +715,9 @@ def settings_images_profile(v):
@auth_required @auth_required
@validate_formkey @validate_formkey
def settings_images_banner(v): def settings_images_banner(v):
if request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413 if v and v.patron:
if request.content_length > 8 * 1024 * 1024: return "Max file size is 8 MB.", 413
elif request.content_length > 4 * 1024 * 1024: return "Max file size is 4 MB.", 413
if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403 if request.headers.get("cf-ipcountry") == "T1": return "Image uploads are not allowed through TOR.", 403