From f0696aa68d893c4c1f9a723cbdac738d02f42819 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 5 Aug 2023 05:26:08 +0300 Subject: [PATCH] restore old report ratelimits, i forgot that banner ppl sometimes use reports in lieu of comments --- files/helpers/config/const.py | 3 --- files/routes/reporting.py | 8 ++++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index 6afcd6e4ca..4a3852754d 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -51,7 +51,6 @@ class Service(Enum): POST_RATELIMIT = '20/day' DEFAULT_RATELIMIT = "30/minute;200/hour;1000/day" CASINO_RATELIMIT = "100/minute;2000/hour;12000/day" -REPORT_RATELIMIT = DEFAULT_RATELIMIT PUSH_NOTIF_LIMIT = 1000 @@ -657,8 +656,6 @@ BADGE_BLACKLIST = { # only grantable by admins higher than PERMS['IGNORE_BADGE_B NOTIFIED_USERS = {} if SITE == 'rdrama.net': - REPORT_RATELIMIT = '5/hour;10/day' - NOTIFICATION_SPAM_AGE_THRESHOLD = 0.5 * 86400 TELEGRAM_ID = "rdramanet" diff --git a/files/routes/reporting.py b/files/routes/reporting.py index f0f7f7681f..36a910cbe0 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -14,8 +14,8 @@ from files.__main__ import app, limiter, cache @app.post("/report/post/") @limiter.limit('1/second', scope=rpath) @limiter.limit('1/second', scope=rpath, key_func=get_ID) -@limiter.limit(REPORT_RATELIMIT, deduct_when=lambda response: response.status_code < 400) -@limiter.limit(REPORT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID) +@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400) +@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID) @auth_required def report_post(pid, v): post = get_post(pid) @@ -77,8 +77,8 @@ def report_post(pid, v): @app.post("/report/comment/") @limiter.limit('1/second', scope=rpath) @limiter.limit('1/second', scope=rpath, key_func=get_ID) -@limiter.limit(REPORT_RATELIMIT, deduct_when=lambda response: response.status_code < 400) -@limiter.limit(REPORT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID) +@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400) +@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID) @auth_required def report_comment(cid, v): if v.is_muted: abort(403, "You are forbidden from making reports!")