From 0c5435e04f7a738e8bd89534039f979a078625ae Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 18 Mar 2022 20:31:24 +0200 Subject: [PATCH] sfd --- files/helpers/const.py | 13 +++---------- files/routes/comments.py | 10 ---------- files/routes/login.py | 4 +++- files/routes/posts.py | 8 +++----- files/templates/home.html | 2 +- 5 files changed, 10 insertions(+), 27 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 981633646..9e438c9e1 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -76,6 +76,7 @@ SLURS = { "sheeny": "Israeli friend", "sheenies": "Israeli friends", "hymie": "Israeli friend", + "god": "Allah (SWT)", "allah": "Allah (SWT)", "mohammad": "Prophet Mohammad (PBUH)", "muhammad": "Prophet Mohammad (PBUH)", @@ -83,7 +84,6 @@ SLURS = { "dancing israelis": "i love Israel", "sodomite": "total dreamboat", "pajeet": "sexy Indian dude", - "female": "bleeder", "landlord": "landchad", "tenant": "renthog", "renter": "rentoid", @@ -131,8 +131,6 @@ if SITE in {'rdrama.net','devrama.xyz'}: GIFT_NOTIF_ID = 995 PIZZASHILL_ID = 2424 PIZZASHILLSHILL_ID = 9712 - HIL_ID = 4245 - CRAT_ID = 747 IDIO_ID = 30 CARP_ID = 995 JOAN_ID = 28 @@ -163,8 +161,6 @@ elif SITE == "pcmemes.net": PIZZASHILL_ID = 0 PIZZASHILLSHILL_ID = 0 GIFT_NOTIF_ID = 1592 - HIL_ID = 0 - CRAT_ID = 0 IDIO_ID = 0 CARP_ID = 0 JOAN_ID = 0 @@ -195,8 +191,6 @@ else: GIFT_NOTIF_ID = 9 PIZZASHILL_ID = 0 PIZZASHILLSHILL_ID = 0 - HIL_ID = 0 - CRAT_ID = 0 IDIO_ID = 0 CARP_ID = 0 JOAN_ID = 0 @@ -716,9 +710,8 @@ def censor_slurs(body, logged_user): return body def torture_ap(body, username): - body = slur_regex_upper.sub(sub_matcher_upper, body) - body = slur_regex.sub(sub_matcher, body) - for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l) + for k, l in AJ_REPLACEMENTS.items(): + body = body.replace(k, l) body = torture_regex.sub(rf'\1@{username} ', body) body = torture_regex2.sub(rf'\1@{username} is ', body) return body diff --git a/files/routes/comments.py b/files/routes/comments.py index 9b4b605d0..0d064695f 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -659,8 +659,6 @@ def api_comment(v): 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=CRAT_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) v.coins += 3 @@ -668,14 +666,6 @@ def api_comment(v): g.db.add(v) c.upvotes += 3 g.db.add(c) - elif v.id == HIL_ID: - autovote = CommentVote(user_id=CARP_ID, comment_id=c.id, vote_type=1) - g.db.add(autovote) - v.coins += 1 - v.truecoins += 1 - g.db.add(v) - c.upvotes += 1 - g.db.add(c) if not v.rehab: check_for_slots_command(body, v, c) diff --git a/files/routes/login.py b/files/routes/login.py index 0daa4f0a5..bd1acb9d3 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -531,7 +531,9 @@ def request_2fa_disable(): def reset_2fa(): now=int(time.time()) - t=int(request.values.get("t")) + t = request.values.get("t") + if not t: abort(400) + t = int(t) if now > t+3600*24: return render_template("message.html", diff --git a/files/routes/posts.py b/files/routes/posts.py index fcc2ac1be..162e95761 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -569,7 +569,7 @@ def edit_post(pid, v): def archiveorg(url): try: requests.get(f'https://web.archive.org/save/{url}', headers={'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'}, timeout=100) - except Exception as e: print(e) + except: pass def thumbnail_thread(pid): @@ -881,7 +881,7 @@ def submit_post(v, sub=None): Submission.url.ilike(search_url), Submission.deleted_utc == 0, Submission.is_banned == False - ).one_or_none() + ).first() if repost: return redirect(repost.permalink) @@ -1286,13 +1286,11 @@ def submit_post(v, sub=None): send_discord_message(post.permalink) cache.delete_memoized(changeloglist) - if v.id in {PIZZASHILL_ID, HIL_ID}: + 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=CRAT_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) v.coins += 3 diff --git a/files/templates/home.html b/files/templates/home.html index 36b01af64..2361713be 100644 --- a/files/templates/home.html +++ b/files/templates/home.html @@ -34,7 +34,7 @@
{% if v %} -
+
{% if sub %} {% if v.subs == 1 %} Subscribe to /h/{{sub.name}}