master
Aevann1 2022-02-07 17:07:44 +02:00
parent 651f446a48
commit 4c3ac26ab3
1 changed files with 23 additions and 25 deletions

View File

@ -221,20 +221,19 @@ def club_ban(v, username):
@limiter.limit("1/second;30/minute;200/hour;1000/day") @limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(3) @admin_level_required(3)
def make_meme_admin(v, username): def make_meme_admin(v, username):
if request.host == 'pcmemes.net' or (SITE_NAME == 'Drama' and v.admin_level > 2) or (request.host != 'rdrama.net' and request.host != 'pcmemes.net'): user = get_user(username)
user = get_user(username) if not user: abort(404)
if not user: abort(404) user.admin_level = 1
user.admin_level = 1 g.db.add(user)
g.db.add(user)
ma = ModAction( ma = ModAction(
kind="make_meme_admin", kind="make_meme_admin",
user_id=v.id, user_id=v.id,
target_user_id=user.id target_user_id=user.id
) )
g.db.add(ma) g.db.add(ma)
g.db.commit() g.db.commit()
return {"message": "User has been made meme admin!"} return {"message": "User has been made meme admin!"}
@ -242,20 +241,19 @@ def make_meme_admin(v, username):
@limiter.limit("1/second;30/minute;200/hour;1000/day") @limiter.limit("1/second;30/minute;200/hour;1000/day")
@admin_level_required(3) @admin_level_required(3)
def remove_meme_admin(v, username): def remove_meme_admin(v, username):
if request.host == 'pcmemes.net' or (SITE_NAME == 'Drama' and v.admin_level > 2) or (request.host != 'rdrama.net' and request.host != 'pcmemes.net'): user = get_user(username)
user = get_user(username) if not user: abort(404)
if not user: abort(404) user.admin_level = 0
user.admin_level = 0 g.db.add(user)
g.db.add(user)
ma = ModAction( ma = ModAction(
kind="remove_meme_admin", kind="remove_meme_admin",
user_id=v.id, user_id=v.id,
target_user_id=user.id target_user_id=user.id
) )
g.db.add(ma) g.db.add(ma)
g.db.commit() g.db.commit()
return {"message": "Meme admin removed!"} return {"message": "Meme admin removed!"}
@ -263,7 +261,7 @@ def remove_meme_admin(v, username):
@limiter.limit("1/day") @limiter.limit("1/day")
@admin_level_required(3) @admin_level_required(3)
def monthly(v): def monthly(v):
if request.host == 'rdrama.net' and v.id != AEVANN_ID: abort (403) if SITE_NAME == 'Drama' and v.id != AEVANN_ID: abort (403)
thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id