This commit is contained in:
Aevann1 2022-01-11 05:28:35 +02:00
parent d8fe05603d
commit e979122a24
8 changed files with 130 additions and 8 deletions

View file

@ -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):";

View file

@ -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"},

View file

@ -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):

View file

@ -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:

View file

@ -37,7 +37,8 @@
<h4>Grant</h4>
<ul>
<li><a href="/admin/awards">Give User Award</a></li>
<li><a href="/admin/badge_grant">Badges</a></li>
<li><a href="/admin/badge_grant">Grant Badges</a></li>
<li><a href="/admin/badge_remove">Remove Badges</a></li>
</ul>
<h4>API Access Control</h4>

View file

@ -0,0 +1,89 @@
{% extends "default.html" %}
{% block title %}
<title>Badge Remove</title>
{% endblock %}
{% block pagetype %}message{% endblock %}
{% block content %}
{% if error %}
<div class="alert alert-danger alert-dismissible fade show my-3" role="alert">
<i class="fas fa-exclamation-circle my-auto"></i>
<span>
{{error}}
</span>
<button role="button" class="close" data-bs-dismiss="alert" aria-label="Close">
<span aria-hidden="true"><i class="far fa-times"></i></span>
</button>
</div>
{% endif %}
{% if msg %}
<div class="alert alert-success alert-dismissible fade show my-3" role="alert">
<i class="fas fa-check-circle my-auto" aria-hidden="true"></i>
<span>
{{msg}}
</span>
<button role="button" class="close" data-bs-dismiss="alert" aria-label="Close">
<span aria-hidden="true"><i class="far fa-times"></i></span>
</button>
</div>
{% endif %}
<pre></pre>
<pre></pre>
<h5>Badge Remove</h5>
<form action="/admin/badge_remove", method="post">
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
<label for="input-username">Username</label><br>
<input autocomplete="off" id="input-username" class="form-control" type="text" name="username" required>
<div class="overflow-x-auto"><table class="table table-striped">
<thead class="bg-primary text-white">
<tr>
<th scope="col">Select</th>
<th scope="col">Image</th>
<th scope="col">Name</th>
<th scope="col">Default Description</th>
</tr>
</thead>
<tbody>
{% for k, v in badge_types.items() %}
<tr>
<td>
<div class="custom-control">
<input autocomplete="off" checked="" class="custom-control-input" type="radio" id="{{k}}" name="badge_id" value="{{k}}">
<label class="custom-control-label" for="{{k}}"></label>
</div>
</td>
<td><label for="badge-{{k}}"><img alt="{{v['name']}}" loading="lazy" src="/static/assets/images/badges/{{v['name']}}.webp?a=3" width="70px" height="70px"></label></td>
<td>{{v['name']}}</td>
<td>{{v['description']}}</td>
</tr>
{% endfor %}
</table>
<label for="input-url">URL</label><br>
<input autocomplete="off" id="input-url" class="form-control" type="text" name="url" placeholder="Optional">
<label for="input-description">Custom description</label><br>
<input autocomplete="off" id="input-description" class="form-control" type="text" name="description" placeholder="Leave blank for badge default">
<input autocomplete="off" class="btn btn-primary" type="submit">
</form>
<style>
@media (max-width: 767.98px) {
table {
display: inline-block;
overflow: auto;
}
}
</style>
{% endblock %}

View file

@ -1,4 +1,4 @@
<script src="/static/assets/js/award_modal.js?a=3"></script>
<script src="/static/assets/js/award_modal.js?a=4"></script>
<div class="modal fade" id="awardModal" tabindex="-1" role="dialog" aria-labelledby="awardModalTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable modal-dialog-centered awardmodal" role="document">
<div class="modal-content">

View file

@ -80,7 +80,7 @@
</div>
</div>
<script src="/static/assets/js/emoji_modal.js?a=39"></script>
<script src="/static/assets/js/emoji_modal.js?a=40"></script>
<style>
a.emojitab {