diff --git a/files/classes/award.py b/files/classes/award.py index 95b0ad20a7..c1de3fe0ff 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): diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index a3558b8a74..6be3262ec2 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -172,22 +172,26 @@ 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/") - - for i in re.finditer('(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}' htmlsource = f'' sanitized = sanitized.replace(replacing, htmlsource) - sanitized = sanitized.replace("https://mobile.twitter.com", "https://twitter.com") - 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/") 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) diff --git a/files/routes/settings.py b/files/routes/settings.py index c5b36f6711..df2b0de477 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") diff --git a/files/routes/static.py b/files/routes/static.py index 894c1af9a6..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 = [x for x in 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") 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" %}