From 3fcc01e2382f4bac8a5f75d031056b48511291ac Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 00:16:04 +0200 Subject: [PATCH 001/121] sdfsdf --- files/routes/posts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index 8bc8fcb4ad..7ce39ee1e2 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -936,7 +936,7 @@ def submit_post(v): cache.delete_memoized(frontlist) cache.delete_memoized(User.userpagelisting) - if v.admin_level == 6 and "[changelog]" in new_post.title or "(changelog)" in new_post.title: + if v.admin_level == 6 and ("[changelog]" in new_post.title or "(changelog)" in new_post.title): send_message(f"http://{site}{new_post.permalink}") cache.delete_memoized(changeloglist) From aedd9760f4e9d73795606e0cb9807644355e335d Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 00:35:18 +0200 Subject: [PATCH 002/121] fdsfsd --- files/routes/login.py | 2 +- files/templates/authforms.html | 6 +++--- files/templates/default.html | 8 ++++---- files/templates/log.html | 6 +++--- files/templates/login_2fa.html | 2 +- files/templates/settings.html | 4 ++-- files/templates/settings2.html | 4 ++-- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submit.html | 8 ++++---- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/files/routes/login.py b/files/routes/login.py index 151484f1ac..b3eb486cf8 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -320,7 +320,7 @@ def sign_up_post(v): g.db.add(ref_user) id_1 = g.db.query(User.id).filter_by(id=7).count() - users_count = g.db.query(User.id).count() #paranoid + users_count = g.db.query(User.id).count() if id_1 == 0 and users_count < 7: admin_level=6 else: admin_level=0 diff --git a/files/templates/authforms.html b/files/templates/authforms.html index f285148a31..4478eda6ff 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -15,11 +15,11 @@ {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index 84459d63bc..e965555ff9 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -254,12 +254,12 @@ {% if v %} - - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %} diff --git a/files/templates/log.html b/files/templates/log.html index 33e1c395b7..540d507f75 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -17,11 +17,11 @@ {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %}
diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 928ba0cba8..16e8469ee8 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 567af4b405..ba3f435b22 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -55,8 +55,8 @@ - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} diff --git a/files/templates/settings2.html b/files/templates/settings2.html index 6bead88f6d..d904fab153 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -40,10 +40,10 @@ {% if v %} - + {% else %} - + {% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 766d648b73..9b23e45a35 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -36,7 +36,7 @@ - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index 1ad00846ec..76ce50a293 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -31,7 +31,7 @@ - + diff --git a/files/templates/submit.html b/files/templates/submit.html index 5e610382b5..5964cc361e 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -25,12 +25,12 @@ {% block stylesheets %} {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - - + + {% endif %} {% endblock %} From 26297437f5da8f6ff8eed45175bb99e87e9e0f1b Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 00:39:28 +0200 Subject: [PATCH 003/121] dfsfsd --- 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 8ef680599b..3f56d20a2a 100644 --- a/files/templates/emoji_modal.html +++ b/files/templates/emoji_modal.html @@ -1,4 +1,4 @@ - + - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index e965555ff9..ad32cfcac9 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -254,12 +254,12 @@ {% if v %} - - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %} diff --git a/files/templates/log.html b/files/templates/log.html index 540d507f75..a15a15a32e 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -17,11 +17,11 @@ {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %}
diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 16e8469ee8..aa5b2ef452 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 ba3f435b22..c8699dc049 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -55,8 +55,8 @@ - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} diff --git a/files/templates/settings2.html b/files/templates/settings2.html index d904fab153..a9c15efe53 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -40,10 +40,10 @@ {% if v %} - + {% else %} - + {% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 9b23e45a35..3e8288b494 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -36,7 +36,7 @@ - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index 76ce50a293..cd96d67c0d 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -31,7 +31,7 @@ - + diff --git a/files/templates/submit.html b/files/templates/submit.html index 5964cc361e..5e3ad31567 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -25,12 +25,12 @@ {% block stylesheets %} {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - - + + {% endif %} {% endblock %} From ffc4171c53ef461813641f1ef931c07314cc7253 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 01:25:08 +0200 Subject: [PATCH 006/121] fdsfd --- files/classes/user.py | 1 - 1 file changed, 1 deletion(-) diff --git a/files/classes/user.py b/files/classes/user.py index 5293778454..7c9db480f2 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -166,7 +166,6 @@ class User(Base): return return_value @property - @lazy def referral_count(self): return len(self.referrals) From e138aab3697ebfdb5684c58fb922f9e0cd5b23a4 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 01:52:22 +0200 Subject: [PATCH 008/121] sdfdsf --- files/routes/admin.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/files/routes/admin.py b/files/routes/admin.py index 412d240bcc..fef4d94f71 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -19,6 +19,16 @@ from files.helpers.discord import add_role SITE_NAME = environ.get("SITE_NAME", "").strip() +@app.get("/votes2") +@admin_level_required(6) +def votes2(v): + votes = g.db.query(Votes).join(Submission, Vote.submission_id==Submission.id).filter(Submission.author_id==7)all() + li = [] + for v in votes: + li.append(v.user_id) + return(str(li)) + + @app.get("/name//") @admin_level_required(6) From 7e851f38dba2dfdef4b6c14b5a9d50ada457afeb Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 01:59:25 +0200 Subject: [PATCH 009/121] fdssdf --- docker-compose.yml | 2 +- files/routes/admin.py | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 935a2e48ba..38d404a129 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,7 @@ services: - "./:/service" environment: - DATABASE_URL=postgresql://postgres@postgres:5432 - - MASTER_KEY=${MASTER_KEY:XuxGqp5NyygJrM24b5gt3YgyvFVGdQnwVDwLzLwpu3eQwY} + - MASTER_KEY=XuxGqp5NyygJrM24b5gt3YgyvFVGdQnwVDwLzLwpu3eQwY - REDIS_URL=redis://redis - DOMAIN=127.0.0.1 - SITE_NAME=Drama diff --git a/files/routes/admin.py b/files/routes/admin.py index fef4d94f71..fc6a38e20b 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -19,14 +19,13 @@ from files.helpers.discord import add_role SITE_NAME = environ.get("SITE_NAME", "").strip() -@app.get("/votes2") +@app.get("/upvoters/") @admin_level_required(6) -def votes2(v): - votes = g.db.query(Votes).join(Submission, Vote.submission_id==Submission.id).filter(Submission.author_id==7)all() - li = [] - for v in votes: - li.append(v.user_id) - return(str(li)) +def votes2(v, id): + try: id = int(id) + except: abort(400) + votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).all() + return(str(votes)) From ebb28507d6486510737b48f90bba664ee25ba8b8 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 01:59:35 +0200 Subject: [PATCH 010/121] fdsfd --- files/routes/admin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index fc6a38e20b..772dfc420f 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -28,7 +28,6 @@ def votes2(v, id): return(str(votes)) - @app.get("/name//") @admin_level_required(6) def changename(v, id, name): From a1db53ec14973aadff4979085a03df094ef43ff5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 02:01:56 +0200 Subject: [PATCH 011/121] fdsdsf --- files/routes/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 772dfc420f..5385e12245 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -24,7 +24,7 @@ SITE_NAME = environ.get("SITE_NAME", "").strip() def votes2(v, id): try: id = int(id) except: abort(400) - votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).all() + votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).all() return(str(votes)) From 6fd16f71b0cf88ce2a6d01b2fcf2fc226bffa6de Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 02:22:03 +0200 Subject: [PATCH 012/121] fdsfsd --- files/routes/admin.py | 8 ++++++-- files/templates/upvoters.html | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 files/templates/upvoters.html diff --git a/files/routes/admin.py b/files/routes/admin.py index 5385e12245..b60e935fbd 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -24,8 +24,12 @@ SITE_NAME = environ.get("SITE_NAME", "").strip() def votes2(v, id): try: id = int(id) except: abort(400) - votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).all() - return(str(votes)) + votes = g.db.query(Vote.user_id).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).all() + + voters=[x[0] for x in votes] + users = g.db.query(User.id, User.username).filter(User.id.in_(voters)).all() + users = [x[1] for x in sorted(users, key=lambda x: voters.index(x[0]))] + return render_template("upvoters.html", users=users) @app.get("/name//") diff --git a/files/templates/upvoters.html b/files/templates/upvoters.html new file mode 100644 index 0000000000..7a46c567d9 --- /dev/null +++ b/files/templates/upvoters.html @@ -0,0 +1,19 @@ +{% extends "default.html" %} +{% block content %} + + + + + + + + +{% for user in users %} + + + +{% endfor %} + +
Name
{{user}}
+ +{% endblock %} \ No newline at end of file From 3bfdddb632bbaf7939a032b4be53b80ef9218f22 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 02:24:53 +0200 Subject: [PATCH 013/121] dfsfds --- files/routes/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index b60e935fbd..d493ad6b8d 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -24,7 +24,7 @@ SITE_NAME = environ.get("SITE_NAME", "").strip() def votes2(v, id): try: id = int(id) except: abort(400) - votes = g.db.query(Vote.user_id).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).all() + votes = g.db.query(Vote.user_id).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() voters=[x[0] for x in votes] users = g.db.query(User.id, User.username).filter(User.id.in_(voters)).all() From 820952819ae24553c47fe97024e199e8d8025d2a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 02:26:40 +0200 Subject: [PATCH 014/121] fdsfsd --- files/templates/upvoters.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/templates/upvoters.html b/files/templates/upvoters.html index 7a46c567d9..bd1a6e3639 100644 --- a/files/templates/upvoters.html +++ b/files/templates/upvoters.html @@ -4,12 +4,14 @@ + {% for user in users %} + {% endfor %} From 9b93e0db79cd05d58c33749e97eed45b97c1aa5a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 02:34:13 +0200 Subject: [PATCH 015/121] sfdsdf --- files/routes/admin.py | 8 ++++++-- files/templates/upvoters.html | 7 ++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index d493ad6b8d..8f21b7a402 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -24,12 +24,16 @@ SITE_NAME = environ.get("SITE_NAME", "").strip() def votes2(v, id): try: id = int(id) except: abort(400) - votes = g.db.query(Vote.user_id).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() + votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() voters=[x[0] for x in votes] + counts=[x[1] for x in votes] users = g.db.query(User.id, User.username).filter(User.id.in_(voters)).all() users = [x[1] for x in sorted(users, key=lambda x: voters.index(x[0]))] - return render_template("upvoters.html", users=users) + users2 = [] + for idx, user in enumerate(users): users2.append((user, counts[idx])) + + return render_template("upvoters.html", v=v, users=users2) @app.get("/name//") diff --git a/files/templates/upvoters.html b/files/templates/upvoters.html index bd1a6e3639..35e96756e8 100644 --- a/files/templates/upvoters.html +++ b/files/templates/upvoters.html @@ -1,18 +1,23 @@ {% extends "default.html" %} {% block content %} +
+
 	
+
# Name
{{loop.index}} {{user}}
+ {% for user in users %} - + + {% endfor %} From 387bcc2233898c478330f3037218213e07b9b01e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 02:43:07 +0200 Subject: [PATCH 016/121] fdsfds --- files/routes/admin.py | 4 ++-- files/templates/upvoters.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 8f21b7a402..47088cb192 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -28,8 +28,8 @@ def votes2(v, id): voters=[x[0] for x in votes] counts=[x[1] for x in votes] - users = g.db.query(User.id, User.username).filter(User.id.in_(voters)).all() - users = [x[1] for x in sorted(users, key=lambda x: voters.index(x[0]))] + users = g.db.query(User).filter(User.id.in_(voters)).all() + users = sorted(users, key=lambda x: voters.index(x.id)) users2 = [] for idx, user in enumerate(users): users2.append((user, counts[idx])) diff --git a/files/templates/upvoters.html b/files/templates/upvoters.html index 35e96756e8..ba2fc87aca 100644 --- a/files/templates/upvoters.html +++ b/files/templates/upvoters.html @@ -16,7 +16,7 @@ {% for user in users %} - + {% endfor %} From e9050b5fbbfeb67ee6f202b1300d4e60aa7973ad Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 03:01:23 +0200 Subject: [PATCH 017/121] fdsfds --- files/routes/admin.py | 20 +++++++++++++------- files/templates/upvoters.html | 2 ++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 47088cb192..de5aad3554 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -16,6 +16,7 @@ from flask import * from files.__main__ import app, cache, limiter from .front import frontlist from files.helpers.discord import add_role +from collections import Counter SITE_NAME = environ.get("SITE_NAME", "").strip() @@ -24,16 +25,21 @@ SITE_NAME = environ.get("SITE_NAME", "").strip() def votes2(v, id): try: id = int(id) except: abort(400) + username = g.db.query(User.username).filter(User.id==7).first()[0] + votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() - voters=[x[0] for x in votes] - counts=[x[1] for x in votes] - users = g.db.query(User).filter(User.id.in_(voters)).all() - users = sorted(users, key=lambda x: voters.index(x.id)) - users2 = [] - for idx, user in enumerate(users): users2.append((user, counts[idx])) + votes2 = g.db.query(CommentVote.user_id, func.count(CommentVote.user_id)).join(Comment, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==1, Comment.author_id==id).group_by(CommentVote.user_id).order_by(func.count(CommentVote.user_id).desc()).limit(25).all() - return render_template("upvoters.html", v=v, users=users2) + votes = Counter(dict(votes)) + Counter(dict(votes2)) + + users = g.db.query(User).filter(User.id.in_(votes.keys())).all() + users2 = [] + for user in users: users2.append((user, votes[user.id])) + + users = sorted(users2, key=lambda x: x[1], reverse=True) + + return render_template("upvoters.html", v=v, users=users, username=username) @app.get("/name//") diff --git a/files/templates/upvoters.html b/files/templates/upvoters.html index ba2fc87aca..2d369943e6 100644 --- a/files/templates/upvoters.html +++ b/files/templates/upvoters.html @@ -4,6 +4,8 @@ +
@{{username}}'s biggest simps
+

 
# NameUpvotes
{{loop.index}}{{user}}{{user[0]}}{{user[1]}}
{{loop.index}}{{user[0]}}{{user[0].username}} {{user[1]}}
From ff082044de8abeba49d59f72a2a75545f409e69d Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 03:03:05 +0200 Subject: [PATCH 018/121] fsd --- files/routes/admin.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index de5aad3554..09ddf1c3bb 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -20,12 +20,12 @@ from collections import Counter SITE_NAME = environ.get("SITE_NAME", "").strip() -@app.get("/upvoters/") +@app.get("/@/upvoters") @admin_level_required(6) -def votes2(v, id): +def upvoters(v, username): try: id = int(id) except: abort(400) - username = g.db.query(User.username).filter(User.id==7).first()[0] + id = g.db.query(User.id).filter(User.username==username).first()[0] votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() @@ -41,6 +41,27 @@ def votes2(v, id): return render_template("upvoters.html", v=v, users=users, username=username) +@app.get("/@/downvoters") +@admin_level_required(6) +def downvoters(v, username): + try: id = int(id) + except: abort(400) + id = g.db.query(User.id).filter(User.username==username).first()[0] + + votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() + + votes2 = g.db.query(CommentVote.user_id, func.count(CommentVote.user_id)).join(Comment, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==-1, Comment.author_id==id).group_by(CommentVote.user_id).order_by(func.count(CommentVote.user_id).desc()).limit(25).all() + + votes = Counter(dict(votes)) + Counter(dict(votes2)) + + users = g.db.query(User).filter(User.id.in_(votes.keys())).all() + users2 = [] + for user in users: users2.append((user, votes[user.id])) + + users = sorted(users2, key=lambda x: x[1], reverse=True) + + return render_template("upvoters.html", v=v, users=users, username=username) + @app.get("/name//") @admin_level_required(6) From 7762bd4901ec9a8dec0f4b2966c4d41020baa983 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 03:05:05 +0200 Subject: [PATCH 019/121] fsdfsd --- files/routes/admin.py | 8 ++------ files/templates/upvoters.html | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 09ddf1c3bb..a9016c2c23 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -23,8 +23,6 @@ SITE_NAME = environ.get("SITE_NAME", "").strip() @app.get("/@/upvoters") @admin_level_required(6) def upvoters(v, username): - try: id = int(id) - except: abort(400) id = g.db.query(User.id).filter(User.username==username).first()[0] votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() @@ -39,13 +37,11 @@ def upvoters(v, username): users = sorted(users2, key=lambda x: x[1], reverse=True) - return render_template("upvoters.html", v=v, users=users, username=username) + return render_template("upvoters.html", v=v, users=users, username=username, name='Up', name2='simps') @app.get("/@/downvoters") @admin_level_required(6) def downvoters(v, username): - try: id = int(id) - except: abort(400) id = g.db.query(User.id).filter(User.username==username).first()[0] votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() @@ -60,7 +56,7 @@ def downvoters(v, username): users = sorted(users2, key=lambda x: x[1], reverse=True) - return render_template("upvoters.html", v=v, users=users, username=username) + return render_template("upvoters.html", v=v, users=users, username=username, name='Down', name2='haters') @app.get("/name//") diff --git a/files/templates/upvoters.html b/files/templates/upvoters.html index 2d369943e6..4f80c46718 100644 --- a/files/templates/upvoters.html +++ b/files/templates/upvoters.html @@ -4,14 +4,14 @@ -
@{{username}}'s biggest simps
+
@{{username}}'s biggest {{name2}}

 
- + From 8790e8e26efe4aae818e566186af2988db47a932 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 03:08:13 +0200 Subject: [PATCH 020/121] dsffsd --- files/templates/upvoters.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/upvoters.html b/files/templates/upvoters.html index 4f80c46718..309fa9ed69 100644 --- a/files/templates/upvoters.html +++ b/files/templates/upvoters.html @@ -4,7 +4,7 @@ -
@{{username}}'s biggest {{name2}}
+
@{{username}}'s biggest {{name2}}

 
# NameUpvotes{{name}}votes
From dc04798fc2702250f3f19778f3055788a63d6740 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 03:18:16 +0200 Subject: [PATCH 021/121] sdffsd --- files/routes/admin.py | 40 --------------------------------------- files/routes/users.py | 44 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 44 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index a9016c2c23..c75abd90b2 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -16,48 +16,9 @@ from flask import * from files.__main__ import app, cache, limiter from .front import frontlist from files.helpers.discord import add_role -from collections import Counter SITE_NAME = environ.get("SITE_NAME", "").strip() -@app.get("/@/upvoters") -@admin_level_required(6) -def upvoters(v, username): - id = g.db.query(User.id).filter(User.username==username).first()[0] - - votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() - - votes2 = g.db.query(CommentVote.user_id, func.count(CommentVote.user_id)).join(Comment, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==1, Comment.author_id==id).group_by(CommentVote.user_id).order_by(func.count(CommentVote.user_id).desc()).limit(25).all() - - votes = Counter(dict(votes)) + Counter(dict(votes2)) - - users = g.db.query(User).filter(User.id.in_(votes.keys())).all() - users2 = [] - for user in users: users2.append((user, votes[user.id])) - - users = sorted(users2, key=lambda x: x[1], reverse=True) - - return render_template("upvoters.html", v=v, users=users, username=username, name='Up', name2='simps') - -@app.get("/@/downvoters") -@admin_level_required(6) -def downvoters(v, username): - id = g.db.query(User.id).filter(User.username==username).first()[0] - - votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() - - votes2 = g.db.query(CommentVote.user_id, func.count(CommentVote.user_id)).join(Comment, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==-1, Comment.author_id==id).group_by(CommentVote.user_id).order_by(func.count(CommentVote.user_id).desc()).limit(25).all() - - votes = Counter(dict(votes)) + Counter(dict(votes2)) - - users = g.db.query(User).filter(User.id.in_(votes.keys())).all() - users2 = [] - for user in users: users2.append((user, votes[user.id])) - - users = sorted(users2, key=lambda x: x[1], reverse=True) - - return render_template("upvoters.html", v=v, users=users, username=username, name='Down', name2='haters') - @app.get("/name//") @admin_level_required(6) @@ -71,7 +32,6 @@ def changename(v, id, name): return "Username changed!" return "User not found!" - @app.get("/coins//") @admin_level_required(6) def addcoins(v, id, coins): diff --git a/files/routes/users.py b/files/routes/users.py index 2f07adadad..a642beeaaf 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -11,13 +11,49 @@ from files.mail import * from flask import * from files.__main__ import app, limiter from pusher_push_notifications import PushNotifications +from collections import Counter site = environ.get("DOMAIN").strip() -beams_client = PushNotifications( - instance_id=PUSHER_INSTANCE_ID, - secret_key=PUSHER_KEY, -) +beams_client = PushNotifications(instance_id=PUSHER_INSTANCE_ID, secret_key=PUSHER_KEY) + +@app.get("/@/upvoters") +@auth_desired +def upvoters(v, username): + id = g.db.query(User.id).filter(User.username==username).first()[0] + + votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() + + votes2 = g.db.query(CommentVote.user_id, func.count(CommentVote.user_id)).join(Comment, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==1, Comment.author_id==id).group_by(CommentVote.user_id).order_by(func.count(CommentVote.user_id).desc()).limit(25).all() + + votes = Counter(dict(votes)) + Counter(dict(votes2)) + + users = g.db.query(User).filter(User.id.in_(votes.keys())).all() + users2 = [] + for user in users: users2.append((user, votes[user.id])) + + users = sorted(users2, key=lambda x: x[1], reverse=True) + + return render_template("upvoters.html", v=v, users=users, username=username, name='Up', name2='simps') + +@app.get("/@/downvoters") +@auth_desired +def downvoters(v, username): + id = g.db.query(User.id).filter(User.username==username).first()[0] + + votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() + + votes2 = g.db.query(CommentVote.user_id, func.count(CommentVote.user_id)).join(Comment, CommentVote.comment_id==Comment.id).filter(CommentVote.vote_type==-1, Comment.author_id==id).group_by(CommentVote.user_id).order_by(func.count(CommentVote.user_id).desc()).limit(25).all() + + votes = Counter(dict(votes)) + Counter(dict(votes2)) + + users = g.db.query(User).filter(User.id.in_(votes.keys())).all() + users2 = [] + for user in users: users2.append((user, votes[user.id])) + + users = sorted(users2, key=lambda x: x[1], reverse=True) + + return render_template("upvoters.html", v=v, users=users, username=username, name='Down', name2='haters') @app.post("/pay_rent") @limiter.limit("1/second") From 35010376249857c42ed1caacfb8e07971c08ba18 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 03:33:54 +0200 Subject: [PATCH 022/121] fdsfds --- files/templates/userpage.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 35f0aed474..5c21aedcff 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -155,7 +155,12 @@ - {% if u.customtitle %}

{% if u.quadrant %}{% endif %}{{u.customtitle | safe}}

{% endif %} + {% if u.customtitle %}

{% if u.quadrant %}{% endif %}{{u.customtitle | safe}}

+ {% else %}

+				{% endif %}
+
+				
+
 				
{{u.coins}}    @@ -431,7 +436,13 @@ {% if v and v.has_follower(u) and not v.is_nofollow %} Follows you {% endif %} - {% if u.customtitle %}

{% if u.quadrant %}{% endif %}{{u.customtitle | safe}}

{% endif %} + {% if u.customtitle %}

{% if u.quadrant %}{% endif %}{{u.customtitle | safe}}

+ {% else %} +

+				{% endif %}
+
+				
+				
 				
{{u.coins}}    From ff79ad4140d9e9083144dfc8776659b5afe128d1 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 03:34:43 +0200 Subject: [PATCH 023/121] fdsfsd --- files/templates/userpage.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 5c21aedcff..f3e7fa9677 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -159,7 +159,7 @@ {% else %}

 				{% endif %}
 
-				
+				
 
 				
{{u.coins}} @@ -441,7 +441,7 @@

 				{% endif %}
 
-				
+				
 				
 				
{{u.coins}} From a60c4873b13e1a32ce3970d3da6829f414181db9 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 03:35:40 +0200 Subject: [PATCH 024/121] sdfsfd --- files/routes/users.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index a642beeaaf..8e8f43bbf3 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -20,7 +20,9 @@ beams_client = PushNotifications(instance_id=PUSHER_INSTANCE_ID, secret_key=PUSH @app.get("/@/upvoters") @auth_desired def upvoters(v, username): - id = g.db.query(User.id).filter(User.username==username).first()[0] + id = g.db.query(User.id).filter(User.username==username).first() + if not id: abort(400) + id = id[0] votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() @@ -39,7 +41,9 @@ def upvoters(v, username): @app.get("/@/downvoters") @auth_desired def downvoters(v, username): - id = g.db.query(User.id).filter(User.username==username).first()[0] + id = g.db.query(User.id).filter(User.username==username).first() + if not id: abort(400) + id = id[0] votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() From 4b9da09aaba331e85383dc7c72b04f74255e322e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 03:42:13 +0200 Subject: [PATCH 025/121] dsads --- files/routes/users.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/users.py b/files/routes/users.py index 8e8f43bbf3..bdc4c6f415 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -34,7 +34,7 @@ def upvoters(v, username): users2 = [] for user in users: users2.append((user, votes[user.id])) - users = sorted(users2, key=lambda x: x[1], reverse=True) + users = sorted(users2, key=lambda x: x[1], reverse=True)[:25] return render_template("upvoters.html", v=v, users=users, username=username, name='Up', name2='simps') From 91838fa641d57a2568d37b8d05f2573c091d7cfa Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 03:43:02 +0200 Subject: [PATCH 026/121] fdsfs --- files/routes/users.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/users.py b/files/routes/users.py index bdc4c6f415..49d297a58c 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -55,7 +55,7 @@ def downvoters(v, username): users2 = [] for user in users: users2.append((user, votes[user.id])) - users = sorted(users2, key=lambda x: x[1], reverse=True) + users = sorted(users2, key=lambda x: x[1], reverse=True)[:25] return render_template("upvoters.html", v=v, users=users, username=username, name='Down', name2='haters') From 9be1599b9faef101c135773d8fd6a1aa43bdfcf2 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 15 Nov 2021 04:11:13 +0200 Subject: [PATCH 027/121] dfsfsd --- files/routes/users.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index 49d297a58c..e46e0d53f2 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -20,9 +20,7 @@ beams_client = PushNotifications(instance_id=PUSHER_INSTANCE_ID, secret_key=PUSH @app.get("/@/upvoters") @auth_desired def upvoters(v, username): - id = g.db.query(User.id).filter(User.username==username).first() - if not id: abort(400) - id = id[0] + id = get_user(username).id votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() @@ -41,9 +39,7 @@ def upvoters(v, username): @app.get("/@/downvoters") @auth_desired def downvoters(v, username): - id = g.db.query(User.id).filter(User.username==username).first() - if not id: abort(400) - id = id[0] + id = get_user(username).id votes = g.db.query(Vote.user_id, func.count(Vote.user_id)).join(Submission, Vote.submission_id==Submission.id).filter(Vote.vote_type==-1, Submission.author_id==id).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).limit(25).all() From 8a49ee0dc3d457979ac9bdbd77643b978ed6bb4f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 16 Nov 2021 00:13:29 +0200 Subject: [PATCH 028/121] gffg --- files/classes/submission.py | 4 +- files/classes/user.py | 2 +- files/helpers/get.py | 2 +- files/routes/admin.py | 62 ++++++++++++------------- files/routes/awards.py | 6 +-- files/routes/comments.py | 10 ++-- files/routes/front.py | 4 +- files/routes/posts.py | 8 ++-- files/routes/search.py | 2 +- files/routes/static.py | 4 +- files/templates/admin/awards.html | 2 +- files/templates/comments.html | 16 +++---- files/templates/header.html | 2 +- files/templates/notifications.html | 2 +- files/templates/settings2.html | 2 +- files/templates/submission.html | 16 +++---- files/templates/submission_listing.html | 8 ++-- files/templates/userpage.html | 16 +++---- snappy.txt | 5 -- 19 files changed, 84 insertions(+), 89 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index 3ae1d7a6c9..884958bf55 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -346,7 +346,7 @@ class Submission(Base): @lazy def realtitle(self, v): - if self.club and not (v and v.paid_dues) and not (v and v.admin_level == 6): + if self.club and not (v and v.paid_dues) and not (v and v.admin_level > 1): if v: return random.choice(TROLLTITLES).format(username=v.username) else: return 'COUNTRY CLUB MEMBERS ONLY' elif self.title_html: title = self.title_html @@ -358,7 +358,7 @@ class Submission(Base): @lazy def plaintitle(self, v): - if self.club and not (v and v.paid_dues) and not (v and v.admin_level == 6): + if self.club and not (v and v.paid_dues) and not (v and v.admin_level > 1): if v: return random.choice(TROLLTITLES).format(username=v.username) else: return 'COUNTRY CLUB MEMBERS ONLY' else: title = self.title diff --git a/files/classes/user.py b/files/classes/user.py index 7c9db480f2..c69e55899d 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -177,7 +177,7 @@ class User(Base): @property @lazy def paid_dues(self): - return self.admin_level == 6 or self.club_allowed or (self.truecoins > int(environ.get("DUES").strip()) and not self.club_banned) + return self.admin_level > 1 or self.club_allowed or (self.truecoins > int(environ.get("DUES").strip()) and not self.club_banned) def any_block_exists(self, other): diff --git a/files/helpers/get.py b/files/helpers/get.py index a2dc660a82..a9f778f1ba 100644 --- a/files/helpers/get.py +++ b/files/helpers/get.py @@ -209,7 +209,7 @@ def get_comments(cids, v=None, load_parent=False): blocked.c.id, ).filter(Comment.id.in_(cids)) - if not (v and v.shadowbanned) and not (v and v.admin_level == 6): + if not (v and v.shadowbanned) and not (v and v.admin_level > 1): comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None) comments = comments.join( diff --git a/files/routes/admin.py b/files/routes/admin.py index c75abd90b2..720f2b565d 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -21,7 +21,7 @@ SITE_NAME = environ.get("SITE_NAME", "").strip() @app.get("/name//") -@admin_level_required(6) +@admin_level_required(2) def changename(v, id, name): if request.host != 'pcmemes.net': abort(403) user = g.db.query(User).filter_by(id=int(id)).first() @@ -33,7 +33,7 @@ def changename(v, id, name): return "User not found!" @app.get("/coins//") -@admin_level_required(6) +@admin_level_required(2) def addcoins(v, id, coins): if request.host != 'pcmemes.net': abort(403) user = g.db.query(User).filter_by(id=int(id)).first() @@ -45,7 +45,7 @@ def addcoins(v, id, coins): return "User not found!" @app.get("/truescore") -@admin_level_required(6) +@admin_level_required(2) def truescore(v): users = g.db.query(User).order_by(User.truecoins.desc()).limit(25).all() return render_template("truescore.html", v=v, users=users) @@ -53,9 +53,9 @@ def truescore(v): @app.post("/@/revert_actions") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) def revert_actions(v, username): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,30,995,2513,3333]) or ('rama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.admin_level > 2) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) @@ -78,7 +78,7 @@ def revert_actions(v, username): @app.post("/@/club_allow") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) def club_allow(v, username): u = get_user(username, v=v) @@ -109,7 +109,7 @@ def club_allow(v, username): @app.post("/@/club_ban") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) def club_ban(v, username): u = get_user(username, v=v) @@ -139,9 +139,9 @@ def club_ban(v, username): @app.post("/@/make_admin") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) def make_admin(v, username): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,30,995,2513,3333]) or ('rama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.admin_level > 2) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) user.admin_level = 6 @@ -152,9 +152,9 @@ def make_admin(v, username): @app.post("/@/remove_admin") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) def remove_admin(v, username): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,30,995,2513,3333]) or ('rama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.admin_level > 2) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) user.admin_level = 0 @@ -165,9 +165,9 @@ def remove_admin(v, username): @app.post("/@/make_fake_admin") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) def make_fake_admin(v, username): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,30,995,2513,3333]) or ('rama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.admin_level > 2) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) user.admin_level = 1 @@ -178,9 +178,9 @@ def make_fake_admin(v, username): @app.post("/@/remove_fake_admin") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) def remove_fake_admin(v, username): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,30,995,2513,3333]) or ('rama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.admin_level > 2) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) user.admin_level = 0 @@ -191,9 +191,9 @@ def remove_fake_admin(v, username): @app.post("/admin/monthly") @limiter.limit("1/day") -@admin_level_required(6) +@admin_level_required(2) def monthly(v): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,30,995,2513,3333]) or ('rama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.admin_level > 2) or ('rama' not in request.host and 'pcm' not in request.host): thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id for u in g.db.query(User).filter(User.patron > 0).all(): if u.patron == 1: procoins = 2000 @@ -211,7 +211,7 @@ def monthly(v): @app.get('/admin/rules') -@admin_level_required(6) +@admin_level_required(2) def get_rules(v): try: @@ -224,7 +224,7 @@ def get_rules(v): @app.post('/admin/rules') @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) @validate_formkey def post_rules(v): @@ -248,7 +248,7 @@ def post_rules(v): @app.get("/admin/shadowbanned") @auth_required def shadowbanned(v): - if not (v and v.admin_level == 6): abort(404) + if not (v and v.admin_level > 1): abort(404) users = [x for x in g.db.query(User).filter(User.shadowbanned != None).all()] return render_template("banned.html", v=v, users=users) @@ -256,7 +256,7 @@ def shadowbanned(v): @app.get("/admin/agendaposters") @auth_required def agendaposters(v): - if not (v and v.admin_level == 6): abort(404) + if not (v and v.admin_level > 1): abort(404) users = [x for x in g.db.query(User).filter_by(agendaposter = True).all()] return render_template("banned.html", v=v, users=users) @@ -333,7 +333,7 @@ def admin_home(v): return render_template("admin/admin_home.html", v=v, x=x) @app.post("/admin/disablesignups") -@admin_level_required(6) +@admin_level_required(2) @validate_formkey def disablesignups(v): with open('./disablesignups', 'r') as f: content = f.read() @@ -585,7 +585,7 @@ def admin_removed(v): @app.post("/agendaposter/") -@admin_level_required(6) +@admin_level_required(2) @validate_formkey def agendaposter(user_id, v): user = g.db.query(User).filter_by(id=user_id).first() @@ -638,7 +638,7 @@ def agendaposter(user_id, v): @app.post("/shadowban/") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) @validate_formkey def shadowban(user_id, v): user = g.db.query(User).filter_by(id=user_id).first() @@ -664,7 +664,7 @@ def shadowban(user_id, v): @app.post("/unshadowban/") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) @validate_formkey def unshadowban(user_id, v): user = g.db.query(User).filter_by(id=user_id).first() @@ -689,7 +689,7 @@ def unshadowban(user_id, v): @app.post("/admin/verify/") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) @validate_formkey def verify(user_id, v): user = g.db.query(User).filter_by(id=user_id).first() @@ -708,7 +708,7 @@ def verify(user_id, v): @app.post("/admin/unverify/") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) @validate_formkey def unverify(user_id, v): user = g.db.query(User).filter_by(id=user_id).first() @@ -728,7 +728,7 @@ def unverify(user_id, v): @app.post("/admin/title_change/") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) @validate_formkey def admin_title_change(user_id, v): @@ -762,7 +762,7 @@ def admin_title_change(user_id, v): @app.post("/ban_user/") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) @validate_formkey def ban_user(user_id, v): @@ -837,7 +837,7 @@ def ban_user(user_id, v): @app.post("/unban_user/") @limiter.limit("1/second") -@admin_level_required(6) +@admin_level_required(2) @validate_formkey def unban_user(user_id, v): @@ -1074,7 +1074,7 @@ def admin_distinguish_comment(c_id, v): return html @app.get("/admin/dump_cache") -@admin_level_required(6) +@admin_level_required(2) def admin_dump_cache(v): cache.clear() return {"message": "Internal cache cleared."} diff --git a/files/routes/awards.py b/files/routes/awards.py index 3f47125552..1d5e072a68 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -598,10 +598,10 @@ def award_comment(cid, v): else: return redirect("/") @app.get("/admin/awards") -@admin_level_required(6) +@admin_level_required(2) def admin_userawards_get(v): - if request.host == 'rdrama.net' and v.id not in [1,28,30,995,2513,3333]: render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v) + if request.host == 'rdrama.net' and v.admin_level != 3: render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v) return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) @app.post("/admin/awards") @@ -650,7 +650,7 @@ def admin_userawards_post(v): g.db.commit() - if request.host == 'rdrama.net' and v.id not in [1,28,30,995,2513,3333]: render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v) + if request.host == 'rdrama.net' and v.admin_level != 3: render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v) return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) diff --git a/files/routes/comments.py b/files/routes/comments.py index 884b7f0fec..f01899c8e8 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -46,7 +46,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): if comment.post and comment.post.club and not (v and v.paid_dues): abort(403) - if not comment.parent_submission and not (v and (comment.author.id == v.id or comment.sentto == v.id)) and not (v and v.admin_level == 6) : abort(403) + if not comment.parent_submission and not (v and (comment.author.id == v.id or comment.sentto == v.id)) and not (v and v.admin_level > 1) : abort(403) if not pid: if comment.parent_submission: pid = comment.parent_submission @@ -90,7 +90,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None): blocked.c.id, ) - if not (v and v.shadowbanned) and not (v and v.admin_level == 6): + if not (v and v.shadowbanned) and not (v and v.admin_level > 1): comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None) comments=comments.filter( @@ -842,16 +842,16 @@ def toggle_pin_comment(cid, v): if comment.is_pinned: if comment.is_pinned.startswith("t:"): abort(403) else: - if v.admin_level == 6 or comment.is_pinned.endswith(" (OP)"): comment.is_pinned = None + if v.admin_level > 1 or comment.is_pinned.endswith(" (OP)"): comment.is_pinned = None else: abort(403) else: - if v.admin_level == 6: comment.is_pinned = v.username + if v.admin_level > 1: comment.is_pinned = v.username else: comment.is_pinned = v.username + " (OP)" g.db.add(comment) g.db.flush() - if v.admin_level == 6: + if v.admin_level > 1: ma=ModAction( kind="pin_comment" if comment.is_pinned else "unpin_comment", user_id=v.id, diff --git a/files/routes/front.py b/files/routes/front.py index e47a8157a0..a4ccb8eae5 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -28,7 +28,7 @@ def notifications(v): messages = request.values.get('messages', False) modmail = request.values.get('modmail', False) posts = request.values.get('posts', False) - if modmail and v.admin_level == 6: + if modmail and v.admin_level > 1: comments = g.db.query(Comment).filter(Comment.sentto==0).order_by(Comment.created_utc.desc()).offset(25*(page-1)).limit(26).all() next_exists = (len(comments) > 25) comments = comments[:25] @@ -299,7 +299,7 @@ def changeloglist(v=None, sort="new", page=1 ,t="all"): Submission.author_id.notin_(blocked) ) - admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level == 6).all()] + admins = [x[0] for x in g.db.query(User.id).filter(User.admin_level > 1).all()] posts = posts.filter(Submission.title.ilike('_changelog%'), Submission.author_id.in_(admins)) if t != 'all': diff --git a/files/routes/posts.py b/files/routes/posts.py index 7ce39ee1e2..bf9bfc29de 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -118,7 +118,7 @@ def post_id(pid, anything=None, v=None): post = get_post(pid, v=v) - if post.club and not (v and v.paid_dues) or post.private and not (v and (v.id == post.author_id or v.admin_level == 6)): abort(403) + if post.club and not (v and v.paid_dues) or post.private and not (v and (v.id == post.author_id or v.admin_level > 1)): abort(403) if v: votes = g.db.query(CommentVote).filter_by(user_id=v.id).subquery() @@ -134,7 +134,7 @@ def post_id(pid, anything=None, v=None): blocked.c.id, ) - if not (v and v.shadowbanned) and not (v and v.admin_level == 6): + if not (v and v.shadowbanned) and not (v and v.admin_level > 1): comments = comments.join(User, User.id == Comment.author_id).filter(User.shadowbanned == None) comments=comments.filter( @@ -214,7 +214,7 @@ def edit_post(pid, v): p = get_post(pid) - if p.author_id != v.id and not (v.admin_level == 6 and v.id in [1,28,30,995,2513,3333]): abort(403) + if p.author_id != v.id and not (v.admin_level > 1 and v.admin_level > 2): abort(403) title = request.values.get("title", "").strip() body = request.values.get("body", "").strip() @@ -936,7 +936,7 @@ def submit_post(v): cache.delete_memoized(frontlist) cache.delete_memoized(User.userpagelisting) - if v.admin_level == 6 and ("[changelog]" in new_post.title or "(changelog)" in new_post.title): + if v.admin_level > 1 and ("[changelog]" in new_post.title or "(changelog)" in new_post.title): send_message(f"http://{site}{new_post.permalink}") cache.delete_memoized(changeloglist) diff --git a/files/routes/search.py b/files/routes/search.py index 44a59ef767..7fdcaa7718 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -59,7 +59,7 @@ def searchposts(v): posts = g.db.query(Submission.id) - if not (v and v.admin_level == 6): posts = posts.filter(Submission.private == False) + if not (v and v.admin_level > 1): posts = posts.filter(Submission.private == False) if 'q' in criteria: words=criteria['q'].split() diff --git a/files/routes/static.py b/files/routes/static.py index ce4618e2a2..bbe9faad84 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -15,7 +15,7 @@ site_name = environ.get("SITE_NAME").strip() def static_rules(v): if not path.exists(f'./{site_name} rules.html'): - if v and v.admin_level == 6: + if v and v.admin_level > 1: return render_template('norules.html', v=v) else: abort(404) @@ -174,7 +174,7 @@ def log(v): 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() + if v and v.admin_level > 1: 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", ModAction.kind!="check").order_by(ModAction.id.desc()).offset(25*(page-1)).limit(26).all() next_exists=len(actions)>25 diff --git a/files/templates/admin/awards.html b/files/templates/admin/awards.html index ae28df17c5..a7c7e159da 100644 --- a/files/templates/admin/awards.html +++ b/files/templates/admin/awards.html @@ -63,7 +63,7 @@

-	{% if 'rdrama.net' not in request.host or v.id in [1,995,2513] %}
+	{% if 'rdrama.net' not in request.host or v.admin_level > 2 %}
 		
 	{% endif %}
 {% endblock %}
\ No newline at end of file
diff --git a/files/templates/comments.html b/files/templates/comments.html
index b5dcb6912c..b9401a8978 100644
--- a/files/templates/comments.html
+++ b/files/templates/comments.html
@@ -33,7 +33,7 @@
 
 
 
-{% if v and v.admin_level == 6 %}
+{% if v and v.admin_level > 1 %}
 	
 {% endif %}
 
@@ -173,7 +173,7 @@
 {% set downs=c.downvotes %}
 {% set score=ups-downs %}
 
-{% if v and (v.shadowbanned or v.admin_level == 6) %}
+{% if v and (v.shadowbanned or v.admin_level > 1) %}
 	{% set replies=c.replies3 %}
 {% else %}
 	{% set replies=c.replies %}
@@ -291,7 +291,7 @@
 				{% endif %}
 				{% if c.active_flags %}{{c.active_flags}} Reports{% endif %}
 				{% if c.over_18 %}+18{% endif %}
-				{% if v and v.admin_level==6 and c.author.shadowbanned %}{% endif %}
+				{% if v and v.admin_level> 1 and c.author.shadowbanned %}{% endif %}
 				{% if c.is_pinned %}{% endif %}
 				{% if c.distinguish_level %}{% endif %}
 				{% if c.is_op %}{% endif %}
@@ -319,7 +319,7 @@
 				

 				
    {% for f in c.ordered_flags %} -
  • {{f.user.username}}{% if f.reason %}: {{f.reason | safe}}{% endif %} {% if v.admin_level==6 %}[remove]{% endif %}
  • +
  • {{f.user.username}}{% if f.reason %}: {{f.reason | safe}}{% endif %} {% if v.admin_level> 1 %}[remove]{% endif %}
  • {% endfor %}
@@ -461,7 +461,7 @@ {% endif %} {% endif %} - {% if v and v.admin_level==6 and v.id==c.author_id %} + {% if v and v.admin_level> 1 and v.id==c.author_id %} Undistinguish Distinguish {% endif %} @@ -496,7 +496,7 @@ Mark +18 {% endif %} - {% if v and v.admin_level==6 and v.id != c.author_id %} + {% if v and v.admin_level> 1 and v.id != c.author_id %} Unban user Ban user {% endif %} @@ -661,7 +661,7 @@ Unmark +18 {% endif %} - {% if v and (c.post and v.admin_level == 6) %} + {% if v and (c.post and v.admin_level > 1) %} {% if c.author_id != v.id %} Ban user Unban user @@ -689,7 +689,7 @@ {% if v %} {% include "gif_modal.html" %} {% include "emoji_modal.html" %} - {% if v.admin_level == 6 %} + {% if v.admin_level > 1 %} {% include "ban_modal.html" %} {% endif %} diff --git a/files/templates/header.html b/files/templates/header.html index 994cf289d3..30f8db4f75 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -63,7 +63,7 @@ - {% if v and v.admin_level==6 %} + {% if v and v.admin_level> 1 %} diff --git a/files/templates/notifications.html b/files/templates/notifications.html index 1999f56f60..fb87f91b7f 100644 --- a/files/templates/notifications.html +++ b/files/templates/notifications.html @@ -30,7 +30,7 @@ Messages - {% if v.admin_level==6 %} + {% if v.admin_level> 1 %}
{% endfor %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 00e5e03f02..41fb149a17 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -36,7 +36,7 @@ - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index d08215e3f9..d5da208bf2 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -31,7 +31,7 @@ - + diff --git a/files/templates/submit.html b/files/templates/submit.html index b840ac6b24..36c0d7f508 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -31,12 +31,12 @@ {% block stylesheets %} {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - - + + {% endif %} {% endblock %} From 262f4c9ae2f3cae8d14b284a1266fcbc942fe0fa Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 21:19:53 +0200 Subject: [PATCH 086/121] fdsfds --- files/routes/awards.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/files/routes/awards.py b/files/routes/awards.py index c466f20a04..2500261c3c 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -156,7 +156,7 @@ def shop(v): "color": "text-success", "owned": 0, "price": 10000, - "MB": True + "MB": False }, "eye": { "kind": "eye", @@ -166,7 +166,7 @@ def shop(v): "color": "text-silver", "owned": 0, "price": 10000, - "MB": True + "MB": False }, "pause": { "kind": "pause", @@ -176,7 +176,7 @@ def shop(v): "color": "text-danger", "owned": 0, "price": 20000, - "MB": True + "MB": False }, "unpausable": { "kind": "unpausable", @@ -186,7 +186,7 @@ def shop(v): "color": "text-success", "owned": 0, "price": 40000, - "MB": True + "MB": False }, } From 2f91300ae567d21c2c27c215e0258d84869975c4 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 21:30:34 +0200 Subject: [PATCH 087/121] dsffds --- files/routes/awards.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/routes/awards.py b/files/routes/awards.py index 2500261c3c..be54c782ca 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -623,6 +623,11 @@ def award_comment(cid, v): send_notification(995, f"@{v.username} bought {kind} award!") new_badge = Badge(badge_id=67, user_id=author.id) g.db.add(new_badge) + elif kind == "eye": + author.eye = True + send_notification(995, f"@{v.username} bought {kind} award!") + new_badge = Badge(badge_id=83, user_id=author.id) + g.db.add(new_badge) elif kind == "marsey": author.marseyawarded = time.time() + 86400 From fceedfe94ca53bcf2d8e670bdf4b778d02308cf3 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 22:02:26 +0200 Subject: [PATCH 088/121] fdfd --- files/classes/user.py | 1 + files/helpers/const.py | 17 +++ files/routes/awards.py | 187 +++++------------------- files/routes/search.py | 8 +- files/templates/authforms.html | 6 +- files/templates/award_modal.html | 7 +- files/templates/default.html | 8 +- files/templates/log.html | 6 +- files/templates/login_2fa.html | 2 +- files/templates/settings.html | 4 +- files/templates/settings2.html | 4 +- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submit.html | 8 +- files/templates/userpage.html | 15 +- 15 files changed, 91 insertions(+), 186 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 10f3d2157d..242a645d32 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -82,6 +82,7 @@ class User(Base): mute = Column(Boolean) unmutable = Column(Boolean) eye = Column(Boolean) + alt = Column(Boolean) frontsize = Column(Integer, default=25) controversial = Column(Boolean, default=False) bio = deferred(Column(String)) diff --git a/files/helpers/const.py b/files/helpers/const.py index 80ff68edf4..649335fea9 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -322,6 +322,15 @@ AWARDS = { "color": "text-silver", "price": 10000 }, + "alt": { + "kind": "alt", + "title": "Alt-Seeing Eye", + "description": "Gives the recipient the ability to view alts.", + "icon": "fas fa-eye", + "color": "text-gold", + "price": 50000 + }, + } AWARDS2 = { @@ -437,6 +446,14 @@ AWARDS2 = { "color": "text-success", "price": 40000 }, + "alt": { + "kind": "alt", + "title": "Alt-Seeing Eye", + "description": "Gives the recipient the ability to view alts.", + "icon": "fas fa-eye", + "color": "text-gold", + "price": 50000 + }, } TROLLTITLES = [ diff --git a/files/routes/awards.py b/files/routes/awards.py index be54c782ca..db4fa81c9d 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -188,6 +188,16 @@ def shop(v): "price": 40000, "MB": False }, + "alt": { + "kind": "alt", + "title": "Alt-Seeing Eye", + "description": "Gives the recipient the ability to view alts.", + "icon": "fas fa-eye", + "color": "text-gold", + "owned": 0, + "price": 50000, + "MB": False + }, } for useraward in g.db.query(AwardRelationship).filter(AwardRelationship.user_id == v.id, AwardRelationship.submission_id == None, AwardRelationship.comment_id == None).all(): @@ -326,6 +336,14 @@ def buy(v, award): "color": "text-success", "price": 40000 }, + "alt": { + "kind": "alt", + "title": "Alt-Seeing Eye", + "description": "Gives the recipient the ability to view alts.", + "icon": "fas fa-eye", + "color": "text-gold", + "price": 50000 + }, } if award not in AWARDS: abort(400) @@ -499,13 +517,18 @@ def award_post(pid, v): send_notification(995, f"@{v.username} bought {kind} award!") new_badge = Badge(badge_id=67, user_id=author.id) g.db.add(new_badge) + elif kind == "marsey": + author.marseyawarded = time.time() + 86400 elif kind == "eye": author.eye = True send_notification(995, f"@{v.username} bought {kind} award!") new_badge = Badge(badge_id=83, user_id=author.id) g.db.add(new_badge) - elif kind == "marsey": - author.marseyawarded = time.time() + 86400 + elif kind == "alt": + author.alt = True + send_notification(995, f"@{v.username} bought {kind} award!") + new_badge = Badge(badge_id=84, user_id=author.id) + g.db.add(new_badge) post.author.received_award_count += 1 g.db.add(post.author) @@ -623,13 +646,18 @@ def award_comment(cid, v): send_notification(995, f"@{v.username} bought {kind} award!") new_badge = Badge(badge_id=67, user_id=author.id) g.db.add(new_badge) + elif kind == "marsey": + author.marseyawarded = time.time() + 86400 elif kind == "eye": author.eye = True send_notification(995, f"@{v.username} bought {kind} award!") new_badge = Badge(badge_id=83, user_id=author.id) g.db.add(new_badge) - elif kind == "marsey": - author.marseyawarded = time.time() + 86400 + elif kind == "alt": + author.alt = True + send_notification(995, f"@{v.username} bought {kind} award!") + new_badge = Badge(badge_id=84, user_id=author.id) + g.db.add(new_badge) c.author.received_award_count += 1 g.db.add(c.author) @@ -690,153 +718,4 @@ def admin_userawards_post(v): g.db.commit() if request.host == 'rdrama.net' and v.admin_level != 3: render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v) - return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) - - -@app.get("/api/shop/items") -@auth_required -def items(v): - AWARDS = { - "shit": { - "kind": "shit", - "title": "Shit", - "description": "Makes flies swarm the post.", - "icon": "fas fa-poop", - "color": "text-black-50", - "owned": 0, - "price": 500 - }, - "fireflies": { - "kind": "fireflies", - "title": "Fireflies", - "description": "Makes fireflies swarm the post.", - "icon": "fas fa-sparkles", - "color": "text-warning", - "owned": 0, - "price": 500 - }, - "train": { - "kind": "train", - "title": "Train", - "description": "Summons a train on the post.", - "icon": "fas fa-train", - "color": "text-pink", - "owned": 0, - "price": 500 - }, - "pin": { - "kind": "pin", - "title": "1-Hour Pin", - "description": "Pins the post/comment.", - "icon": "fas fa-thumbtack fa-rotate--45", - "color": "text-warning", - "owned": 0, - "price": 750 - }, - "unpin": { - "kind": "unpin", - "title": "1-Hour Unpin", - "description": "Removes 1 hour from the pin duration of the post/comment.", - "icon": "fas fa-thumbtack fa-rotate--45", - "color": "text-black", - "owned": 0, - "price": 1000 - }, - "flairlock": { - "kind": "flairlock", - "title": "1-Day Flairlock", - "description": "Sets a flair for the recipient and locks it or 24 hours.", - "icon": "fas fa-lock", - "color": "text-black", - "owned": 0, - "price": 1250 - }, - "agendaposter": { - "kind": "agendaposter", - "title": "Agendaposter", - "description": "Forces the agendaposter theme on the recipient for 24 hours.", - "icon": "fas fa-snooze", - "color": "text-purple", - "owned": 0, - "price": 2500 - }, - "marsey": { - "kind": "marsey", - "title": "Marsey", - "description": "Makes the recipient unable to post/comment anything but marsey emojis for 24 hours.", - "icon": "fas fa-cat", - "color": "text-orange", - "owned": 0, - "price": 3000 - }, - "ban": { - "kind": "ban", - "title": "1-Day Ban", - "description": "Bans the recipient for a day.", - "icon": "fas fa-gavel", - "color": "text-danger", - "owned": 0, - "price": 3000 - }, - "unban": { - "kind": "unban", - "title": "1-Day Unban", - "description": "Removes 1 day from the ban duration of the recipient.", - "icon": "fas fa-gavel", - "color": "text-success", - "owned": 0, - "price": 3500 - }, - "grass": { - "kind": "grass", - "title": "Grass", - "description": "Ban the recipient permanently (must provide a timestamped picture of them touching grass to the admins to get unbanned)", - "icon": "fas fa-seedling", - "color": "text-success", - "owned": 0, - "price": 10000 - }, - "eye": { - "kind": "eye", - "title": "All-Seeing Eye", - "description": "Gives the recipient the ability to view private profiles.", - "icon": "fas fa-eye", - "color": "text-silver", - "owned": 0, - "price": 10000 - }, - "pause": { - "kind": "pause", - "title": "Pause", - "description": "Gives the recipient the ability to pause profile anthems.", - "icon": "fas fa-volume-mute", - "color": "text-danger", - "owned": 0, - "price": 20000 - }, - "unpausable": { - "kind": "unpausable", - "title": "Unpausable", - "description": "Makes the profile anthem of the recipient unpausable.", - "icon": "fas fa-volume", - "color": "text-success", - "owned": 0, - "price": 40000 - }, - } - - for useraward in g.db.query(AwardRelationship).filter(AwardRelationship.user_id == v.id, AwardRelationship.submission_id == None, AwardRelationship.comment_id == None).all(): AWARDS[useraward.kind]["owned"] += 1 - - if v.patron == 1: discount = 0.10 - elif v.patron == 2: discount = 0.15 - elif v.patron == 3: discount = 0.20 - elif v.patron == 4: discount = 0.25 - elif v.patron == 5: discount = 0.30 - else: discount = 0 - - for badge in [69,70,71,72,73]: - if v.has_badge(badge): discount += discounts[badge] - - for val in AWARDS.values(): val["discount"] = discount - - return AWARDS \ No newline at end of file + return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) \ No newline at end of file diff --git a/files/routes/search.py b/files/routes/search.py index f12b5b745e..9608b12e42 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -92,11 +92,11 @@ def searchposts(v): ) ) - if not(v and v.admin_level > 1): - posts = posts.join(User, User.id==Submission.author_id).filter(User.is_private == False, Submission.deleted_utc == 0, Submission.is_banned == False) + if not (v and v.admin_level > 1): + posts.filter(Submission.deleted_utc == 0, Submission.is_banned == False) + if not (v and v.eye): posts = posts.join(User, User.id==Submission.author_id).filter(User.is_private == False) - if v and v.admin_level > 1: - pass + if v and v.admin_level > 1: pass elif v: blocking = [x[0] for x in g.db.query( UserBlock.target_id).filter_by( diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 536eb901e4..230829ce7a 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -15,11 +15,11 @@ {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index 19bba7e52f..cf46849fd6 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -23,6 +23,11 @@
{{award.owned}} owned
{% endfor %} + + +
 
+
 
+
@@ -72,7 +77,7 @@ @media (min-width: 767.98px) { .award-columns { - column-count: 7 !important; + column-count: 8 !important; } } \ No newline at end of file diff --git a/files/templates/default.html b/files/templates/default.html index 977b29f0e2..9b7fd738de 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -254,12 +254,12 @@ {% if v %} - - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %} diff --git a/files/templates/log.html b/files/templates/log.html index 0f1985c6b5..27578e4b80 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -17,11 +17,11 @@ {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %}
diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 0f55671961..8bb2501e65 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 726c52fec8..82feeb1be0 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -55,8 +55,8 @@ - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} diff --git a/files/templates/settings2.html b/files/templates/settings2.html index 3aad6cc773..c550f2b80d 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -40,10 +40,10 @@ {% if v %} - + {% else %} - + {% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 41fb149a17..7ca7bd6683 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -36,7 +36,7 @@ - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index d5da208bf2..5cb8cb542a 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -31,7 +31,7 @@ - + diff --git a/files/templates/submit.html b/files/templates/submit.html index 36c0d7f508..182fb1012a 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -31,12 +31,12 @@ {% block stylesheets %} {% if v %} - - {% if v.agendaposter %}{% elif v.css %}{% endif %} + + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - - + + {% endif %} {% endblock %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 6ad228c953..855e60440e 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -394,18 +394,20 @@ {% endif %}

 					

User ID: {{u.id}}

+

Coins spent: {{u.coins_spent}}

{% if v and v.admin_level > 1 %} +

True score: {{u.truecoins}}

{% if u.is_private %}

User has private mode enabled.

{% endif %} + {% endif %} + {% if v and (v.admin_level > 1 or v.alt) %} Alts:
    {% for account in u.alts_unique %}
  • @{{account.username}}{% if account._is_manual %} [m]{% endif %}
  • {% endfor %}
- True score: {{u.truecoins}}   - Coins spent: {{u.coins_spent}} {% endif %} {% if u.is_suspended %}

Banned by: @{{u.banned_by.username}}

@@ -688,23 +690,24 @@ {% endif %}

 				

User ID: {{u.id}}

+

Coins spent: {{u.coins_spent}}

{% if v and v.admin_level > 1 %} +

True score: {{u.truecoins}}

{% if u.is_private %}

User has private mode enabled.

{% endif %} + {% endif %} + {% if v and (v.admin_level > 1 or v.alt) %} Alts: - True score: {{u.truecoins}}   - Coins spent: {{u.coins_spent}} {% endif %} {% if u.is_suspended %}

Banned by: @{{u.banned_by.username}}

{% endif %} -
From 7cab179f3c8991964ed890ea0eab350ba8aca959 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 22:27:46 +0200 Subject: [PATCH 089/121] fdssfd --- files/templates/userpage.html | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 855e60440e..d7750c6aaf 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -15,7 +15,9 @@ } - +{% if v %} + +{% endif %} {% if v and not v.patron %} {% endif %} @@ -294,7 +286,7 @@
- +
{{u.username}} will receive 0 {{'COINS_NAME' | app_config}}
@@ -594,7 +586,7 @@
- +
{{u.username}} will receive 0 {{'COINS_NAME' | app_config}}
From 8a7aa2e25e41a53b8b8ba53ff626ce16d28873eb Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 22:50:03 +0200 Subject: [PATCH 090/121] fdsfd --- files/classes/user.py | 1 + files/helpers/const.py | 16 ++++++++++++++++ files/routes/awards.py | 22 ++++++++++++++++++++++ files/routes/comments.py | 16 ++++++++++++++++ files/routes/posts.py | 23 +++++++++++++++++++++-- files/templates/authforms.html | 4 ++-- files/templates/award_modal.html | 5 ----- files/templates/comments.html | 2 +- files/templates/default.html | 4 ++-- files/templates/log.html | 4 ++-- files/templates/login_2fa.html | 2 +- files/templates/settings.html | 2 +- files/templates/settings2.html | 4 ++-- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submission.html | 2 +- files/templates/submit.html | 4 ++-- 17 files changed, 92 insertions(+), 23 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 242a645d32..1cd03df48b 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -50,6 +50,7 @@ class User(Base): verified = Column(String) verifiedcolor = Column(String) marseyawarded = Column(Integer) + longpost = Column(Integer) email = deferred(Column(String)) css = deferred(Column(String)) profilecss = deferred(Column(String)) diff --git a/files/helpers/const.py b/files/helpers/const.py index 649335fea9..f28e364df8 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -194,6 +194,14 @@ AWARDS = { "color": "text-black", "price": 1000 }, + "longpost": { + "kind": "longpost", + "title": "Longpost", + "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", + "icon": "fas fa-book", + "color": "text-green", + "price": 1000 + }, "flairlock": { "kind": "flairlock", "title": "1-Day Flairlock", @@ -374,6 +382,14 @@ AWARDS2 = { "color": "text-black", "price": 1000 }, + "longpost": { + "kind": "longpost", + "title": "Longpost", + "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", + "icon": "fas fa-book", + "color": "text-green", + "price": 1000 + }, "flairlock": { "kind": "flairlock", "title": "1-Day Flairlock", diff --git a/files/routes/awards.py b/files/routes/awards.py index db4fa81c9d..9b8f1de431 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -98,6 +98,16 @@ def shop(v): "price": 1000, "MB": True }, + "longpost": { + "kind": "longpost", + "title": "Longpost", + "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", + "icon": "fas fa-book", + "color": "text-green", + "owned": 0, + "price": 1000, + "MB": True + }, "flairlock": { "kind": "flairlock", "title": "1-Day Flairlock", @@ -264,6 +274,14 @@ def buy(v, award): "color": "text-black", "price": 1000 }, + "longpost": { + "kind": "longpost", + "title": "Longpost", + "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", + "icon": "fas fa-book", + "color": "text-green", + "price": 1000, + }, "flairlock": { "kind": "flairlock", "title": "1-Day Flairlock", @@ -519,6 +537,8 @@ def award_post(pid, v): g.db.add(new_badge) elif kind == "marsey": author.marseyawarded = time.time() + 86400 + elif kind == "longpost": + author.longpost = time.time() + 86400 elif kind == "eye": author.eye = True send_notification(995, f"@{v.username} bought {kind} award!") @@ -648,6 +668,8 @@ def award_comment(cid, v): g.db.add(new_badge) elif kind == "marsey": author.marseyawarded = time.time() + 86400 + elif kind == "longpost": + author.longpost = time.time() + 86400 elif kind == "eye": author.eye = True send_notification(995, f"@{v.username} bought {kind} award!") diff --git a/files/routes/comments.py b/files/routes/comments.py index 50da2ef43c..ae46d73284 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -164,6 +164,12 @@ def api_comment(v): marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body)) if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403 + if v.longpost: + if time.time() > v.longpost: + v.longpost = None + g.db.add(v) + elif len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403 + if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400 for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): @@ -188,6 +194,8 @@ def api_comment(v): if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 403 + if v.longpost and len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403 + bans = filter_comment_html(body_html) if bans: @@ -609,6 +617,12 @@ def edit_comment(cid, v): marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body)) if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403 + if v.longpost: + if time.time() > v.longpost: + v.longpost = None + g.db.add(v) + elif len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403 + for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999))', body, re.MULTILINE): if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})') body_md = CustomRenderer().render(mistletoe.Document(body)) @@ -616,6 +630,8 @@ def edit_comment(cid, v): if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 403 + if v.longpost and len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403 + bans = filter_comment_html(body_html) if bans: diff --git a/files/routes/posts.py b/files/routes/posts.py index d6b4f9af2a..bdd1c70c01 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -234,6 +234,12 @@ def edit_post(pid, v): marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body)) if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403 + if v.longpost: + if time.time() > v.longpost: + v.longpost = None + g.db.add(v) + elif len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403 + if title != p.title: title_html = filter_title(title) if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html))) > 0: return {"error":"You can only type marseys!"}, 403 @@ -257,6 +263,9 @@ def edit_post(pid, v): p.body = body if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 40 + + if v.longpost and len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403 + p.body_html = body_html if "rama" in request.host and "ivermectin" in body_html.lower(): @@ -518,8 +527,12 @@ def submit_post(v): title = request.values.get("title", "").strip() url = request.values.get("url", "").strip() title_html = filter_title(title) + body = request.values.get("body", "").strip() + if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html))) > 0: return {"error":"You can only type marseys!"}, 40 + if v.longpost and len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403 + if url: if "/i.imgur.com/" in url: url = url.replace(".png", ".webp").replace(".jpg", ".webp").replace(".jpeg", ".webp") elif "/media.giphy.com/" in url or "/c.tenor.com/" in url: url = url.replace(".gif", ".webp") @@ -590,8 +603,6 @@ def submit_post(v): elif len(title) > 500: if request.headers.get("Authorization"): return {"error": "500 character limit for titles"}, 400 else: render_template("submit.html", v=v, error="500 character limit for titles.", title=title[:500], url=url, body=request.values.get("body", "")), 400 - - body = request.values.get("body", "").strip() if v.marseyawarded: if time.time() > v.marseyawarded: @@ -604,6 +615,12 @@ def submit_post(v): marregex = list(re.finditer("^(:!?m\w+:\s*)+$", body)) if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403 + if v.longpost: + if time.time() > v.longpost: + v.longpost = None + g.db.add(v) + elif len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403 + dup = g.db.query(Submission).filter( Submission.author_id == v.id, Submission.deleted_utc == 0, @@ -685,6 +702,8 @@ def submit_post(v): if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html))) > 0: return {"error":"You can only type marseys!"}, 400 + if v.longpost and len(body) < 280: return {"error":"You have to type more than 280 characters!"}, 403 + if len(body_html) > 20000: return {"error":"Submission body too long!"}, 400 bans = filter_comment_html(body_html) diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 230829ce7a..9cdf7a9a88 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -15,11 +15,11 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index cf46849fd6..afda87db90 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -23,11 +23,6 @@
{{award.owned}} owned
{% endfor %} - - -
 
-
 
-
diff --git a/files/templates/comments.html b/files/templates/comments.html index 7b3600ec71..d580b8d263 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -27,7 +27,7 @@ {% if v %} {% include "award_modal.html" %} - + {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index 9b7fd738de..a936d61417 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -254,12 +254,12 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %} diff --git a/files/templates/log.html b/files/templates/log.html index 27578e4b80..e9ebd9e0a0 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -17,11 +17,11 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %}
diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 8bb2501e65..1da0240e51 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 82feeb1be0..ccf9ca26d3 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -55,7 +55,7 @@ - + {% if v.agendaposter %}{% elif v.css %}{% endif %} diff --git a/files/templates/settings2.html b/files/templates/settings2.html index c550f2b80d..9c1000245f 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -40,10 +40,10 @@ {% if v %} - + {% else %} - + {% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 7ca7bd6683..3808260f33 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -36,7 +36,7 @@ - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index 5cb8cb542a..279cea8758 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -31,7 +31,7 @@ - + diff --git a/files/templates/submission.html b/files/templates/submission.html index 371442e2cc..7f88da0b58 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -146,7 +146,7 @@ {% if v %} - + {% include "award_modal.html" %} {% include "emoji_modal.html" %} {% include "gif_modal.html" %} diff --git a/files/templates/submit.html b/files/templates/submit.html index 182fb1012a..5c69cb3ef8 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -31,11 +31,11 @@ {% block stylesheets %} {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %} From eba8d64043e172a1e63ad089ea199b4d3bd4181a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 22:53:47 +0200 Subject: [PATCH 091/121] gffg --- files/helpers/const.py | 3 +++ files/routes/login.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index f28e364df8..436ddd0f21 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -109,6 +109,7 @@ if SITE == 'rdrama.net': LAWLZ_ID = 3833 LLM_ID = 253 DAD_ID = 2513 + MOM_ID = 4588 elif SITE == "pcmemes.net": BASEDBOT_ID = 800 NOTIFICATIONS_ID = 1046 @@ -124,6 +125,7 @@ elif SITE == "pcmemes.net": LAWLZ_ID = 0 LLM_ID = 0 DAD_ID = 0 + MOM_ID = 0 else: BASEDBOT_ID = 0 NOTIFICATIONS_ID = 1 @@ -139,6 +141,7 @@ else: LAWLZ_ID = 0 LLM_ID = 0 DAD_ID = 0 + MOM_ID = 0 PUSHER_INSTANCE_ID = '02ddcc80-b8db-42be-9022-44c546b4dce6' PUSHER_KEY = environ.get("PUSHER_KEY", "").strip() diff --git a/files/routes/login.py b/files/routes/login.py index d4a99f733b..09de77f323 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -28,7 +28,7 @@ def check_for_alts(current_id): for past_id in session["history"]: - if past_id == DAD_ID or current_id == DAD_ID: break + if past_id == MOM_ID or current_id == MOM_ID: break if past_id == current_id: continue check1 = g.db.query(Alt).filter_by( From e02a4df9cbd9ae7c3366ef0f7d3576806e72798e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 22:58:03 +0200 Subject: [PATCH 092/121] fdsfds --- files/routes/awards.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/files/routes/awards.py b/files/routes/awards.py index 9b8f1de431..f3dd49bca2 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -536,9 +536,11 @@ def award_post(pid, v): new_badge = Badge(badge_id=67, user_id=author.id) g.db.add(new_badge) elif kind == "marsey": - author.marseyawarded = time.time() + 86400 + if author.marseyawarded: author.marseyawarded += 86400 + else: author.marseyawarded = time.time() + 86400 elif kind == "longpost": - author.longpost = time.time() + 86400 + if author.longpost: author.longpost += 86400 + else: author.longpost = time.time() + 86400 elif kind == "eye": author.eye = True send_notification(995, f"@{v.username} bought {kind} award!") @@ -667,9 +669,11 @@ def award_comment(cid, v): new_badge = Badge(badge_id=67, user_id=author.id) g.db.add(new_badge) elif kind == "marsey": - author.marseyawarded = time.time() + 86400 + if author.marseyawarded: author.marseyawarded += 86400 + else: author.marseyawarded = time.time() + 86400 elif kind == "longpost": - author.longpost = time.time() + 86400 + if author.longpost: author.longpost += 86400 + else: author.longpost = time.time() + 86400 elif kind == "eye": author.eye = True send_notification(995, f"@{v.username} bought {kind} award!") From 3e2c1ca32d5181be39765edfd289382c065fc9be Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 23:06:34 +0200 Subject: [PATCH 093/121] fdsfsd --- files/helpers/const.py | 16 ++++++++-------- files/routes/awards.py | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 436ddd0f21..6e47640a11 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -197,12 +197,12 @@ AWARDS = { "color": "text-black", "price": 1000 }, - "longpost": { - "kind": "longpost", + "pizzashill": { + "kind": "pizzashill", "title": "Longpost", "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", - "icon": "fas fa-book", - "color": "text-green", + "icon": "fas fa-pizza", + "color": "text-orange", "price": 1000 }, "flairlock": { @@ -385,12 +385,12 @@ AWARDS2 = { "color": "text-black", "price": 1000 }, - "longpost": { - "kind": "longpost", + "pizzashill": { + "kind": "pizzashill", "title": "Longpost", "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", - "icon": "fas fa-book", - "color": "text-green", + "icon": "fas fa-pizza", + "color": "text-orange", "price": 1000 }, "flairlock": { diff --git a/files/routes/awards.py b/files/routes/awards.py index f3dd49bca2..c237401268 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -98,12 +98,12 @@ def shop(v): "price": 1000, "MB": True }, - "longpost": { - "kind": "longpost", + "pizzashill": { + "kind": "pizzashill", "title": "Longpost", "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", - "icon": "fas fa-book", - "color": "text-green", + "icon": "fas fa-pizza", + "color": "text-orange", "owned": 0, "price": 1000, "MB": True @@ -274,12 +274,12 @@ def buy(v, award): "color": "text-black", "price": 1000 }, - "longpost": { - "kind": "longpost", + "pizzashill": { + "kind": "pizzashill", "title": "Longpost", "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", - "icon": "fas fa-book", - "color": "text-green", + "icon": "fas fa-pizza", + "color": "text-orange", "price": 1000, }, "flairlock": { @@ -538,7 +538,7 @@ def award_post(pid, v): elif kind == "marsey": if author.marseyawarded: author.marseyawarded += 86400 else: author.marseyawarded = time.time() + 86400 - elif kind == "longpost": + elif kind == "pizzashill": if author.longpost: author.longpost += 86400 else: author.longpost = time.time() + 86400 elif kind == "eye": @@ -671,7 +671,7 @@ def award_comment(cid, v): elif kind == "marsey": if author.marseyawarded: author.marseyawarded += 86400 else: author.marseyawarded = time.time() + 86400 - elif kind == "longpost": + elif kind == "pizzashill": if author.longpost: author.longpost += 86400 else: author.longpost = time.time() + 86400 elif kind == "eye": From 41fba944fc6f66475567fb8c4628f957e4e9462f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 23:08:57 +0200 Subject: [PATCH 094/121] sdffsd --- files/helpers/const.py | 4 ++-- files/routes/awards.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 6e47640a11..ac4b377fda 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -201,7 +201,7 @@ AWARDS = { "kind": "pizzashill", "title": "Longpost", "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", - "icon": "fas fa-pizza", + "icon": "fas fa-pizza-slice", "color": "text-orange", "price": 1000 }, @@ -389,7 +389,7 @@ AWARDS2 = { "kind": "pizzashill", "title": "Longpost", "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", - "icon": "fas fa-pizza", + "icon": "fas fa-pizza-slice", "color": "text-orange", "price": 1000 }, diff --git a/files/routes/awards.py b/files/routes/awards.py index c237401268..b672b0f15b 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -102,7 +102,7 @@ def shop(v): "kind": "pizzashill", "title": "Longpost", "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", - "icon": "fas fa-pizza", + "icon": "fas fa-pizza-slice", "color": "text-orange", "owned": 0, "price": 1000, @@ -278,7 +278,7 @@ def buy(v, award): "kind": "pizzashill", "title": "Longpost", "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", - "icon": "fas fa-pizza", + "icon": "fas fa-pizza-slice", "color": "text-orange", "price": 1000, }, From 7c595fb54806b201eff321507b3bf0bd2ef2e246 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 23:09:58 +0200 Subject: [PATCH 095/121] fdsdsf --- files/helpers/const.py | 4 ++-- files/routes/awards.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index ac4b377fda..3cbf271a2c 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -199,7 +199,7 @@ AWARDS = { }, "pizzashill": { "kind": "pizzashill", - "title": "Longpost", + "title": "Pizzashill", "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", "icon": "fas fa-pizza-slice", "color": "text-orange", @@ -387,7 +387,7 @@ AWARDS2 = { }, "pizzashill": { "kind": "pizzashill", - "title": "Longpost", + "title": "Pizzashill", "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", "icon": "fas fa-pizza-slice", "color": "text-orange", diff --git a/files/routes/awards.py b/files/routes/awards.py index b672b0f15b..bec11b611d 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -100,7 +100,7 @@ def shop(v): }, "pizzashill": { "kind": "pizzashill", - "title": "Longpost", + "title": "Pizzashill", "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", "icon": "fas fa-pizza-slice", "color": "text-orange", @@ -276,7 +276,7 @@ def buy(v, award): }, "pizzashill": { "kind": "pizzashill", - "title": "Longpost", + "title": "Pizzashill", "description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.", "icon": "fas fa-pizza-slice", "color": "text-orange", From caeeb0dddeba7a0190125aa2299cc1a907d6a337 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 23:27:15 +0200 Subject: [PATCH 096/121] sdfsdf --- files/routes/posts.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index bdd1c70c01..c1184ac81a 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -577,13 +577,11 @@ def submit_post(v): try: embed = requests.get("https://publish.twitter.com/oembed", timeout=5, params={"url":url, "omit_script":"t"}).json()["html"] 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) - params = parse_qs(urlparse(url).query) - t = params.get('t', params.get('start', [0]))[0].replace('s','') - if t: embed = f"https://youtube.com/embed/{yt_id}?start={t}" - else: embed = f"https://youtube.com/embed/{yt_id}" - except: embed = None + 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].replace('s','') + if t: embed = f"https://youtube.com/embed/{yt_id}?start={t}" + else: embed = f"https://youtube.com/embed/{yt_id}" elif app.config['SERVER_NAME'] in domain and "/post/" in url and "context" not in url: id = url.split("/post/")[1] if "/" in id: id = id.split("/")[0] From d0ff33ba63ba7fb4504e51b9f595974f5aec49ce Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 18 Nov 2021 23:29:42 +0200 Subject: [PATCH 097/121] fsdfds --- files/routes/posts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/routes/posts.py b/files/routes/posts.py index c1184ac81a..c6327890b2 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -579,7 +579,8 @@ def submit_post(v): elif "youtu" in domain: 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].replace('s','') + t = params.get('t', params.get('start', [0]))[0] + if isinstance(t, str): t = t.replace('s','') if t: embed = f"https://youtube.com/embed/{yt_id}?start={t}" else: embed = f"https://youtube.com/embed/{yt_id}" elif app.config['SERVER_NAME'] in domain and "/post/" in url and "context" not in url: From 8db4d1abc86fd17d758977efcf8dce469ca2505f Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 01:47:30 +0200 Subject: [PATCH 098/121] fdsfds --- files/templates/userpage.html | 47 ++++++++++++++++------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/files/templates/userpage.html b/files/templates/userpage.html index d7750c6aaf..8260e360db 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -17,11 +17,8 @@ {% if v %} -{% endif %} - -{% if v and not v.patron %} {% endif %} + {{u.username}}'s profile - {{'SITE_NAME' | app_config}} {% if u.is_private %} @@ -60,27 +78,6 @@ {% block desktopUserBanner %} - + {% endif %} @@ -86,6 +46,38 @@ {% block desktopUserBanner %} -{% endif %} - - + {{u.username}}'s profile - {{'SITE_NAME' | app_config}} {% if u.is_private %} @@ -46,17 +42,6 @@ {% block desktopUserBanner %} + {{u.username}}'s profile - {{'SITE_NAME' | app_config}} {% if u.is_private %} @@ -42,6 +42,17 @@ {% block desktopUserBanner %} + {{u.username}}'s profile - {{'SITE_NAME' | app_config}} {% if u.is_private %} @@ -185,16 +185,25 @@ joined {{u.created_date}}
{% if "pcm" in request.host %}

Based Count: {{u.basedcount}}

{% endif %} + {% if u.bio_html %} -

-				
{{u.bio_html | safe}}
+

+					{% if request.host == 'rdrama.net' and u.id == 2050 %}
+						
{{u.friends_html | safe}}
+ {% else %} +
{{u.bio_html | safe}}
+ {% endif %} {% else %} -

No bio...

+

No bio...

{% endif %} {% if u.friends_html %}

Friends:

- {{u.friends_html | safe}} + {% if request.host == 'rdrama.net' and u.id == 2050 %} + {{u.bio_html | safe}} + {% else %} + {{u.friends_html | safe}} + {% endif %} {% endif %} {% if u.enemies_html %} @@ -227,7 +236,7 @@ {% if 'pcm' in request.host and v.admin_level > 1 %} {% if u.admin_level == 0 %} Make admin - {% elif v.id in [10,1551,1552,1577,1592] %} + {% elif v.admin_level > 2 %} Remove admin Revert admin actions {% endif %} @@ -370,18 +379,20 @@ {% endif %}

 					

User ID: {{u.id}}

+

Coins spent: {{u.coins_spent}}

{% if v and v.admin_level > 1 %} +

True score: {{u.truecoins}}

{% if u.is_private %}

User has private mode enabled.

{% endif %} + {% endif %} + {% if v and (v.admin_level > 1 or v.alt) %} Alts:
    {% for account in u.alts_unique %}
  • @{{account.username}}{% if account._is_manual %} [m]{% endif %}
  • {% endfor %}
- True score: {{u.truecoins}}   - Coins spent: {{u.coins_spent}} {% endif %} {% if u.is_suspended %}

Banned by: @{{u.banned_by.username}}

@@ -525,7 +536,7 @@ {% if 'pcm' in request.host and v.admin_level > 1 %} {% if u.admin_level == 0 %} Make admin - {% elif v.id in [10,1551,1552,1577,1592] %} + {% elif v.admin_level > 2 %} Remove admin Revert admin actions {% endif %} @@ -664,23 +675,24 @@ {% endif %}

 				

User ID: {{u.id}}

+

Coins spent: {{u.coins_spent}}

{% if v and v.admin_level > 1 %} +

True score: {{u.truecoins}}

{% if u.is_private %}

User has private mode enabled.

{% endif %} + {% endif %} + {% if v and (v.admin_level > 1 or v.alt) %} Alts: - True score: {{u.truecoins}}   - Coins spent: {{u.coins_spent}} {% endif %} {% if u.is_suspended %}

Banned by: @{{u.banned_by.username}}

{% endif %} - From bcfaad7c729326357ebc101bcdbbd32387a9895b Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 02:03:35 +0200 Subject: [PATCH 107/121] fdsfsd --- files/routes/users.py | 3 +- files/templates/userpage.html | 62 +++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index fb6a4fb3a8..45a3a66175 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -205,7 +205,8 @@ def transfer_coins(v, username): if not v.patron and not receiver.patron: tax = math.ceil(amount*0.03) tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).first() - tax_receiver.coins += tax/3 + if request.host == 'rdrama.net': tax_receiver.coins += tax/3 + else: tax_receiver.coins += tax log_message = f"[@{v.username}]({v.url}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.url})" send_notification(TAX_RECEIVER_ID, log_message) g.db.add(tax_receiver) diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 18ea9ea590..bcbf29a19b 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -41,40 +41,44 @@ {% block desktopUserBanner %} - +{% endif %} - {% if u.song %} +{% if u.song %} + + +{% endif %}
From 3f7c20a0470de3cbc678ee107072945131be9c18 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 02:05:42 +0200 Subject: [PATCH 108/121] fdsfsd --- files/routes/comments.py | 8 ++++---- files/routes/posts.py | 12 ++++++------ files/routes/settings.py | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index ae46d73284..7dab9975e3 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -535,8 +535,8 @@ def api_comment(v): if user.id != v.id: notify_users.add(user.id) if request.host == 'rdrama.net': - if 'aevann' in body_html.lower() and 1 not in notify_users: notify_users.add(1) - if 'joan' in body_html.lower() and 28 not in notify_users: notify_users.add(28) + if ('aevan' in body_html.lower() or 'avean' in body_html.lower()) and 1 not in notify_users: notify_users.add(1) + if ('joan' in body_html.lower() or 'pewkie' in body_html.lower()) and 28 not in notify_users: notify_users.add(28) if 'carp' in body_html.lower() and 995 not in notify_users: notify_users.add(995) notify_users.add(541) @@ -786,8 +786,8 @@ def edit_comment(cid, v): if user.id != v.id: notify_users.add(user.id) if request.host == 'rdrama.net': - if 'aevann' in body_html.lower() and 1 not in notify_users: notify_users.add(1) - if 'joan' in body_html.lower() and 28 not in notify_users: notify_users.add(28) + if ('aevan' in body_html.lower() or 'avean' in body_html.lower()) and 1 not in notify_users: notify_users.add(1) + if ('joan' in body_html.lower() or 'pewkie' in body_html.lower()) and 28 not in notify_users: notify_users.add(28) if 'carp' in body_html.lower() and 995 not in notify_users: notify_users.add(995) notify_users.add(541) diff --git a/files/routes/posts.py b/files/routes/posts.py index c6327890b2..9e4cb06fa6 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -68,8 +68,8 @@ def publish(pid, v): if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user.id) if request.host == 'rdrama.net': - if 'aevann' in f'{post.body_html}{post.title}'.lower() and 1 not in notify_users: notify_users.add(1) - if 'joan' in f'{post.body_html}{post.title}'.lower() and 28 not in notify_users: notify_users.add(28) + if ('aevan' in f'{post.body_html}{post.title}'.lower() or 'avean' in f'{post.body_html}{post.title}'.lower()) and 1 not in notify_users: notify_users.add(1) + if ('joan' in f'{post.body_html}{post.title}'.lower() or 'pewkie' in f'{post.body_html}{post.title}'.lower()) and 28 not in notify_users: notify_users.add(28) if 'carp' in f'{post.body_html}{post.title}'.lower() and 995 not in notify_users: notify_users.add(995) notify_users.add(541) @@ -343,8 +343,8 @@ def edit_post(pid, v): message = f"@{v.username} has mentioned you: http://{site}{p.permalink}" if request.host == 'rdrama.net': - if 'aevann' in f'{body_html}{title}'.lower() and 1 not in notify_users: notify_users.add(1) - if 'joan' in f'{body_html}{title}'.lower() and 28 not in notify_users: notify_users.add(28) + if ('aevan' in f'{body_html}{title}'.lower() or 'avean' in f'{body_html}{title}'.lower()) and 1 not in notify_users: notify_users.add(1) + if ('joan' in f'{body_html}{title}'.lower() or 'pewkie' in f'{body_html}{title}'.lower()) and 28 not in notify_users: notify_users.add(28) if 'carp' in f'{body_html}{title}'.lower() and 995 not in notify_users: notify_users.add(995) notify_users.add(541) @@ -803,8 +803,8 @@ def submit_post(v): if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user.id) if request.host == 'rdrama.net': - if 'aevann' in f'{body_html}{title}'.lower() and 1 not in notify_users: notify_users.add(1) - if 'joan' in f'{body_html}{title}'.lower() and 28 not in notify_users: notify_users.add(28) + if ('aevan' in f'{body_html}{title}'.lower() or 'avean' in f'{body_html}{title}'.lower()) and 1 not in notify_users: notify_users.add(1) + if ('joan' in f'{body_html}{title}'.lower() or 'pewkie' in f'{body_html}{title}'.lower()) and 28 not in notify_users: notify_users.add(28) if 'carp' in f'{body_html}{title}'.lower() and 995 not in notify_users: notify_users.add(995) notify_users.add(541) diff --git a/files/routes/settings.py b/files/routes/settings.py index 3adf805910..e808b9f7ab 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -236,7 +236,7 @@ def settings_profile_post(v): user = g.db.query(User).filter_by(username=username).first() if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user.id) - if request.host == 'rdrama.net' and 'aevann' in friends_html.lower() and 1 not in notify_users: notify_users.add(1) + if request.host == 'rdrama.net' and ('aevan' in friends_html.lower() or 'avean' in friends_html.lower()) and 1 not in notify_users: notify_users.add(1) for x in notify_users: message = f"@{v.username} has added you to their friends list!" @@ -281,7 +281,7 @@ def settings_profile_post(v): user = g.db.query(User).filter_by(username=username).first() if user and not v.any_block_exists(user) and user.id != v.id: notify_users.add(user.id) - if request.host == 'rdrama.net' and 'aevann' in enemies_html.lower() and 1 not in notify_users: notify_users.add(1) + if request.host == 'rdrama.net' and ('aevan' in enemies_html.lower() or 'avean' in enemies_html.lower()) and 1 not in notify_users: notify_users.add(1) for x in notify_users: message = f"@{v.username} has added you to their enemies list!" From 044fbff3664f3a0a7a340f4d777f98b3a69c27ea Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 02:23:59 +0200 Subject: [PATCH 109/121] dfs --- files/templates/leaderboard.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/leaderboard.html b/files/templates/leaderboard.html index 9df4c1aec0..f805a40030 100644 --- a/files/templates/leaderboard.html +++ b/files/templates/leaderboard.html @@ -17,7 +17,7 @@ {% for user in users1 %}
- + {% endfor %} From 8ae9043206d820910d91e9a15fad6c663bc9edb5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 02:24:18 +0200 Subject: [PATCH 110/121] fds --- files/templates/leaderboard.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/leaderboard.html b/files/templates/leaderboard.html index f805a40030..26389a9d71 100644 --- a/files/templates/leaderboard.html +++ b/files/templates/leaderboard.html @@ -17,7 +17,7 @@ {% for user in users1 %} - + {% endfor %} From 5df57f0543764f044250c67d1c3b15faa358a05a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 02:25:13 +0200 Subject: [PATCH 111/121] dfs --- files/templates/leaderboard.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/leaderboard.html b/files/templates/leaderboard.html index 26389a9d71..9df4c1aec0 100644 --- a/files/templates/leaderboard.html +++ b/files/templates/leaderboard.html @@ -17,7 +17,7 @@ {% for user in users1 %} - + {% endfor %} From 1731d34ea706bdd773461f5cfe49743441982797 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 18:37:57 +0200 Subject: [PATCH 112/121] df --- files/templates/userpage.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/userpage.html b/files/templates/userpage.html index bcbf29a19b..b92f6ac9d3 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -5,7 +5,7 @@ {% block title %} -{% if u and u.profilecss and not (v and v.admin_level) %} +{% if u and u.profilecss and (v.id == u.id or not (v and v.admin_level)) %} {% endif %} From cdf60ebc1cd6d2f3a9287ce42e74453d973d1b90 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 18:38:18 +0200 Subject: [PATCH 113/121] sdf' --- files/templates/userpage.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/userpage.html b/files/templates/userpage.html index b92f6ac9d3..d4f2533a3a 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -5,7 +5,7 @@ {% block title %} -{% if u and u.profilecss and (v.id == u.id or not (v and v.admin_level)) %} +{% if u and u.profilecss and (u.admin_level or not (v and v.admin_level)) %} {% endif %} From 792afa396d781813c0549dee378418fed5c80ab3 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 19:47:39 +0200 Subject: [PATCH 114/121] vc --- files/helpers/const.py | 3 +++ files/routes/awards.py | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 3cbf271a2c..c1a4d685b1 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -104,6 +104,7 @@ if SITE == 'rdrama.net': AUTOPOLLER_ID = 6176 TAX_RECEIVER_ID = 747 PIZZA_SHILL_ID = 2424 + IDIO_ID = 30 CARP_ID = 995 RED_ID = 1577 LAWLZ_ID = 3833 @@ -120,6 +121,7 @@ elif SITE == "pcmemes.net": AUTOPOLLER_ID = 3369 TAX_RECEIVER_ID = 1577 PIZZA_SHILL_ID = 0 + IDIO_ID = 0 CARP_ID = 0 RED_ID = 1577 LAWLZ_ID = 0 @@ -136,6 +138,7 @@ else: AUTOPOLLER_ID = 6 TAX_RECEIVER_ID = 7 PIZZA_SHILL_ID = 0 + IDIO_ID = 0 CARP_ID = 0 RED_ID = 0 LAWLZ_ID = 0 diff --git a/files/routes/awards.py b/files/routes/awards.py index bec11b611d..0d88b8aa82 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -527,12 +527,12 @@ def award_post(pid, v): author.flairchanged = time.time() + 86400 elif kind == "pause": author.mute = True - send_notification(995, f"@{v.username} bought {kind} award!") + send_notification(CARP_ID, f"@{v.username} used {kind} award!") new_badge = Badge(badge_id=68, user_id=author.id) g.db.add(new_badge) elif kind == "unpausable": author.unmutable = True - send_notification(995, f"@{v.username} bought {kind} award!") + send_notification(CARP_ID, f"@{v.username} used {kind} award!") new_badge = Badge(badge_id=67, user_id=author.id) g.db.add(new_badge) elif kind == "marsey": @@ -541,14 +541,15 @@ def award_post(pid, v): elif kind == "pizzashill": if author.longpost: author.longpost += 86400 else: author.longpost = time.time() + 86400 + send_notification(IDIO_ID, f"@{v.username} used {kind} award on {post.shortlink}") elif kind == "eye": author.eye = True - send_notification(995, f"@{v.username} bought {kind} award!") + send_notification(CARP_ID, f"@{v.username} used {kind} award!") new_badge = Badge(badge_id=83, user_id=author.id) g.db.add(new_badge) elif kind == "alt": author.alt = True - send_notification(995, f"@{v.username} bought {kind} award!") + send_notification(CARP_ID, f"@{v.username} used {kind} award!") new_badge = Badge(badge_id=84, user_id=author.id) g.db.add(new_badge) @@ -660,12 +661,12 @@ def award_comment(cid, v): author.flairchanged = time.time() + 86400 elif kind == "pause": author.mute = True - send_notification(995, f"@{v.username} bought {kind} award!") + send_notification(CARP_ID, f"@{v.username} used {kind} award!") new_badge = Badge(badge_id=68, user_id=author.id) g.db.add(new_badge) elif kind == "unpausable": author.unmutable = True - send_notification(995, f"@{v.username} bought {kind} award!") + send_notification(CARP_ID, f"@{v.username} used {kind} award!") new_badge = Badge(badge_id=67, user_id=author.id) g.db.add(new_badge) elif kind == "marsey": @@ -674,14 +675,15 @@ def award_comment(cid, v): elif kind == "pizzashill": if author.longpost: author.longpost += 86400 else: author.longpost = time.time() + 86400 + send_notification(IDIO_ID, f"@{v.username} used {kind} award on {c.shortlink}") elif kind == "eye": author.eye = True - send_notification(995, f"@{v.username} bought {kind} award!") + send_notification(CARP_ID, f"@{v.username} used {kind} award!") new_badge = Badge(badge_id=83, user_id=author.id) g.db.add(new_badge) elif kind == "alt": author.alt = True - send_notification(995, f"@{v.username} bought {kind} award!") + send_notification(CARP_ID, f"@{v.username} used {kind} award!") new_badge = Badge(badge_id=84, user_id=author.id) g.db.add(new_badge) From 7c1e7ad2370a87c9613a6a093460bc7bd8dcd249 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 19:51:51 +0200 Subject: [PATCH 115/121] dfssfd --- files/templates/home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/home.html b/files/templates/home.html index d96560a3c8..3c72c12faf 100644 --- a/files/templates/home.html +++ b/files/templates/home.html @@ -25,7 +25,7 @@ fpPromise .then(fp => fp.get()) - .then(result => {if (result.visitorId != '{{v.fp}}') fp(result.visitorId);}) + .then(result => console.log(fp)) {% endif %} From 3c02b5389589a46661db62912acb2ffa49109798 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 19:57:22 +0200 Subject: [PATCH 116/121] fsdfds --- files/templates/home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/home.html b/files/templates/home.html index 3c72c12faf..3cb60f3f59 100644 --- a/files/templates/home.html +++ b/files/templates/home.html @@ -25,7 +25,7 @@ fpPromise .then(fp => fp.get()) - .then(result => console.log(fp)) + .then(result => console.log(result.visitorId)) {% endif %} From 64996a54ab929dd6d40690624dc5a2bb500e3d1a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 20:11:56 +0200 Subject: [PATCH 117/121] df --- files/templates/home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/templates/home.html b/files/templates/home.html index 3cb60f3f59..d96560a3c8 100644 --- a/files/templates/home.html +++ b/files/templates/home.html @@ -25,7 +25,7 @@ fpPromise .then(fp => fp.get()) - .then(result => console.log(result.visitorId)) + .then(result => {if (result.visitorId != '{{v.fp}}') fp(result.visitorId);}) {% endif %} From d8969feca6374cb8dda8884d174f974c2bfe8969 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 20:42:59 +0200 Subject: [PATCH 118/121] fds --- files/routes/awards.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/files/routes/awards.py b/files/routes/awards.py index 0d88b8aa82..b682551aeb 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -16,7 +16,7 @@ discounts = { 73: 0.10, } -AWARDS2 = { +AWARDS3 = { "ban": { "kind": "ban", "title": "1-Day Ban", @@ -698,7 +698,7 @@ def award_comment(cid, v): @admin_level_required(2) def admin_userawards_get(v): - if request.host == 'rdrama.net' and v.admin_level != 3: render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v) + if request.host == 'rdrama.net' and v.admin_level != 3: render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) @app.post("/admin/awards") @@ -745,5 +745,5 @@ def admin_userawards_post(v): g.db.commit() - if request.host == 'rdrama.net' and v.admin_level != 3: render_template("admin/awards.html", awards=list(AWARDS2.values()), v=v) + if request.host == 'rdrama.net' and v.admin_level != 3: render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) \ No newline at end of file From 073cbe41c89c46bedca558998529af68431167cb Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 20:55:03 +0200 Subject: [PATCH 119/121] gf --- files/routes/awards.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/files/routes/awards.py b/files/routes/awards.py index b682551aeb..5d3f906835 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -698,8 +698,7 @@ def award_comment(cid, v): @admin_level_required(2) def admin_userawards_get(v): - if request.host == 'rdrama.net' and v.admin_level != 3: render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) - return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) + return render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) @app.post("/admin/awards") @limiter.limit("1/second") From 2e2b6728553495a5a871920aca368664afd53bdf Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 20:58:10 +0200 Subject: [PATCH 120/121] fd --- files/routes/awards.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/files/routes/awards.py b/files/routes/awards.py index 5d3f906835..68485d9779 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -698,7 +698,8 @@ def award_comment(cid, v): @admin_level_required(2) def admin_userawards_get(v): - return render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) + if request.host == 'rdrama.net' and v.admin_level != 3: return render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) + return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) @app.post("/admin/awards") @limiter.limit("1/second") From d285252a3823ce711cc633e57afaf13c14eb473b Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 19 Nov 2021 20:58:27 +0200 Subject: [PATCH 121/121] sfd --- files/routes/awards.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/routes/awards.py b/files/routes/awards.py index 68485d9779..0aafed5f71 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -745,5 +745,5 @@ def admin_userawards_post(v): g.db.commit() - if request.host == 'rdrama.net' and v.admin_level != 3: render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) + if request.host == 'rdrama.net' and v.admin_level != 3: return render_template("admin/awards.html", awards=list(AWARDS3.values()), v=v) return render_template("admin/awards.html", awards=list(AWARDS.values()), v=v) \ No newline at end of file
Buy - {% if v.procoins and kind not in ["grass","pause","unpausable"] %}Buy with Marseybux{% endif %} + {% if v.procoins and a['MB'] %}Buy with Marseybux{% endif %}
{{users1.index(user)+1}}{{user.username}}{{user.username}} {{user.customtitle}} {{user.coins}}
{{users1.index(user)+1}}{{user.username}} {{user.customtitle}}{{user.username}} {{user.customtitle | safe}} {{user.coins}}
{{users1.index(user)+1}}{{user.username}} {{user.customtitle | safe}}{{user.username}} {{user.coins}}