From b31ffc6de66c42ed3e79cbe92ee81a277053c0fc Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 23 Mar 2022 18:01:10 +0200 Subject: [PATCH] far --- files/helpers/const.py | 6 +++--- files/routes/chat.py | 10 ++++++++-- files/routes/comments.py | 9 +++------ files/routes/posts.py | 9 +++------ 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 5d8098305..81a04f607 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -129,7 +129,7 @@ if SITE in {'rdrama.net','devrama.xyz'}: KIPPY_ID = 7150 GIFT_NOTIF_ID = 995 PIZZASHILL_ID = 2424 - PIZZASHILLSHILL_ID = 9712 + PIZZA_VOTERS = (1,747,1963,9712) IDIO_ID = 30 CARP_ID = 995 JOAN_ID = 28 @@ -159,7 +159,7 @@ elif SITE == "pcmemes.net": A_ID = 0 KIPPY_ID = 1592 PIZZASHILL_ID = 0 - PIZZASHILLSHILL_ID = 0 + PIZZA_VOTERS = () GIFT_NOTIF_ID = 1592 IDIO_ID = 0 CARP_ID = 0 @@ -191,7 +191,7 @@ else: KIPPY_ID = 0 GIFT_NOTIF_ID = 9 PIZZASHILL_ID = 0 - PIZZASHILLSHILL_ID = 0 + PIZZA_VOTERS = () IDIO_ID = 0 CARP_ID = 0 JOAN_ID = 0 diff --git a/files/routes/chat.py b/files/routes/chat.py index 276bd2baf..23f53bae8 100644 --- a/files/routes/chat.py +++ b/files/routes/chat.py @@ -6,9 +6,10 @@ if "load_chat" in sys.argv: from files.helpers.sanitize import sanitize from datetime import datetime from flask_socketio import SocketIO, emit - from files.__main__ import app, limiter + from files.__main__ import app, limiter, r from flask import render_template import sys + import atexit socketio = SocketIO(app, async_mode='gevent', cors_allowed_origins=[SITE_FULL]) typing = [] @@ -70,4 +71,9 @@ if "load_chat" in sys.argv: elif not data and v.username in typing: typing.remove(v.username) emit('typing', typing, broadcast=True) - return '', 204 \ No newline at end of file + return '', 204 + + + def close_running_threads(): + r.set('chat', messages) + atexit.register(close_running_threads) \ No newline at end of file diff --git a/files/routes/comments.py b/files/routes/comments.py index 014854584..e9e726b05 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -658,12 +658,9 @@ def api_comment(v): c.voted = 1 if v.id == PIZZASHILL_ID: - autovote = CommentVote(user_id=CARP_ID, comment_id=c.id, vote_type=1) - g.db.add(autovote) - autovote = CommentVote(user_id=AEVANN_ID, comment_id=c.id, vote_type=1) - g.db.add(autovote) - autovote = CommentVote(user_id=PIZZASHILLSHILL_ID, comment_id=c.id, vote_type=1) - g.db.add(autovote) + for uid in PIZZA_VOTERS: + autovote = CommentVote(user_id=uid, comment_id=c.id, vote_type=1) + g.db.add(autovote) v.coins += 3 v.truecoins += 3 g.db.add(v) diff --git a/files/routes/posts.py b/files/routes/posts.py index 13adc327a..fe7273596 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1300,12 +1300,9 @@ def submit_post(v, sub=None): cache.delete_memoized(changeloglist) if v.id == PIZZASHILL_ID: - autovote = Vote(user_id=CARP_ID, submission_id=post.id, vote_type=1) - g.db.add(autovote) - autovote = Vote(user_id=AEVANN_ID, submission_id=post.id, vote_type=1) - g.db.add(autovote) - autovote = Vote(user_id=PIZZASHILLSHILL_ID, submission_id=post.id, vote_type=1) - g.db.add(autovote) + for uid in PIZZA_VOTERS: + autovote = Vote(user_id=uid, submission_id=post.id, vote_type=1) + g.db.add(autovote) v.coins += 3 v.truecoins += 3 g.db.add(v)