From d3354b757205cf2dfa211b400d1851f34f902def Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 20:25:50 +0200 Subject: [PATCH 01/11] fdfd --- files/classes/award.py | 44 ++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/files/classes/award.py b/files/classes/award.py index 95b0ad20a7..7ae073b0f7 100644 --- a/files/classes/award.py +++ b/files/classes/award.py @@ -1,23 +1,37 @@ from sqlalchemy import * from sqlalchemy.orm import relationship from files.__main__ import Base +from os import environ -AWARDS = { - "ban": { - "kind": "ban", - "title": "One-Day Ban", - "description": "Ban the author for a day.", - "icon": "fas fa-gavel", - "color": "text-danger" - }, - "shit": { - "kind": "shit", - "title": "Shitpost", - "description": "Let OP know how much their post sucks ass. Flies will swarm their idiotic post. (flies only work on posts lol!!)", - "icon": "fas fa-poop", - "color": "text-black-50" +site_name = environ.get("SITE_NAME").strip() + +if site_name = "Drama": + AWARDS = { + "ban": { + "kind": "ban", + "title": "One-Day Ban", + "description": "Ban the author for a day.", + "icon": "fas fa-gavel", + "color": "text-danger" + }, + "shit": { + "kind": "shit", + "title": "Shitpost", + "description": "Let OP know how much their post sucks ass. Flies will swarm their idiotic post. (flies only work on posts lol!!)", + "icon": "fas fa-poop", + "color": "text-black-50" + } + } +else: + AWARDS = { + "shit": { + "kind": "shit", + "title": "Shitpost", + "description": "Let OP know how much their post sucks ass. Flies will swarm their idiotic post. (flies only work on posts lol!!)", + "icon": "fas fa-poop", + "color": "text-black-50" + } } -} class AwardRelationship(Base): From 9d50f0f1f2fa1e5bd16a161c6185a71b499998ca Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 20:26:19 +0200 Subject: [PATCH 02/11] gfgf --- files/classes/award.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/classes/award.py b/files/classes/award.py index 7ae073b0f7..c1de3fe0ff 100644 --- a/files/classes/award.py +++ b/files/classes/award.py @@ -5,7 +5,7 @@ from os import environ site_name = environ.get("SITE_NAME").strip() -if site_name = "Drama": +if site_name == "Drama": AWARDS = { "ban": { "kind": "ban", From 609cbca802f8e40cdeabacca041b1ab6f4dcf494 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 20:38:01 +0200 Subject: [PATCH 03/11] fddf --- files/templates/default.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/default.html b/files/templates/default.html index aea227094f..8c907e89db 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -1034,7 +1034,7 @@ - + {% include "header.html" %} From 1adc1c3cdbd02b71d42468c55abb6a7ea9b43fd8 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 20:43:20 +0200 Subject: [PATCH 04/11] fdfd --- files/routes/settings.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/routes/settings.py b/files/routes/settings.py index 5342b7a7d7..bbcecef2cd 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -24,7 +24,11 @@ tiers={ "(Paypig)": 1, "(Renthog)": 2, "(Landchad)": 3, - "(Terminally online turboautist)": 4 + "(Terminally online turboautist)": 4, + "(Ape)": 1, + "(Monke)": 2, + "(Gigachad)": 3, + "(Ascended Griller)": 4 } @app.post("/settings/removebackground") From 75850e8c186df2cf5447cfd06b37728fc88efeb1 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 21:11:43 +0200 Subject: [PATCH 05/11] fddf --- files/routes/static.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/static.py b/files/routes/static.py index 894c1af9a6..2509e2b70c 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -44,7 +44,7 @@ def participation_stats(v): @auth_desired def patrons(v): if v and v.is_banned and not v.unban_utc: return render_template("seized.html") - users = [x for x in g.db.query(User).filter(User.patron > 0).order_by(User.patron.desc()).all()] + users = g.db.query(User).filter(User.patron > 0).order_by(User.patron.desc()).all() return render_template("patrons.html", v=v, users=users) @app.get("/admins") From 521e9e38bd033a523e95e6101a5b2838ceb844a5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 21:13:08 +0200 Subject: [PATCH 06/11] fdfd --- files/routes/static.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/static.py b/files/routes/static.py index 2509e2b70c..d85635ade4 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -44,7 +44,7 @@ def participation_stats(v): @auth_desired def patrons(v): if v and v.is_banned and not v.unban_utc: return render_template("seized.html") - users = g.db.query(User).filter(User.patron > 0).order_by(User.patron.desc()).all() + users = g.db.query(User).options(lazyload('*')).filter(User.patron > 0).order_by(User.patron.desc()).all() return render_template("patrons.html", v=v, users=users) @app.get("/admins") From 60d4b3a356f65e2b3ece42a5298efc434733c2b9 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 21:33:06 +0200 Subject: [PATCH 07/11] fdfd --- files/routes/posts.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/routes/posts.py b/files/routes/posts.py index 811c407fd4..257917a20b 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -884,6 +884,9 @@ def submit_post(v): g.db.add(c) g.db.flush() + new_post.comment_count = g.db.query(Comment).filter_by(parent_submission=new_post.id).count() + g.db.add(new_post) + if "rdrama" in request.host: if v.id == 995: body = "fuck off carp" else: body = random.choice(snappyquotes) From e38417dd9a4542bc6876b32f4e4f7ceb2dab943a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 21:51:19 +0200 Subject: [PATCH 08/11] gfgf --- files/helpers/sanitize.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index a3558b8a74..6e9fb73fdb 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -172,14 +172,27 @@ def sanitize(sanitized): if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.gif'): sanitized = sanitized.replace(f':{i.group(1)}:', f'') - sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/embed/").replace("https://music.youtube.com/watch?v=", "https://youtube.com/embed/").replace("/watch?v=", "/embed/").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/embed/") + sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=") - for i in re.finditer('https://youtube.com/watch?v=' in sanitized: + sanitized = sanitized.replace("watch?v=", "embed/") + url = re.search('(https://youtube.com/embed/.*?)"', sanitized).group(1) + replacing = f'

{url}

' + htmlsource = f'
' + sanitized = sanitized.replace(replacing, htmlsource) + + for i in re.finditer('" target="_blank">(https://youtube.com/watch\?v\=.*?)', sanitized): + url = i.group(1) + replacing = f'{url}' + htmlsource = f'
' + sanitized = sanitized.replace(replacing, htmlsource.replace("watch?v=", "embed/")) + + for i in re.finditer('{url}' htmlsource = f'
' sanitized = sanitized.replace(replacing, htmlsource) - + for i in re.finditer('{url}' From 857ea84016d1e28203f7e0003964967f0b5cf9a6 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 21:51:43 +0200 Subject: [PATCH 09/11] dffd --- files/helpers/sanitize.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 6e9fb73fdb..f95e338c50 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -173,13 +173,6 @@ def sanitize(sanitized): sanitized = sanitized.replace(f':{i.group(1)}:', f'') sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=") - - if '" rel="nofollow noopener" target="_blank">https://youtube.com/watch?v=' in sanitized: - sanitized = sanitized.replace("watch?v=", "embed/") - url = re.search('(https://youtube.com/embed/.*?)"', sanitized).group(1) - replacing = f'

{url}

' - htmlsource = f'
' - sanitized = sanitized.replace(replacing, htmlsource) for i in re.finditer('" target="_blank">(https://youtube.com/watch\?v\=.*?)', sanitized): url = i.group(1) From ce2e91c24140e3859f69621a1810bb8f3117d86f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 21:51:59 +0200 Subject: [PATCH 10/11] fdfd --- files/helpers/sanitize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index f95e338c50..383bbf8964 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -192,7 +192,7 @@ def sanitize(sanitized): htmlsource = f'' sanitized = sanitized.replace(replacing, htmlsource) - sanitized = sanitized.replace("https://mobile.twitter.com", "https://twitter.com") + sanitized = sanitized.replace("https://mobile.", "https://").replace("https://m.", "https://") for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]: sanitized = sanitized.replace(rd, "https://old.reddit.com/") From 260c3dab82f44a96892d732c5358056b3d2652ca Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 22 Aug 2021 21:53:32 +0200 Subject: [PATCH 11/11] gfgf --- files/helpers/sanitize.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 383bbf8964..6be3262ec2 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -172,7 +172,7 @@ def sanitize(sanitized): if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.gif'): sanitized = sanitized.replace(f':{i.group(1)}:', f'') - sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=") + sanitized = sanitized.replace("https://www.", "https://").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://open.spotify.com/", "https://open.spotify.com/embed/").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.", "https://").replace("https://m.", "https://") for i in re.finditer('" target="_blank">(https://youtube.com/watch\?v\=.*?)', sanitized): url = i.group(1) @@ -192,8 +192,6 @@ def sanitize(sanitized): htmlsource = f'' sanitized = sanitized.replace(replacing, htmlsource) - sanitized = sanitized.replace("https://mobile.", "https://").replace("https://m.", "https://") - for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]: sanitized = sanitized.replace(rd, "https://old.reddit.com/")