master
Aevann1 2022-01-22 21:28:49 +02:00
parent 0b93902c2b
commit 5213add93d
4 changed files with 7 additions and 7 deletions

View File

@ -26,7 +26,7 @@ class Badge(Base):
@lazy
def badge(self):
with open("badges.json", 'r') as f:
return loads(f.read().replace("'",'"'))[str(self.badge_id)]
return loads(f.read())[str(self.badge_id)]
@property
@lazy

View File

@ -424,7 +424,7 @@ def under_attack(v):
@app.get("/admin/badge_grant")
@admin_level_required(2)
def badge_grant_get(v):
with open("badges.json", 'r') as f: BADGES = loads(f.read().replace("'",'"'))
with open("badges.json", 'r') as f: BADGES = loads(f.read())
return render_template("admin/badge_grant.html", v=v, badge_types=BADGES)
@ -432,7 +432,7 @@ def badge_grant_get(v):
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(2)
def badge_grant_post(v):
with open("badges.json", 'r') as f: BADGES = loads(f.read().replace("'",'"'))
with open("badges.json", 'r') as f: BADGES = loads(f.read())
user = get_user(request.values.get("username").strip(), graceful=True)
if not user:
@ -466,7 +466,7 @@ def badge_grant_post(v):
@app.get("/admin/badge_remove")
@admin_level_required(2)
def badge_remove_get(v):
with open("badges.json", 'r') as f: BADGES = loads(f.read().replace("'",'"'))
with open("badges.json", 'r') as f: BADGES = loads(f.read())
return render_template("admin/badge_remove.html", v=v, badge_types=BADGES)
@ -475,7 +475,7 @@ def badge_remove_get(v):
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(2)
def badge_remove_post(v):
with open("badges.json", 'r') as f: BADGES = loads(f.read().replace("'",'"'))
with open("badges.json", 'r') as f: BADGES = loads(f.read())
user = get_user(request.values.get("username").strip(), graceful=True)
if not user:

View File

@ -163,7 +163,7 @@ def api_comment(v):
try: badge_body = loads(body.lower())
except: return {"error": "You didn't follow the format retard"}, 500
badge_number = str(len(listdir('files/assets/images/badges'))+1)
with open("badges.json", 'r') as f: badges = loads(f.read().replace("'",'"'))
with open("badges.json", 'r') as f: badges = loads(f.read())
badges[badge_number] = badge_body
elif v.id in (CARP_ID,AEVANN_ID) and parent_post.id == 37838:
try:

View File

@ -366,7 +366,7 @@ def settings_profile(v):
@app.get("/badges")
@auth_required
def badges(v):
with open("badges.json", 'r') as f: BADGES = loads(f.read().replace("'",'"'))
with open("badges.json", 'r') as f: BADGES = loads(f.read())
return render_template("badges.html", v=v, badges=BADGES)