From e979122a246307e99ae092972c43937d118f9d72 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 11 Jan 2022 05:28:35 +0200 Subject: [PATCH] bb --- files/assets/js/award_modal.js | 2 +- files/assets/js/emoji_modal.js | 6 +- files/routes/admin.py | 32 +++++++++ files/routes/posts.py | 2 +- files/templates/admin/admin_home.html | 3 +- files/templates/admin/badge_remove.html | 89 +++++++++++++++++++++++++ files/templates/award_modal.html | 2 +- files/templates/emoji_modal.html | 2 +- 8 files changed, 130 insertions(+), 8 deletions(-) create mode 100644 files/templates/admin/badge_remove.html diff --git a/files/assets/js/award_modal.js b/files/assets/js/award_modal.js index d0eca0a48..f10130f1e 100644 --- a/files/assets/js/award_modal.js +++ b/files/assets/js/award_modal.js @@ -86,7 +86,7 @@ function bruh(kind) { document.getElementById(kind).classList.toggle('picked') if (kind == "flairlock") { document.getElementById('notelabel').innerHTML = "New flair:"; - document.getElementById('note').placeholder = "Insert new flair here..."; + document.getElementById('note').placeholder = "Insert new flair here, or leave empty to add 1 day to the duration of the current flair"; } else { document.getElementById('notelabel').innerHTML = "Note (optional):"; diff --git a/files/assets/js/emoji_modal.js b/files/assets/js/emoji_modal.js index abac09965..0031844b4 100644 --- a/files/assets/js/emoji_modal.js +++ b/files/assets/js/emoji_modal.js @@ -435,7 +435,7 @@ const EMOJIS_STRINGS = [ "marseyglowaward": {"author":"chiobu", "tags":"medal fbi ribbon animated glownigger retard glowie fed atf cia nsa"}, "marseygodel": {"author":"feynmandidnothingwrong", "tags":"old philosophy glasses history"}, "marseygodfather": {"author":"chapose", "tags":"wop italy italian dego mafia"}, - "marseygodzilla": {"author":"unknown", "tags":"raptor halloween dinosaur gojira evil bug"}, + "marseygodzilla": {"author":"feynmandidnothingwrong", "tags":"raptor halloween dinosaur gojira evil bug"}, "marseygondola": {"author":"cynic", "tags":"mustache meme long legs"}, "marseygoodnight": {"author":"saveusuncleted", "tags":"kazakhstan flag reaction kazakh i hate women women"}, "marseygossip": {"author":"dramarama", "tags":"tea rotary phone popcorn gabbing"}, @@ -676,7 +676,7 @@ const EMOJIS_STRINGS = [ "marseyretard": {"author":"kellere31", "tags":"special ed retarded reaction slow sped drooling exceptional"}, "marseyrevolution": {"author":"elfbinn", "tags":"marxist ussr marxism ccp hammer communist sickle communism proletariat juche kgb"}, "marseyrick": {"author":"altaccountumbreon", "tags":"smart 150iq high iq reaction 150 iq morty"}, - "marseyroo": {"author":"unknown", "tags":"kangaroo australian"}, + "marseyroo": {"author":"chapose", "tags":"kangaroo australian"}, "marseyrope": {"author":"fic8", "tags":"reaction suicidal shotgun facelift suicide"}, "marseyropeyourself": {"author":"sylveon", "tags":"kill yourself kys lynch reaction keep yourself safe hanging noose"}, "marseyropeyourself2": {"author":"sylveon", "tags":"kill yourself kys lynch reaction keep yourself safe hanging noose"}, @@ -743,7 +743,7 @@ const EMOJIS_STRINGS = [ "marseyspirit": {"author":"luke", "tags":"ghost halloween holiday"}, "marseyspit": {"author":"mom", "tags":"surprising reaction shocking water surprised shocked"}, "marseyspooky": {"author":"dramarama", "tags":"art horror halloween holiday evil scary monster lovecraftian eldritch"}, - "marseyspookysmile": {"author":"unknown", "tags":"horror halloween holiday evil scary monster"}, + "marseyspookysmile": {"author":"feynmandidnothingwrong", "tags":"horror halloween holiday evil scary monster"}, "marseysrdine": {"author":"saveusuncleted", "tags":"fisherman reaction fish canned fishing"}, "marseysrdine2": {"author":"sylveon", "tags":"can animated reaction fish knife chop sardine"}, "marseystars": {"author":"dramarama", "tags":"stareyes reaction star eyes starry eyed stareyed"}, diff --git a/files/routes/admin.py b/files/routes/admin.py index 3ab6867de..074136a9d 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -460,6 +460,38 @@ def badge_grant_post(v): return render_template(f"{template}admin/badge_grant.html", v=v, badge_types=BADGES, msg="Badge granted!") + +@app.get("/admin/badge_remove") +@admin_level_required(2) +def badge_remove_get(v): + if not v or v.oldsite: template = '' + else: template = 'CHRISTMAS/' + + return render_template(f"{template}admin/badge_remove.html", v=v, badge_types=BADGES) + + +@app.post("/admin/badge_remove") +@limiter.limit("1/second") +@admin_level_required(2) +def badge_remove_post(v): + if not v or v.oldsite: template = '' + else: template = 'CHRISTMAS/' + + user = get_user(request.values.get("username").strip(), graceful=True) + if not user: + return render_template(f"{template}admin/badge_remove.html", v=v, badge_types=BADGES, error="User not found.") + + try: badge_id = int(request.values.get("badge_id")) + except: abort(400) + + badge = user.has_badge(badge_id) + if badge: + g.db.delete(badge) + g.db.commit() + + return render_template(f"{template}admin/badge_remove.html", v=v, badge_types=BADGES, msg="Badge removed!") + + @app.get("/admin/users") @admin_level_required(2) def users_list(v): diff --git a/files/routes/posts.py b/files/routes/posts.py index 54fab4e6f..955f61738 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -201,7 +201,7 @@ def post_id(pid, anything=None, v=None): offset = 0 - if not request.headers.get("Authorization") and post.comment_count > 60 and not (v and v.id == 1): + if not request.headers.get("Authorization") and post.comment_count > 60: comments2 = [] count = 0 if post.created_utc > 1638672040: diff --git a/files/templates/admin/admin_home.html b/files/templates/admin/admin_home.html index 0c1f338a2..2092570bc 100644 --- a/files/templates/admin/admin_home.html +++ b/files/templates/admin/admin_home.html @@ -37,7 +37,8 @@

Grant

API Access Control

diff --git a/files/templates/admin/badge_remove.html b/files/templates/admin/badge_remove.html new file mode 100644 index 000000000..3a32758d2 --- /dev/null +++ b/files/templates/admin/badge_remove.html @@ -0,0 +1,89 @@ +{% extends "default.html" %} + +{% block title %} +Badge Remove +{% endblock %} + +{% block pagetype %}message{% endblock %} + +{% block content %} + + {% if error %} + + {% endif %} + {% if msg %} + + {% endif %} + +

+

+
Badge Remove
+ +
+ + + +
+ + +
+ + + + + + + + + +{% for k, v in badge_types.items() %} + + + + + + +{% endfor %} +
SelectImageNameDefault Description
+
+ + +
+
{{v['name']}}{{v['description']}}
+ +
+ + +
+ + + + + + + + +{% endblock %} diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index 72d72985c..b6091c700 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -1,4 +1,4 @@ - +