From ec96d0d685ac9f49088155b76cda060ce48c5f48 Mon Sep 17 00:00:00 2001 From: Yo Mama Date: Sun, 19 Sep 2021 15:50:20 +0200 Subject: [PATCH 1/9] Only 'jumps' if comment above the top. Also decreases offset at the top --- files/templates/default.html | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/files/templates/default.html b/files/templates/default.html index 3a9ef1f99..5fc9eb789 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) } }; From b03f2066ee5e6591fbe34497b6f933d8a3740c03 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 21 Sep 2021 21:06:02 +0200 Subject: [PATCH 2/9] fdsfs --- files/__main__.py | 4 ++-- files/routes/posts.py | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/files/__main__.py b/files/__main__.py index b4cd5a8bc..aa2845651 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/routes/posts.py b/files/routes/posts.py index bc513325e..438794b1a 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -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] From ababa1172152c84058244bf870e2791287c15a7c Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 21 Sep 2021 21:07:12 +0200 Subject: [PATCH 3/9] fdsfsd --- files/classes/mod_logs.py | 4 ++-- files/routes/posts.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index 94e17dc05..c0206efd7 100644 --- a/files/classes/mod_logs.py +++ b/files/classes/mod_logs.py @@ -220,12 +220,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/routes/posts.py b/files/routes/posts.py index 438794b1a..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/") From b22200539135879ef593af897b35e27f10b356b8 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 21 Sep 2021 21:18:16 +0200 Subject: [PATCH 4/9] fsdfsd --- files/classes/badges.py | 2 +- files/routes/admin.py | 5 +++-- files/routes/settings.py | 8 +------- files/templates/header.html | 4 ++-- files/templates/patrons.html | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) 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/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/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/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() %} From 80d605ce9d35fcfb84941581bed73451382c57a5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 21 Sep 2021 21:19:25 +0200 Subject: [PATCH 5/9] fdsfs --- files/templates/submission_listing.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 %} From d6406635f51ace7b45f703f8e30ffb2654e8e859 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 21 Sep 2021 21:20:39 +0200 Subject: [PATCH 6/9] fddf --- files/templates/submit.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/submit.html b/files/templates/submit.html index 86d3eebd9..220019301 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -308,7 +308,7 @@

Create a post

-

Create a post

+

Create a post

From 4ff8065202c3ba2e72e0515b5faf418214f753db Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 21 Sep 2021 21:25:26 +0200 Subject: [PATCH 7/9] fdsfsf --- files/helpers/const.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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 ", From df39f55bae5ede13d5a500a228cd16ac0203d990 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 21 Sep 2021 21:31:45 +0200 Subject: [PATCH 8/9] fdsf --- files/routes/static.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) 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 From b161576ae80036be5203ad8604c59ea3de80f9b0 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 21 Sep 2021 21:33:17 +0200 Subject: [PATCH 9/9] fds --- files/classes/mod_logs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index c0206efd7..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}',