From 57f989dfe710171267c575020bbb6e20d752e67b Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 24 Feb 2022 05:46:09 +0200 Subject: [PATCH] fg --- files/routes/comments.py | 15 +++++++++------ files/routes/posts.py | 14 ++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index fb6cd282f..c9c25f392 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -145,9 +145,10 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None): def api_comment(v): if v.is_suspended: return {"error": "You can't perform this action while banned."}, 403 - if v and v.patron: - if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 8 MB."}, 413 - elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB."}, 413 + if v.admin_level < 2: + if v and v.patron: + if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413 + elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413 parent_submission = request.values.get("submission").strip() parent_fullname = request.values.get("parent_fullname").strip() @@ -693,9 +694,11 @@ def api_comment(v): @limiter.limit("1/second;30/minute;200/hour;1000/day") @auth_required def edit_comment(cid, v): - if v and v.patron: - if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 8 MB."}, 413 - elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB."}, 413 + + if v.admin_level < 2: + if v and v.patron: + if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413 + elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413 c = get_comment(cid, v=v) diff --git a/files/routes/posts.py b/files/routes/posts.py index edba5495d..bf83bf938 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -444,9 +444,10 @@ def morecomments(v, cid): @limiter.limit("1/second;30/minute;200/hour;1000/day") @auth_required def edit_post(pid, v): - if v and v.patron: - if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 8 MB."}, 413 - elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB."}, 413 + if v.admin_level < 2: + if v and v.patron: + if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413 + elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413 p = get_post(pid) @@ -875,9 +876,10 @@ def submit_post(v, sub=None): if v.is_suspended: return error("You can't perform this action while banned.") - if v and v.patron: - if request.content_length > 8 * 1024 * 1024: return error( "Max file size is 8 MB.") - elif request.content_length > 4 * 1024 * 1024: return error( "Max file size is 4 MB.") + if v.admin_level < 2: + if v and v.patron: + if request.content_length > 8 * 1024 * 1024: return error( "Max file size is 4 MB (8 MB for paypigs).") + elif request.content_length > 4 * 1024 * 1024: return error( "Max file size is 4 MB (8 MB for paypigs).") if v.agendaposter and not v.marseyawarded: title = torture_ap(title, v.username)