make blackjack affect usernames too

master
Aevann 2023-10-26 23:08:29 +03:00
parent 6dbdf10531
commit 0b0f8c69d5
4 changed files with 15 additions and 26 deletions

View File

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

View File

@ -412,6 +412,7 @@ 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.")
if not execute_blackjack(v, None, new_name, f'namelock award attempt on @{author.username}'):
existing = get_user(new_name, graceful=True) existing = get_user(new_name, graceful=True)
if existing and existing.id != author.id: if existing and existing.id != author.id:
abort(400, f"@{new_name} is already taken!") abort(400, f"@{new_name} is already taken!")

View File

@ -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('/')

View File

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