diff --git a/files/__main__.py b/files/__main__.py index 8201be3f1..53f939843 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -19,8 +19,8 @@ app = Flask(__name__, template_folder='./templates') app.wsgi_app = ProxyFix(app.wsgi_app, x_for=3) app.url_map.strict_slashes = False app.jinja_env.cache = {} -# import faulthandler -# faulthandler.enable() +import faulthandler +faulthandler.enable() app.config["SITE_NAME"]=environ.get("SITE_NAME").strip() app.config["COINS_NAME"]=environ.get("COINS_NAME").strip() diff --git a/files/classes/badges.py b/files/classes/badges.py index 4af64c338..22ef03531 100644 --- a/files/classes/badges.py +++ b/files/classes/badges.py @@ -25,7 +25,7 @@ class BadgeDef(Base): @lazy def path(self): - return f"/assets/images/{site_name}/badges/{self.icon}" + return f"/assets/images/badges/{self.icon}" @property @lazy diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index 94e17dc05..98a434d43 100644 --- a/files/classes/mod_logs.py +++ b/files/classes/mod_logs.py @@ -174,10 +174,12 @@ ACTIONTYPES={ "set_flair_locked":{ "str":"set {self.target_link}'s flair (locked)", "icon": "fa-user-slash", + "color": "bg-muted", }, "set_flair_notlocked":{ "str":"set {self.target_link}'s flair (not locked)", "icon": "fa-user-slash", + "color": "bg-muted", }, "pin_comment":{ "str":'pinned a {self.target_link}', @@ -220,12 +222,12 @@ ACTIONTYPES={ "color": "bg-muted", }, "club":{ - "str": 'marked post {self.target_link} as viewable to users with +150 coins only', + "str": 'marked post {self.target_link} as club-only', "icon":"fa-eye-slash", "color": "bg-danger", }, "unclub":{ - "str": 'unmarked post {self.target_link} as viewable to users with +150 coins only', + "str": 'unmarked post {self.target_link} as club-only', "icon":"fa-eye", "color": "bg-muted", }, diff --git a/files/helpers/const.py b/files/helpers/const.py index a6941ee1b..2c0fb80a1 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -17,6 +17,9 @@ SLURS = { " pedo":" libertarian", " Pedo":" Libertarian ", " PEDO":" LIBERTARIAN ", + " libertarian":" pedo", + " Libertarian":" Pedo ", + " LIBERTARIAN":" PEDO ", " rapist":" male feminist", " Rapist":" Male feminist", " RAPIST":" MALE FEMINIST", @@ -49,8 +52,11 @@ SLURS = { "Nigger ":"🏀 ", "NIGGER ":"🏀 ", "pedo ":"libertarian ", - "Pedo ":"Libertarian ", - "PEDO ":"LIBERTARIAN ", + "Pedo ":"Libertarian ", + "PEDO ":"LIBERTARIAN ", + "libertarian ":"pedo ", + "Libertarian ":"Pedo ", + "LIBERTARIAN ":"PEDO ", "rapist ":"male feminist ", "Rapist ":"Male feminist ", "RAPIST ":"MALE FEMINIST ", diff --git a/files/routes/admin.py b/files/routes/admin.py index 7db305391..80285cc07 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -184,7 +184,7 @@ def monthly(v): grant_awards["shit"] = 10 grant_awards["fireflies"] = 10 grant_awards["ban"] = 3 - elif u.patron == 5 or u.patron == 8: + elif u.patron == 5: grant_awards["shit"] = 20 grant_awards["fireflies"] = 20 grant_awards["ban"] = 6 @@ -402,7 +402,8 @@ def badge_grant_post(v): if badge_id == 16 and user.has_badge(17): g.db.query(Badge).options(lazyload('*')).filter_by(badge_id=17, user_id=user.id).delete() - elif badge_id in [21,22,23,24,28]: + elif badge_id in [21,22,23,24,25,28]: + if badge_id == 28: badge_id = 25 user.patron = int(str(badge_id)[-1]) grant_awards = {} diff --git a/files/routes/posts.py b/files/routes/posts.py index bc513325e..c178481a9 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -48,8 +48,8 @@ def toggle_club(pid, v): g.db.commit() - if post.club: return {"message": "Post has been marked as +150-coins only!"} - else: return {"message": "Post has been unmarked as +150-coins only!"} + if post.club: return {"message": "Post has been marked as club-only!"} + else: return {"message": "Post has been unmarked as club-only!"} @app.post("/publish/") @@ -698,14 +698,13 @@ def submit_post(v): except: embed = None elif "youtu" in domain: - try: yt_id = re.match(re.compile("^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|shorts\/|\&v=)([^#\&\?]*).*"), url).group(2) - except: embed = None - if not yt_id or len(yt_id) != 11: embed = None - else: + try: + yt_id = re.match(re.compile("^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|shorts\/|\&v=)([^#\&\?]*).*"), url).group(2) params = parse_qs(urlparse(url).query) t = params.get('t', params.get('start', [0]))[0] if t: embed = f"https://youtube.com/embed/{yt_id}?start={t}" else: embed = f"https://youtube.com/embed/{yt_id}" + except: embed = None elif app.config['SERVER_NAME'] in domain and "/post/" in url and "context" not in url: id = url.split("/post/")[1] diff --git a/files/routes/settings.py b/files/routes/settings.py index 5d382da30..85bbf937c 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -26,11 +26,6 @@ tiers={ "(Landchad)": 3, "(Terminally online turboautist)": 4, "(Footpig)": 5, - "(Chad)": 1, - "(Megachad)": 2, - "(Gigachad)": 3, - "(Terachad)": 4, - "(Petachad)": 5 } @app.post("/settings/removebackground") @@ -307,8 +302,7 @@ def gumroad(v): response = response[0] tier = tiers[response["variants_and_quantity"]] - if v.patron == tier: - return {"error": f"{patron} rewards already claimed"}, 400 + if v.patron == tier: return {"error": f"{patron} rewards already claimed"}, 400 v.patron = tier g.db.add(v) diff --git a/files/routes/static.py b/files/routes/static.py index 246c6c7b3..1932497e4 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -94,21 +94,16 @@ def admins(v): @app.get("/log") @auth_desired def log(v): - return render_template("modlog.html", v=v) -# @app.get("/log") -# @auth_desired -# def log(v): + page=int(request.args.get("page",1)) -# page=int(request.args.get("page",1)) + if v and v.admin_level == 6: actions = g.db.query(ModAction).order_by(ModAction.id.desc()).offset(25 * (page - 1)).limit(26).all() + else: actions=g.db.query(ModAction).filter(ModAction.kind!="shadowban", ModAction.kind!="unshadowban", ModAction.kind!="club", ModAction.kind!="unclub").order_by(ModAction.id.desc()).offset(25*(page-1)).limit(26).all() -# if v and v.admin_level == 6: actions = g.db.query(ModAction).order_by(ModAction.id.desc()).offset(25 * (page - 1)).limit(26).all() -# else: actions=g.db.query(ModAction).filter(ModAction.kind!="shadowban", ModAction.kind!="unshadowban", ModAction.kind!="club", ModAction.kind!="unclub").order_by(ModAction.id.desc()).offset(25*(page-1)).limit(26).all() + next_exists=len(actions)==26 + actions=actions[:25] -# next_exists=len(actions)==26 -# actions=actions[:25] - -# return render_template("log.html", v=v, actions=actions, next_exists=next_exists, page=page) + return render_template("log.html", v=v, actions=actions, next_exists=next_exists, page=page) @app.get("/log/") @auth_desired diff --git a/files/templates/default.html b/files/templates/default.html index 1889cef82..5ed013fa9 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -81,17 +81,14 @@ // Toggle comment collapse function collapse_comment(comment_id) { - - const OFFSET = window.innerHeight / 3 - - const comment = "comment-" + comment_id; + const comment = "comment-" + comment_id const element = document.getElementById(comment) - const closed = element.classList.toggle("collapsed"); + const closed = element.classList.toggle("collapsed") const top = element.getBoundingClientRect().y - if (closed && top < OFFSET) { + if (closed && top < 0) { element.scrollIntoView() - window.scrollBy(0, - OFFSET) + window.scrollBy(0, - 100) } }; diff --git a/files/templates/header.html b/files/templates/header.html index 660950eb5..0c2c3e179 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -124,7 +124,7 @@ Changelog Source code Discord - Donate + {% if 'pcm' not in request.host %}Donate{% endif %} {% if 'rdrama' in request.host %}Subreddit archives{% endif %} Contact us @@ -185,7 +185,7 @@ - + {% if 'pcm' not in request.host %}{% endif %} {% if 'rdrama' in request.host %}{% endif %} diff --git a/files/templates/patrons.html b/files/templates/patrons.html index b87c23d58..d6c1b5d57 100644 --- a/files/templates/patrons.html +++ b/files/templates/patrons.html @@ -15,7 +15,7 @@ {{loop.index}} {{row['username']}} - + {% for (a,count) in row['awards'].values() %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 66e3b7314..c3f4d80cf 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -413,17 +413,17 @@ {% endif %} {% if p.is_video %} -
+
{% elif p.embed_url and "youtu" in p.domain %} -
+
{% elif p.url and "streamable.com/e/" in p.url %} -
+
{% endif %} diff --git a/files/templates/submit.html b/files/templates/submit.html index 5e8738098..3a06e87f8 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -308,7 +308,7 @@

Create a post

-

Create a post

+

Create a post