From 7c6a5c8b1ee677668211d4beeab3bda2cd2087d9 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 22 Jan 2022 22:03:46 +0200 Subject: [PATCH] vcxvxc --- files/__main__.py | 5 ++--- files/helpers/sanitize.py | 2 +- files/routes/comments.py | 15 ++++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/files/__main__.py b/files/__main__.py index d6d4e32c7..fc3b3fa20 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -116,12 +116,11 @@ def after_request(response): response.headers.add("X-Frame-Options", "deny") return response -if not cache.get("marseys"): - with open("marseys.json", 'r') as f: cache.set("marseys", loads(f.read())) +with open("marseys.json", 'r') as f: cache.set("marseys", loads(f.read())) from files.routes import * def close_running_threads(): - with open('marsey_count.json', 'w') as f: dump(cache.get("marseys"), f) + with open('marseys.json', 'w') as f: dump(cache.get("marseys"), f) stdout.flush() atexit.register(close_running_threads) \ No newline at end of file diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 8d4fe8776..7cc170a42 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -263,7 +263,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): if comment: for emoji in marseys_used: if emoji in marsey_count: marsey_count[emoji]["count"] += 1 - marsey_count = cache.set("marseys", marsey_count) + cache.set("marseys", marsey_count) return sanitized diff --git a/files/routes/comments.py b/files/routes/comments.py index 8ca7ba9e8..0cc25cf01 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -241,13 +241,14 @@ def api_comment(v): if ban.reason: reason += f" {ban.reason}" return {"error": reason}, 401 - existing = g.db.query(Comment.id).filter(Comment.author_id == v.id, - Comment.deleted_utc == 0, - Comment.parent_comment_id == parent_comment_id, - Comment.parent_submission == parent_submission, - Comment.body_html == body_html - ).one_or_none() - if existing: return {"error": f"You already made that comment: /comment/{existing.id}"}, 409 + if parent_post.id not in (37696,37697,37749,37833,37838): + existing = g.db.query(Comment.id).filter(Comment.author_id == v.id, + Comment.deleted_utc == 0, + Comment.parent_comment_id == parent_comment_id, + Comment.parent_submission == parent_submission, + Comment.body_html == body_html + ).one_or_none() + if existing: return {"error": f"You already made that comment: /comment/{existing.id}"}, 409 if parent.author.any_block_exists(v) and v.admin_level < 2: return {"error": "You can't reply to users who have blocked you, or users you have blocked."}, 403