forked from MarseyWorld/MarseyWorld
make blackjack affect usernames too
parent
6dbdf10531
commit
0b0f8c69d5
|
@ -511,27 +511,11 @@ def execute_antispam_comment_check(body, v):
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
abort(403, "Too much spam!")
|
abort(403, "Too much spam!")
|
||||||
|
|
||||||
def execute_by_username(v):
|
|
||||||
username = v.username.lower()
|
|
||||||
if username.startswith("icosaka") or ("dylan" in username and "hewitt" in username):
|
|
||||||
v.shadowbanned = AUTOJANNY_ID
|
|
||||||
v.ban_reason = "Banned username"
|
|
||||||
g.db.add(v)
|
|
||||||
ma = ModAction(
|
|
||||||
kind="shadowban",
|
|
||||||
user_id=AUTOJANNY_ID,
|
|
||||||
target_user_id=v.id,
|
|
||||||
_note=f'reason: "Banned username ({v.age} seconds)"'
|
|
||||||
)
|
|
||||||
g.db.add(ma)
|
|
||||||
|
|
||||||
def execute_under_siege(v, target, body, kind):
|
def execute_under_siege(v, target, body, kind):
|
||||||
if v.shadowbanned: return
|
if v.shadowbanned: return
|
||||||
|
|
||||||
if SITE == 'watchpeopledie.tv':
|
if SITE == 'watchpeopledie.tv' and kind != 'post':
|
||||||
execute_by_username(v)
|
return
|
||||||
if v.shadowbanned: return
|
|
||||||
if kind != 'post': return
|
|
||||||
|
|
||||||
if not get_setting("under_siege"): return
|
if not get_setting("under_siege"): return
|
||||||
if v.admin_level >= PERMS['BYPASS_UNDER_SIEGE_MODE']: return
|
if v.admin_level >= PERMS['BYPASS_UNDER_SIEGE_MODE']: return
|
||||||
|
|
|
@ -412,15 +412,16 @@ def award_thing(v, thing_type, id):
|
||||||
if not valid_username_regex.fullmatch(new_name):
|
if not valid_username_regex.fullmatch(new_name):
|
||||||
abort(400, "You need to enter a valid username to change the recipient to.")
|
abort(400, "You need to enter a valid username to change the recipient to.")
|
||||||
|
|
||||||
existing = get_user(new_name, graceful=True)
|
if not execute_blackjack(v, None, new_name, f'namelock award attempt on @{author.username}'):
|
||||||
if existing and existing.id != author.id:
|
existing = get_user(new_name, graceful=True)
|
||||||
abort(400, f"@{new_name} is already taken!")
|
if existing and existing.id != author.id:
|
||||||
|
abort(400, f"@{new_name} is already taken!")
|
||||||
|
|
||||||
if not author.prelock_username:
|
if not author.prelock_username:
|
||||||
author.prelock_username = author.username
|
author.prelock_username = author.username
|
||||||
author.username = new_name
|
author.username = new_name
|
||||||
author.namechanged = int(time.time()) + 86400
|
author.namechanged = int(time.time()) + 86400
|
||||||
badge_grant(user=author, badge_id=281)
|
badge_grant(user=author, badge_id=281)
|
||||||
elif kind == "pause":
|
elif kind == "pause":
|
||||||
badge_grant(badge_id=68, user=author)
|
badge_grant(badge_id=68, user=author)
|
||||||
elif kind == "unpausable":
|
elif kind == "unpausable":
|
||||||
|
|
|
@ -359,6 +359,8 @@ def sign_up_post(v):
|
||||||
elif CARP_ID:
|
elif CARP_ID:
|
||||||
send_notification(CARP_ID, f"A new user - @{new_user.username} - has signed up!")
|
send_notification(CARP_ID, f"A new user - @{new_user.username} - has signed up!")
|
||||||
|
|
||||||
|
execute_blackjack(new_user, None, new_user.username, 'username')
|
||||||
|
|
||||||
if redir and is_site_url(redir) and redir not in NO_LOGIN_REDIRECT_URLS:
|
if redir and is_site_url(redir) and redir not in NO_LOGIN_REDIRECT_URLS:
|
||||||
return redirect(redir)
|
return redirect(redir)
|
||||||
return redirect('/')
|
return redirect('/')
|
||||||
|
|
|
@ -777,6 +777,8 @@ def settings_name_change(v):
|
||||||
|
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
||||||
|
execute_blackjack(v, None, v.username, 'username')
|
||||||
|
|
||||||
return {"message": "Name successfully changed!"}
|
return {"message": "Name successfully changed!"}
|
||||||
|
|
||||||
@app.post("/settings/song_change_mp3")
|
@app.post("/settings/song_change_mp3")
|
||||||
|
|
Loading…
Reference in New Issue