From 9bd8fcbd1cea2a92ac8c32a57c11510f658cf72b Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 10 May 2022 09:20:49 +0200 Subject: [PATCH] sf --- files/helpers/const.py | 8 ++++++ files/routes/admin.py | 36 ------------------------- files/routes/awards.py | 4 +++ files/routes/posts.py | 4 +++ files/routes/settings.py | 25 ++++++++++++++--- files/templates/authforms.html | 4 +-- files/templates/award_modal.html | 5 ++++ files/templates/chat.html | 2 +- files/templates/default.html | 4 +-- files/templates/log.html | 4 +-- files/templates/login.html | 2 +- files/templates/login_2fa.html | 2 +- files/templates/settings.html | 2 +- files/templates/settings2.html | 4 +-- files/templates/settings_profile.html | 22 +++++++++++++-- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submit.html | 4 +-- files/templates/userpage.html | 10 ------- 19 files changed, 79 insertions(+), 67 deletions(-) diff --git a/files/helpers/const.py b/files/helpers/const.py index 8aa6451cf..ff9368561 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -614,6 +614,14 @@ AWARDS = { "color": "text-gold", "price": 50000 }, + "checkmark": { + "kind": "checkmark", + "title": "Checkmark", + "description": "Gives the recipient a checkmark.", + "icon": "fas fa-badge-check", + "color": "checkmark", + "price": 100000 + }, } if SITE_NAME == 'PCM': diff --git a/files/routes/admin.py b/files/routes/admin.py index 0cd3e1764..0f13e7821 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -1098,42 +1098,6 @@ def unshadowban(user_id, v): g.db.commit() return {"message": "User unshadowbanned!"} -@app.post("/admin/verify/") -@limiter.limit("1/second;30/minute;200/hour;1000/day") -@admin_level_required(3) -def verify(user_id, v): - user = g.db.query(User).filter_by(id=user_id).one_or_none() - user.verified = "Verified" - g.db.add(user) - - ma = ModAction( - kind="check", - user_id=v.id, - target_user_id=user.id, - ) - g.db.add(ma) - - g.db.commit() - return {"message": "User verfied!"} - -@app.post("/admin/unverify/") -@limiter.limit("1/second;30/minute;200/hour;1000/day") -@admin_level_required(3) -def unverify(user_id, v): - user = g.db.query(User).filter_by(id=user_id).one_or_none() - user.verified = None - g.db.add(user) - - ma = ModAction( - kind="uncheck", - user_id=v.id, - target_user_id=user.id, - ) - g.db.add(ma) - - g.db.commit() - return {"message": "User unverified!"} - @app.post("/admin/title_change/") @limiter.limit("1/second;30/minute;200/hour;1000/day") diff --git a/files/routes/awards.py b/files/routes/awards.py index 230f1bc03..82f4a03c7 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -347,6 +347,8 @@ def award_post(pid, v): g.db.add(badge) g.db.flush() send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}") + elif kind == "checkmark": + author.verified = "Verified" if author.received_award_count: author.received_award_count += 1 else: author.received_award_count = 1 @@ -586,6 +588,8 @@ def award_comment(cid, v): g.db.add(badge) g.db.flush() send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}") + elif kind == "checkmark": + author.verified = "Verified" if author.received_award_count: author.received_award_count += 1 else: author.received_award_count = 1 diff --git a/files/routes/posts.py b/files/routes/posts.py index 6989f5a54..a0a0697ef 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1355,6 +1355,10 @@ def submit_post(v, sub=None): if body.startswith('!slots'): check_for_slots_command(body, snappy, c) + if body.startswith(':#marseypin:'): + post.stickied = "Snappy" + post.stickied_utc = int(time.time()) + 3600 + g.db.flush() c.top_comment_id = c.id diff --git a/files/routes/settings.py b/files/routes/settings.py index 6964efc66..36f177e67 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -394,8 +394,6 @@ def gumroad(v): v.procoins += procoins send_repeatable_notification(v.id, f"You have received {procoins} Marseybux! You can use them to buy awards in the [shop](/shop).") - if v.patron > 1 and v.verified == None: v.verified = "Verified" - g.db.add(v) if not v.has_badge(20+tier): @@ -879,7 +877,7 @@ def settings_title_change(v): new_name=request.values.get("title").strip()[:100].replace("𒐪","") - if new_name==v.customtitle: return render_template("settings_profile.html", v=v, error="You didn't change anything") + if new_name == v.customtitle: return render_template("settings_profile.html", v=v, error="You didn't change anything") v.customtitleplain = new_name @@ -892,6 +890,27 @@ def settings_title_change(v): return redirect("/settings/profile") +@app.post("/settings/checkmark_text") +@limiter.limit("1/second;30/minute;200/hour;1000/day") +@limiter.limit("1/second;30/minute;200/hour;1000/day", key_func=lambda:f'{request.host}-{session.get("lo_user")}') +@auth_required +def settings_checkmark_text(v): + + if not v.verified: abort(403) + + new_name=request.values.get("title").strip()[:100].replace("𒐪","") + + if not new_name: abort(400) + + if new_name == v.verified: return render_template("settings_profile.html", v=v, error="You didn't change anything") + + v.verified = new_name + g.db.add(v) + g.db.commit() + + return redirect("/settings/profile") + + @app.get("/settings") @auth_required def settings(v): diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 3389e30dc..eabaf5250 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -15,7 +15,7 @@ {% if v %} - + {% if v.agendaposter %} - + {% endif %} diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index e43adf94a..79e97dfc0 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -18,6 +18,11 @@
{{award.owned}} owned
{% endfor %} + + +
 
+
 
+
diff --git a/files/templates/chat.html b/files/templates/chat.html index 09de66fc9..b0b97ff43 100644 --- a/files/templates/chat.html +++ b/files/templates/chat.html @@ -14,7 +14,7 @@ Chat - + {% if v.css %} diff --git a/files/templates/default.html b/files/templates/default.html index d7c4c25d3..9dc2baa26 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -7,7 +7,7 @@ {% if v %} - + {% if v.agendaposter %} - + {% endif %} diff --git a/files/templates/log.html b/files/templates/log.html index af880bccc..cdf568f8e 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -6,7 +6,7 @@ {% block content %} {% if v %} - + {% if v.agendaposter %} - + {% endif %} diff --git a/files/templates/login.html b/files/templates/login.html index cb61e1d20..3c0e6dd26 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -18,7 +18,7 @@ {% endblock %} - + diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 1bec549c6..b3c391f4d 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -14,7 +14,7 @@ 2-Step Login - {{SITE_NAME}} - + diff --git a/files/templates/settings.html b/files/templates/settings.html index 1fb0bab42..ba49bfb4c 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -34,7 +34,7 @@ - + {% if v.agendaposter %} - + {% else %} - + {% endif %} diff --git a/files/templates/settings_profile.html b/files/templates/settings_profile.html index 45c4676af..c52aadf4a 100644 --- a/files/templates/settings_profile.html +++ b/files/templates/settings_profile.html @@ -514,7 +514,7 @@
- +
@@ -547,7 +547,25 @@
-
+ + +
+ + + +
+ +
+ + +
+ Limit of 100 characters + +
+
+
+ +
{% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 5eca120f5..5d2504290 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -31,7 +31,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %} - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index 25c09b2cc..c982157b8 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -32,7 +32,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %} - + diff --git a/files/templates/submit.html b/files/templates/submit.html index 38e3a7c43..1fa431a13 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -26,7 +26,7 @@ {% block stylesheets %} {% if v %} - + {% if v.agendaposter %} - + {% endif %} {% endblock %} diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 9cdc5cc7d..3d3c8083b 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -293,11 +293,6 @@

-						
-						{% if v.admin_level > 2 %}
-							Verify
-							Unverify
-						{% endif %}
 
 						

 						
@@ -608,11 +603,6 @@

 
-						{% if v.admin_level > 2 %}
-							Verify
-							Unverify
-						{% endif %}
-