From bf39fe4f816c769171ae3c41006404ed2fb02c9d Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 19:53:34 +0200 Subject: [PATCH 02/25] fsdfsd --- files/templates/emoji_modal.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/emoji_modal.html b/files/templates/emoji_modal.html index 8d0f9c9302..b0a70c8eba 100644 --- a/files/templates/emoji_modal.html +++ b/files/templates/emoji_modal.html @@ -84,7 +84,7 @@ - + - + {% endif %} {% endblock %} diff --git a/redis.conf b/redis.conf index 7c4de0e43d..32dd36978b 100644 --- a/redis.conf +++ b/redis.conf @@ -694,7 +694,7 @@ replica-lazy-flush no # If the AOF is enabled on startup Redis will load the AOF, that is the file # with the better durability guarantees. # -# Please check http://redis.io/topics/persistence for more information. +# Please check https://redis.io/topics/persistence for more information. appendonly no @@ -721,7 +721,7 @@ appendfilename "appendonly.aof" # everysec. # # More details please check the following article: -# http://antirez.com/post/redis-persistence-demystified.html +# https://antirez.com/post/redis-persistence-demystified.html # # If unsure, use "everysec". @@ -933,7 +933,7 @@ lua-time-limit 5000 # cluster-replica-no-failover no # In order to setup your cluster make sure to read the documentation -# available at http://redis.io web site. +# available at https://redis.io web site. ########################## CLUSTER DOCKER/NAT support ######################## @@ -1016,7 +1016,7 @@ latency-monitor-threshold 0 ############################# EVENT NOTIFICATION ############################## # Redis can notify Pub/Sub clients about events happening in the key space. -# This feature is documented at http://redis.io/topics/notifications +# This feature is documented at https://redis.io/topics/notifications # # For instance if keyspace events notification is enabled, and a client # performs a DEL operation on key "foo" stored in the Database 0, two From cd8902a6dff5c32319130811b34ca3747a195b04 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 21:54:28 +0200 Subject: [PATCH 16/25] fdsfsd --- files/templates/submission.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/submission.html b/files/templates/submission.html index f33b37d760..42f5c565ef 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -834,7 +834,7 @@ xhr.withCredentials=true; xhr.onload=function(){ if (xhr.status==200) { - document.getElementById("viewmore").innerHTML = xhr.response; + document.getElementById("viewmore").innerHTML = xhr.response.replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, ''); } } xhr.send(form) From 1ee8f25d1b0ff7073a1ff3a80f8a42d5eb704386 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 21:55:13 +0200 Subject: [PATCH 17/25] fdsfsd --- files/templates/default.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/templates/default.html b/files/templates/default.html index fa20c2438c..249361098e 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -355,8 +355,8 @@ {% endif %} - - + + From 19dc3ae9ee36f7a7fbbeac5d5b2847e6362af8ff Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 21:56:30 +0200 Subject: [PATCH 18/25] sfdfsd --- files/helpers/const.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/files/helpers/const.py b/files/helpers/const.py index 7dbfff1c33..ae4b809901 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -148,6 +148,7 @@ if SITE == 'rdrama.net': LLM_ID = 253 DAD_ID = 2513 MOM_ID = 4588 + BUG_THREAD = 18459 elif SITE == "pcmemes.net": BASEDBOT_ID = 800 KIPPY_ID = 1592 @@ -168,6 +169,7 @@ elif SITE == "pcmemes.net": LLM_ID = 0 DAD_ID = 0 MOM_ID = 0 + BUG_THREAD = 4103 else: BASEDBOT_ID = 0 KIPPY_ID = 0 @@ -188,6 +190,7 @@ else: LLM_ID = 0 DAD_ID = 0 MOM_ID = 0 + BUG_THREAD = 0 PUSHER_INSTANCE_ID = '02ddcc80-b8db-42be-9022-44c546b4dce6' PUSHER_KEY = environ.get("PUSHER_KEY", "").strip() From 18e8137239518341f00297802461abee010914ea Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 20:18:23 +0000 Subject: [PATCH 19/25] fddf --- schema.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schema.sql b/schema.sql index f81ec4720e..523fb2b11b 100644 --- a/schema.sql +++ b/schema.sql @@ -585,7 +585,8 @@ CREATE TABLE public.submissions ( embed_url character varying(1500), ban_reason character varying(25), title_html character varying(1500), - realupvotes integer + realupvotes integer, + flair character varying(350) ); @@ -1711,7 +1712,6 @@ ALTER TABLE ONLY public.flags ALTER TABLE ONLY public.notifications ADD CONSTRAINT notifications_comment_id_fkey FOREIGN KEY (comment_id) REFERENCES public.comments(id); - -- -- PostgreSQL database dump complete -- From 6bdbd8117e1562e7eb5f70548854ffeb518b6b99 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 22:22:57 +0200 Subject: [PATCH 20/25] fdsdsf --- files/classes/submission.py | 1 + files/routes/reporting.py | 33 ++++++++++++------------- files/templates/comments.html | 2 +- files/templates/report_post_modal.html | 2 +- files/templates/submission.html | 8 +++--- files/templates/submission_listing.html | 3 ++- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index 54af7298ff..8932fa57a1 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -50,6 +50,7 @@ class Submission(Base): url = Column(String) body = Column(String) body_html = Column(String) + flair = Column(String) ban_reason = Column(String) embed_url = Column(String) diff --git a/files/routes/reporting.py b/files/routes/reporting.py index f0b24c48c8..f38a840222 100644 --- a/files/routes/reporting.py +++ b/files/routes/reporting.py @@ -4,48 +4,47 @@ from flask import g from files.__main__ import app, limiter from os import path -@app.post("/flag/post/") +@app.post("/report/post/") @limiter.limit("1/second") -@auth_desired +@auth_required def api_flag_post(pid, v): post = get_post(pid) - if v and not v.shadowbanned: - existing = g.db.query(Flag.id).filter_by(user_id=v.id, post_id=post.id).first() - - if existing: return "", 409 - + if not v.shadowbanned: reason = request.values.get("reason", "").strip()[:100] if "<" in reason: return {"error": f"Reasons can't contain <"} + if not reason.startswith('!'): + existing = g.db.query(Flag.id).filter_by(user_id=v.id, post_id=post.id).first() + if existing: return "", 409 + for i in re.finditer(':(.{1,30}?):', reason): if path.isfile(f'./files/assets/images/emojis/{i.group(1)}.webp'): reason = reason.replace(f':{i.group(1)}:', f':{i.group(1)}:') if len(reason) > 350: return {"error": f"Too long."} - flag = Flag(post_id=post.id, - user_id=v.id, - reason=reason, - ) - - - g.db.add(flag) + if reason.startswith('!') and v.admin_level > 1: + post.flair = reason[1:] + g.db.add(post) + else: + flag = Flag(post_id=post.id, user_id=v.id, reason=reason) + g.db.add(flag) g.db.commit() return {"message": "Post reported!"} -@app.post("/flag/comment/") +@app.post("/report/comment/") @limiter.limit("1/second") -@auth_desired +@auth_required def api_flag_comment(cid, v): comment = get_comment(cid) - if v and not v.shadowbanned: + if not v.shadowbanned: existing = g.db.query(CommentFlag.id).filter_by( user_id=v.id, comment_id=comment.id).first() diff --git a/files/templates/comments.html b/files/templates/comments.html index 5e5964f260..a209560b61 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -749,7 +749,7 @@ {% if v %} - + {% endif %} diff --git a/files/templates/report_post_modal.html b/files/templates/report_post_modal.html index 33ed1350c3..210208cc34 100644 --- a/files/templates/report_post_modal.html +++ b/files/templates/report_post_modal.html @@ -32,4 +32,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/files/templates/submission.html b/files/templates/submission.html index 42f5c565ef..db23838403 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -401,12 +401,14 @@ {% endif %} {% if p.realurl(v) %}

- {% if p.club %}{{cc}}{% endif %} + {% if p.club %}{{cc}}{% endif %} + {% if p.flair %}{{p.flair}}{% endif %} {{p.realtitle(v) | safe}}

{% else %}

- {% if p.club %}{{cc}}{% endif %} + {% if p.club %}{{cc}}{% endif %} + {% if p.flair %}{{p.flair}}{% endif %} {{p.realtitle(v) | safe}}

{% endif %} @@ -902,7 +904,7 @@ {% if not p.comment_count %} {% if v %} - + {% include "award_modal.html" %} {% include "emoji_modal.html" %} {% include "gif_modal.html" %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 1601196397..e9bfb1863d 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -198,7 +198,8 @@
- {% if p.club %}{{cc}}{% endif %} + {% if p.club %}{{cc}}{% endif %} + {% if p.flair %}{{p.flair}}{% endif %} {{p.realtitle(v) | safe}}
From 259cb7a5422b6fc19b9921bb76648675d1b4a1ea Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 22:48:27 +0200 Subject: [PATCH 21/25] sfdfsd --- files/templates/submission.html | 4 ++-- files/templates/submission_listing.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/templates/submission.html b/files/templates/submission.html index db23838403..920ac08675 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -402,13 +402,13 @@ {% if p.realurl(v) %}

{% if p.club %}{{cc}}{% endif %} - {% if p.flair %}{{p.flair}}{% endif %} + {% if p.flair %}{{p.flair | safe}}{% endif %} {{p.realtitle(v) | safe}}

{% else %}

{% if p.club %}{{cc}}{% endif %} - {% if p.flair %}{{p.flair}}{% endif %} + {% if p.flair %}{{p.flair | safe}}{% endif %} {{p.realtitle(v) | safe}}

{% endif %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index e9bfb1863d..5dbf97c350 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -199,7 +199,7 @@
{% if p.club %}{{cc}}{% endif %} - {% if p.flair %}{{p.flair}}{% endif %} + {% if p.flair %}{{p.flair | safe}}{% endif %} {{p.realtitle(v) | safe}}
From 7360fa747534854430964b136c8e37da0ea0e185 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 23:26:23 +0200 Subject: [PATCH 22/25] fsdfsd --- files/templates/submission.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/files/templates/submission.html b/files/templates/submission.html index 920ac08675..d8e94c917b 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -837,6 +837,20 @@ xhr.onload=function(){ if (xhr.status==200) { document.getElementById("viewmore").innerHTML = xhr.response.replace(/data-src/g, 'src').replace(/data-cfsrc/g, 'src').replace(/style="display:none;visibility:hidden;"/g, ''); + var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); + tooltipTriggerList.map(function(element){ + return new bootstrap.Tooltip(element); + }); + + const popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]')); + const popoverList = popoverTriggerList.map(function(popoverTriggerEl) { + const popoverId = popoverTriggerEl.getAttribute('data-content-id'); + const contentEl = document.getElementById(popoverId).innerHTML; + return new bootstrap.Popover(popoverTriggerEl, { + content: contentEl, + html: true, + }); + }) } } xhr.send(form) From 99d6ec18f81d43320a6d18538f46749665a8cb0f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 5 Dec 2021 23:59:39 +0200 Subject: [PATCH 23/25] idk --- files/templates/authforms.html | 6 +++--- files/templates/comments.html | 4 ++-- files/templates/default.html | 8 ++++---- files/templates/email/default.html | 2 +- files/templates/home.html | 2 +- files/templates/log.html | 6 +++--- files/templates/login.html | 6 +++--- files/templates/login_2fa.html | 2 +- files/templates/settings.html | 10 +++++----- files/templates/settings2.html | 10 +++++----- files/templates/sign_up.html | 8 ++++---- files/templates/sign_up_failed_ref.html | 6 +++--- files/templates/submission.html | 6 +++--- files/templates/submission_listing.html | 2 +- files/templates/submit.html | 12 ++++++------ 15 files changed, 45 insertions(+), 45 deletions(-) diff --git a/files/templates/authforms.html b/files/templates/authforms.html index ab3848b48d..558c7092cf 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -10,16 +10,16 @@ {% block pagetitle %}{{'SITE_NAME' | app_config}}{% endblock %} - + {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/comments.html b/files/templates/comments.html index a209560b61..5309c42276 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -748,11 +748,11 @@ {% if v %} - + {% endif %} - + {% if v and v.admin_level > 1 %} diff --git a/files/templates/default.html b/files/templates/default.html index 249361098e..4d9936847b 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -1,19 +1,19 @@ - + {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} - + diff --git a/files/templates/email/default.html b/files/templates/email/default.html index 4437d2c3a7..7b6b9bfbd6 100644 --- a/files/templates/email/default.html +++ b/files/templates/email/default.html @@ -8,7 +8,7 @@ - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %}
@@ -122,7 +122,7 @@
- + + @@ -13,11 +13,11 @@ {% block title %} Login - {{'SITE_NAME' | app_config}} {% endblock %} - + - + diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index f240106d34..e1376a35a6 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -12,7 +12,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/settings.html b/files/templates/settings.html index fea88fe0e0..b6ef4f0894 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -2,7 +2,7 @@ - + @@ -28,14 +28,14 @@ - + - + {% if v.agendaposter %}{% elif v.css %}{% endif %} - + @@ -238,7 +238,7 @@ {% block onload %}{% endblock %} - + + @@ -33,18 +33,18 @@ {% block pagetitle %}{{'SITE_NAME' | app_config}}{% endblock %} - + {% if v %} - + {% else %} - + {% endif %} - + diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 7e3317dd4f..69e108cc07 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -2,7 +2,7 @@ - + @@ -27,10 +27,10 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %} - + - + @@ -151,7 +151,7 @@ {% if hcaptcha %} - + {% endif %} diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index 3b8da6e25d..0fbab61c9e 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -3,7 +3,7 @@ - + @@ -28,10 +28,10 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %} - + - + diff --git a/files/templates/submission.html b/files/templates/submission.html index d8e94c917b..cc6bc70098 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -478,9 +478,9 @@ {% if p.domain == "twitter.com" %} {{p.embed_url | safe}} {% if v and v.theme.split("_")[0] in ["light", "coffee", "4chan"] %} - + {% else %} - + {% endif %} {% elif "youtu" in p.domain %} @@ -914,7 +914,7 @@ - + {% if not p.comment_count %} {% if v %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 5dbf97c350..c879d27f4b 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -658,7 +658,7 @@ - + \ No newline at end of file diff --git a/files/templates/submit.html b/files/templates/submit.html index 905f68ea7d..2599ece766 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -1,7 +1,7 @@ - + @@ -19,22 +19,22 @@ Create a post - {{'SITE_NAME' | app_config}} {% endblock %} - + {% block stylesheets %} {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %} - + @@ -175,7 +175,7 @@ {% endblock %} - + From 3d971c136850f2ea0a0d5404db2a50ca04b8163c Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 6 Dec 2021 00:52:39 +0200 Subject: [PATCH 24/25] sfdfds --- files/routes/posts.py | 32 ++++++++++++++++++++++++++----- files/templates/comments.html | 8 ++++++++ files/templates/submission.html | 34 +-------------------------------- 3 files changed, 36 insertions(+), 38 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 7d068a0449..d08357e951 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -190,7 +190,7 @@ def post_id(pid, anything=None, v=None): offset = 0 - if post.comment_count > 60: + if len(comments) > 60: comments2 = [] count = 0 if post.created_utc > 1638672040: @@ -229,6 +229,7 @@ def post_id(pid, anything=None, v=None): @limiter.limit("1/second") @auth_desired def viewmore(v, pid, sort, offset): + offset = int(offset) if v: votes = g.db.query(CommentVote).filter_by(user_id=v.id).subquery() @@ -283,7 +284,7 @@ def viewmore(v, pid, sort, offset): elif sort == "bottom": comments = comments.order_by(Comment.upvotes - Comment.downvotes) - if offset: comments = comments.offset(int(offset)) + comments = comments.offset(offset) comments = [c[0] for c in comments.all()] else: @@ -300,11 +301,32 @@ def viewmore(v, pid, sort, offset): elif sort == "bottom": comments = comments.order_by(Comment.upvotes - Comment.downvotes) - if offset: comments = comments.offset(int(offset)) - + comments = comments.offset(offset) + comments = comments.all() - return render_template("comments.html", v=v, comments=comments, render_replies=True) + if len(comments) > 60: + comments2 = [] + count = 0 + post = get_post(pid, v=v) + if post.created_utc > 1638672040: + for comment in comments: + comments2.append(comment) + count += g.db.query(Comment.id).filter_by(parent_submission=post.id, top_comment_id=comment.id).count() + 1 + offset += 1 + if count > 50: break + else: + for comment in comments: + comments2.append(comment) + count += g.db.query(Comment.id).filter_by(parent_submission=post.id, parent_comment_id=comment.id).count() + 1 + offset += 1 + if count > 10: break + + if len(comments) == len(comments2): offset = None + comments = comments2 + else: offset = None + + return render_template("comments.html", v=v, comments=comments, render_replies=True, pid=pid, sort=sort, offset=offset) @app.post("/edit_post/") diff --git a/files/templates/comments.html b/files/templates/comments.html index 5309c42276..c0c652f7b9 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -800,4 +800,12 @@ {% endif %} +{% if offset %} + {% if p %} + {% set pid = p.id %} + {% endif %} +
+
+{% endif %} + \ No newline at end of file diff --git a/files/templates/submission.html b/files/templates/submission.html index cc6bc70098..23f24ac6df 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -825,39 +825,7 @@ {% if offset %} - -
-
+ {% endif %} From 39d216d3753bb45217470183e8c7617519516398 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 6 Dec 2021 00:53:55 +0200 Subject: [PATCH 25/25] fdsdsf --- files/templates/submission.html | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/files/templates/submission.html b/files/templates/submission.html index 23f24ac6df..2935392e13 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -828,20 +828,19 @@ {% endif %} - - {% elif not p.replies and p.deleted_utc == 0 %} -
- - - - -

Be the first to comment!

- {% if v %} -

This comment section is a ghost town...

- {% else %} -

This comment section is a ghost town. Sign in

- {% endif %} -
+{% elif not p.replies and p.deleted_utc == 0 %} +
+ + + + +

Be the first to comment!

+ {% if v %} +

This comment section is a ghost town...

+ {% else %} +

This comment section is a ghost town. Sign in

+ {% endif %} +
{% endif %}