From 517ed8a9d368a059ecb00b2008c7f9f914855d04 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 8 Jul 2023 02:18:03 +0300 Subject: [PATCH] disallow ALL bots from voting --- files/helpers/config/const.py | 4 ++-- files/routes/comments.py | 2 +- files/routes/votes.py | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index aa9d4766e..901499e0f 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -686,7 +686,7 @@ HOLE_COST = 0 GROUP_COST = 10000 HOLE_INACTIVITY_DELETION = False -PRIVILEGED_USER_BOTS = () +BOT_SYMBOL_HIDDEN = () AUTOJANNY_ID = 1 SNAPPY_ID = 2 @@ -810,7 +810,7 @@ if SITE == 'rdrama.net': HOLE_COST = 50000 HOLE_INACTIVITY_DELETION = True - PRIVILEGED_USER_BOTS = (12125,16049) + BOT_SYMBOL_HIDDEN = (12125,16049) EXEMPT_FROM_1WEEK_EDITING_LIMIT = {1048} AUTOJANNY_ID = 1046 diff --git a/files/routes/comments.py b/files/routes/comments.py index dce065d48..f70400e03 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -264,7 +264,7 @@ def comment(v:User): if len(body_html) > COMMENT_BODY_HTML_LENGTH_LIMIT: abort(400, "Comment too long!") - is_bot = v.client is not None and v.id not in PRIVILEGED_USER_BOTS + is_bot = v.client is not None and v.id not in BOT_SYMBOL_HIDDEN chudded = v.chud and not (posting_to_post and post_target.sub == 'chudrama') diff --git a/files/routes/votes.py b/files/routes/votes.py index 0d26b4670..014a07d70 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -53,7 +53,10 @@ def vote_info_get(v, link): def vote_post_comment(target_id, new, v, cls, vote_cls): if new == "-1" and DISABLE_DOWNVOTES: abort(403) if new not in {"-1", "0", "1"}: abort(400) - if v.client and v.id not in PRIVILEGED_USER_BOTS: abort(403) + + if request.headers.get("Authorization"): + abort(403, "Bots aren't allowed to vote right now") + new = int(new) target = None if cls == Post: