Sends info about banned account cookies and multikeying to admin chats (#31409)

* Sends information about banned account cookies and multikeying to admin chats

* Much saner

Co-authored-by: kanef <kanef9x@protonmail.com>
This commit is contained in:
kane-f
2021-12-05 18:06:23 +00:00
committed by GitHub
parent 9becf9c771
commit 06587834c9
5 changed files with 28 additions and 14 deletions

View File

@@ -1285,6 +1285,14 @@ var/global/floorIsLava = 0
if (istype(R) && R.emagged)
return TRUE
return (M.mind ? M.mind.antag_roles.len : null)
/proc/get_afk_admins()
var/admin_number_afk = 0
for(var/client/X in admins)
if(X.is_afk())
admin_number_afk++
return admin_number_afk
/*
/datum/admins/proc/get_sab_desc(var/target)
switch(target)

View File

@@ -804,10 +804,7 @@ var/list/admin_verbs_mod = list(
message_admins("[src] deadminned themself.")
if (ticker && ticker.current_state == GAME_STATE_PLAYING) //Only report this stuff if we are currently playing.
var/admins_number = admins.len
var/admin_number_afk = 0
for(var/client/X in admins)
if(X.is_afk())
admin_number_afk++
var/admin_number_afk = get_afk_admins()
var/available_admins = admins_number - admin_number_afk

View File

@@ -22,22 +22,28 @@
continue
if( M.key && (M.key != key) )
var/matches
var/matches_both = FALSE
if( (M.lastKnownIP == client.address) )
matches += "IP ([client.address])"
if( (M.computer_id == client.computer_id) )
if(matches)
matches += " and "
matches_both = TRUE
matches += "ID ([client.computer_id])"
#if WARN_FOR_CLIENTS_SHARING_IP
spawn() alert("You have logged in already with another key this round, please log out of this one NOW or risk being banned!")
#endif
if(matches)
if(M.client)
message_admins("<font color='red'><B>Notice: </B><span class='notice'><A href='?src=\ref[usr];priv_msg=\ref[src]'>[key_name_admin(src)]</A> has the same [matches] as <A href='?src=\ref[usr];priv_msg=\ref[M]'>[key_name_admin(M)]</A>.</span>", 1)
log_access("Notice: [key_name(src)] has the same [matches] as [key_name(M)].")
else
message_admins("<font color='red'><B>Notice: </B><span class='notice'><A href='?src=\ref[usr];priv_msg=\ref[src]'>[key_name_admin(src)]</A> has the same [matches] as [key_name_admin(M)] (no longer logged in). </span>", 1)
log_access("Notice: [key_name(src)] has the same [matches] as [key_name(M)] (no longer logged in).")
message_admins("<font color='red'><B>Notice: </B><span class='notice'><A href='?src=\ref[usr];priv_msg=\ref[src]'>[key_name_admin(src)]</A> has the same [matches] as <A href='?src=\ref[usr];priv_msg=\ref[M]'>[key_name_admin(M)]</A>[M.client ? "" : " (no longer logged in)"].</span>", 1)
log_access("Notice: [key_name(src)] has the same [matches] as [key_name(M)][M.client ? "" : " (no longer logged in)"].")
if(matches_both)
var/admins_number = admins.len
var/admin_number_afk = get_afk_admins()
var/available_admins = admins_number - admin_number_afk
//Dunno if it's okay to log IP or ID here
send2adminirc("Notice: [key_name(src)] has the same IP and ID as [key_name(M)][M.client ? "" : " (no longer logged in)"]. [available_admins ? "" : "No non-AFK admins online"]")
send2admindiscord("**Notice: [key_name(src)] has the same IP and ID as [key_name(M)][M.client ? "" : " (no longer logged in)"]. [available_admins ? "" : "No non-AFK admins online"]**", !available_admins)
// Do not call ..()
// If you do so and the mob is in nullspace BYOND will attempt to move the mob a gorillion times

View File

@@ -45,10 +45,7 @@
message_admins("Admin logout: [key_name(src)]")
if (ticker && ticker.current_state == GAME_STATE_PLAYING) //Only report this stuff if we are currently playing.
var/admins_number = admins.len
var/admin_number_afk = 0
for(var/client/X in admins)
if(X.is_afk())
admin_number_afk++
var/admin_number_afk = get_afk_admins()
var/available_admins = admins_number - admin_number_afk

View File

@@ -191,6 +191,12 @@ For the main html chat area
//TODO: add a new evasion ban for the CURRENT client details, using the matched row details
message_admins("<span class='danger big'>[key_name(src.owner)] has a cookie from a banned account! (Matched: [found["ckey"]], [found["ip"]], [found["compid"]])</span>")
log_admin("[key_name(src.owner)] has a cookie from a banned account! (Matched: [found["ckey"]], [found["ip"]], [found["compid"]])")
var/admins_number = admins.len
var/admin_number_afk = get_afk_admins()
var/available_admins = admins_number - admin_number_afk
//Probably not a good idea to print IP and CID in these channels
send2adminirc("[key_name(src.owner)] has a cookie from a banned account! (Matched: [found["ckey"]]) [available_admins ? "" : "No non-AFK admins online"]")
send2admindiscord("**[key_name(src.owner)] has a cookie from a banned account! (Matched: [found["ckey"]]) [available_admins ? "" : "No non-AFK admins online"]**", !available_admins)
cookieSent = 1