From d8ac954d5337aeaebf0a0823d6909597051c6644 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 22 Sep 2022 07:26:48 +0200 Subject: [PATCH 1/7] remove unnecessary execution of function --- files/helpers/stats.py | 1 - 1 file changed, 1 deletion(-) diff --git a/files/helpers/stats.py b/files/helpers/stats.py index 4b40ba6b44..bd98613c63 100644 --- a/files/helpers/stats.py +++ b/files/helpers/stats.py @@ -15,7 +15,6 @@ from files.helpers.const import * def generate_charts_task(site): chart(kind='daily', site=site) chart(kind='weekly', site=site) - stats(site=site) def chart(kind, site): now = time.gmtime() From 0df33c86a475adee37f9c6e7f9a17af15e1ddabb Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 22 Sep 2022 20:23:18 +0200 Subject: [PATCH 2/7] remove unnecessary deprected behavior in /distribute --- files/routes/admin.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 0722516726..0d580e6e4f 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -235,10 +235,6 @@ def distribute(v, option_id): losing_voters.extend([x.user_id for x in o.votes]) for uid in losing_voters: add_notif(cid, uid) - - - post.body += '\n\nclosed' - g.db.add(post) ma = ModAction( kind="distribute", From 5c7ff17512e9605d593af1686b6d6d95fa60459c Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 22 Sep 2022 20:26:06 +0200 Subject: [PATCH 3/7] remove "/live" from url for offline streamesr --- files/routes/static.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/routes/static.py b/files/routes/static.py index 54dfb0c03b..260ab55db2 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -481,10 +481,10 @@ if SITE_NAME == 'PCM': count = int(y.group(3)) live.append((req.url, t.group(1), y.group(2), y.group(1), count)) except: - offline.append((req.url, t.group(1), y.group(2))) + offline.append((req.url.rstrip('/live'), t.group(1), y.group(2))) else: y = offline_regex.search(txt) - try: offline.append((req.url, y.group(2), y.group(1))) + try: offline.append((req.url.rstrip('/live'), y.group(2), y.group(1))) except: print(x) live = sorted(live, key=lambda x: x[4], reverse=True) From 512d90697048aebbdc24c1d180c366a6512b9ca1 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 22 Sep 2022 20:26:31 +0200 Subject: [PATCH 4/7] slow down the blinking --- files/assets/css/main.css | 2 +- files/templates/util/assetcache.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 767600d1dd..ba2eaeadc6 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -6266,7 +6266,7 @@ div.markdown { } .live-circle { - animation: blinker 1s infinite; + animation: blinker 4s infinite; } @keyframes blinker { diff --git a/files/templates/util/assetcache.html b/files/templates/util/assetcache.html index 3f56f1b214..baa50a0d03 100644 --- a/files/templates/util/assetcache.html +++ b/files/templates/util/assetcache.html @@ -1,6 +1,6 @@ {%- set CACHE_VER = { - 'css/main.css': 4034, + 'css/main.css': 4035, 'css/catalog.css': 4007, 'css/4chan.css': 4007, 'css/classic.css': 4031, From ce30fa40648f0752148c2577b107dc8a19edacc6 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 22 Sep 2022 20:30:51 +0200 Subject: [PATCH 5/7] add border-radius to streamer thumbnails --- files/templates/live.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/files/templates/live.html b/files/templates/live.html index 8baacd9a91..3ae15e7e73 100644 --- a/files/templates/live.html +++ b/files/templates/live.html @@ -9,6 +9,9 @@ tr:hover { border: 2.5px solid var(--primary); } + img.thumb { + border-radius: 4px; + }

Live

@@ -16,7 +19,7 @@ {% for link, thumb, name, title, viewers in live %} - {{name}} thumbnail + {{name}} thumbnail {{name}} {{title}} {{viewers}} @@ -32,7 +35,7 @@ {% for link, thumb, name in offline %} - {{name}} thumbnail + {{name}} thumbnail {{name}} From 40cd38d052515e20cac70e94d5c4ee97c6ba1c26 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 22 Sep 2022 20:35:25 +0200 Subject: [PATCH 6/7] add padding to /live --- files/templates/live.html | 60 ++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/files/templates/live.html b/files/templates/live.html index 3ae15e7e73..3578b37980 100644 --- a/files/templates/live.html +++ b/files/templates/live.html @@ -13,35 +13,37 @@ border-radius: 4px; } -

Live

-
- - - {% for link, thumb, name, title, viewers in live %} - - - - - - - {% endfor %} - -
{{name}} thumbnail{{name}}{{title}}{{viewers}}
-
+
+

Live

+
+ + + {% for link, thumb, name, title, viewers in live %} + + + + + + + {% endfor %} + +
{{name}} thumbnail{{name}}{{title}}{{viewers}}
+
-

Offline

-
- - - {% for link, thumb, name in offline %} - - - - - - - {% endfor %} - -
{{name}} thumbnail{{name}}
+

Offline

+
+ + + {% for link, thumb, name in offline %} + + + + + + + {% endfor %} + +
{{name}} thumbnail{{name}}
+
{% endblock %} \ No newline at end of file From 8a8a67a0591ff006899d8f8ee63dd6b28d759c89 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 22 Sep 2022 21:40:14 +0200 Subject: [PATCH 7/7] remove ban_evade logic --- files/classes/user.py | 15 +++++++++++---- files/helpers/awards.py | 1 - files/helpers/wrappers.py | 13 ++++--------- files/routes/admin.py | 6 ------ files/routes/awards.py | 1 - files/routes/login.py | 6 +----- schema.sql | 1 - 7 files changed, 16 insertions(+), 27 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 017725a9cf..e4232c4b02 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -128,7 +128,6 @@ class User(Base): is_nofollow = Column(Boolean, default=False) custom_filter_list = Column(String) discord_id = Column(String) - ban_evade = Column(Integer, default=0) original_username = Column(String) referred_by = Column(Integer, ForeignKey("users.id")) currently_held_lottery_tickets = Column(Integer, default=0) @@ -835,10 +834,18 @@ class User(Base): @property @lazy - def has_shadowbanned_alts(self): + def check_ban_evade(self): for u in self.alts_unique: - if u.shadowbanned or u.is_suspended_permanently: return True - return False + if u.shadowbanned: + self.shadowbanned = u.shadowbanned + g.db.add(self) + g.db.commit() + return + if u.is_suspended_permanently: + self.shadowbanned = u.banned_by.username + g.db.add(self) + g.db.commit() + return @property @lazy diff --git a/files/helpers/awards.py b/files/helpers/awards.py index 69fd9be78c..502da206f8 100644 --- a/files/helpers/awards.py +++ b/files/helpers/awards.py @@ -21,7 +21,6 @@ def award_timers(v, bot=False): if v.unban_utc and v.unban_utc < now: v.is_banned = 0 v.unban_utc = 0 - v.ban_evade = 0 v.ban_reason = None notify_if_not_bot("You have been unbanned!") if v.agendaposter and v.agendaposter != 1 and v.agendaposter < now: diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 8d9c32028d..d580a8a656 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -91,16 +91,11 @@ def get_logged_in_user(): return v -def check_ban_evade(v): - if v and not v.patron and v.admin_level < 2 and v.ban_evade and not v.unban_utc: - v.shadowbanned = "AutoJanny" - g.db.add(v) - def auth_desired(f): def wrapper(*args, **kwargs): v = get_logged_in_user() - check_ban_evade(v) + v.check_ban_evade() return make_response(f(*args, v=v, **kwargs)) @@ -120,7 +115,7 @@ def auth_desired_with_logingate(f): if not redir: redir = '/' return redirect(redir) - check_ban_evade(v) + v.check_ban_evade() return make_response(f(*args, v=v, **kwargs)) @@ -132,7 +127,7 @@ def auth_required(f): v = get_logged_in_user() if not v: abort(401) - check_ban_evade(v) + v.check_ban_evade() return make_response(f(*args, v=v, **kwargs)) @@ -147,7 +142,7 @@ def is_not_permabanned(f): if not v: abort(401) - check_ban_evade(v) + v.check_ban_evade() if v.is_suspended_permanently: return {"error": "Internal server error"}, 500 diff --git a/files/routes/admin.py b/files/routes/admin.py index 0d580e6e4f..a6ab7c6cc7 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -278,7 +278,6 @@ def revert_actions(v, username): for user in users: user.shadowbanned = None user.unban_utc = 0 - user.ban_evade = 0 user.ban_reason = None if user.is_banned: user.is_banned = 0 @@ -288,7 +287,6 @@ def revert_actions(v, username): for u in user.alts: u.shadowbanned = None u.unban_utc = 0 - u.ban_evade = 0 u.ban_reason = None if u.is_banned: u.is_banned = 0 @@ -931,11 +929,9 @@ def shadowban(user_id, v): def unshadowban(user_id, v): user = get_account(user_id) user.shadowbanned = None - user.ban_evade = 0 g.db.add(user) for alt in user.alts: alt.shadowbanned = None - alt.ban_evade = 0 g.db.add(alt) ma = ModAction( @@ -1058,7 +1054,6 @@ def unban_user(user_id, v): user.is_banned = 0 user.unban_utc = 0 - user.ban_evade = 0 user.ban_reason = None send_repeatable_notification(user.id, f"@{v.username} has unbanned you!") g.db.add(user) @@ -1067,7 +1062,6 @@ def unban_user(user_id, v): if x.is_banned: send_repeatable_notification(x.id, f"@{v.username} has unbanned you!") x.is_banned = 0 x.unban_utc = 0 - x.ban_evade = 0 x.ban_reason = None g.db.add(x) diff --git a/files/routes/awards.py b/files/routes/awards.py index e5eb14b212..df1490c436 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -232,7 +232,6 @@ def award_thing(v, thing_type, id): else: author.unban_utc = 0 author.is_banned = 0 - author.ban_evade = 0 author.ban_reason = None send_repeatable_notification(author.id, "You have been unbanned!") diff --git a/files/routes/login.py b/files/routes/login.py index 390895c598..5ca6aff5b2 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -333,7 +333,6 @@ def sign_up_post(v): password=request.values.get("password"), email=email, referred_by=ref_id or None, - ban_evade =int(any((x.is_banned or x.shadowbanned) and not x.unban_utc for x in g.db.query(User).filter(User.id.in_(session.get("history", []))).all() if x)), profileurl=profileurl ) @@ -357,10 +356,7 @@ def sign_up_post(v): check_for_alts(new_user.id) - if new_user.has_shadowbanned_alts: - new_user.shadowbanned = "AutoJanny" - g.db.add(new_user) - g.db.commit() + new_user.check_ban_evade() send_notification(new_user.id, WELCOME_MSG) diff --git a/schema.sql b/schema.sql index 2155b98054..756d08ce20 100644 --- a/schema.sql +++ b/schema.sql @@ -888,7 +888,6 @@ CREATE TABLE public.users ( custom_filter_list character varying(1000) DEFAULT ''::character varying, discord_id character varying(64), stored_subscriber_count integer DEFAULT 0 NOT NULL, - ban_evade integer DEFAULT 0 NOT NULL, original_username character varying(30), customtitle character varying(1000), defaultsorting character varying(15) DEFAULT 'hot'::character varying NOT NULL,