ip whitelists

This commit is contained in:
Seris02
2023-06-16 16:47:05 +08:00
parent d4c5742d6c
commit cf690461db
3 changed files with 26 additions and 0 deletions

View File

@@ -17,6 +17,8 @@
var/discord_ahelps_disabled = 0 //Turn this off if you don't want the TGS bot sending you messages whenever an ahelp ticket is created. var/discord_ahelps_disabled = 0 //Turn this off if you don't want the TGS bot sending you messages whenever an ahelp ticket is created.
var/discord_ahelps_all = 0 //Turn this on if you want all admin-PMs to go to be sent to discord, and not only the first message of a ticket. var/discord_ahelps_all = 0 //Turn this on if you want all admin-PMs to go to be sent to discord, and not only the first message of a ticket.
var/list/ip_whitelist = list()
/hook/startup/proc/read_ch_config() /hook/startup/proc/read_ch_config()
var/list/Lines = file2list("config/config.txt") var/list/Lines = file2list("config/config.txt")
for(var/t in Lines) for(var/t in Lines)
@@ -62,4 +64,20 @@
config.nodebot_location = value config.nodebot_location = value
if ("ahelp_channel_tag") if ("ahelp_channel_tag")
config.ahelp_channel_tag = value config.ahelp_channel_tag = value
var/list/ip_whitelist_lines = file2list("config/ip_whitelist.txt")
var/increment = 1
for(var/t in ip_whitelist_lines)
if (!t) continue
t = trim(t)
if (length(t) == 0)
continue
else if (copytext(t, 1, 2) == "#")
continue
var/ip_address = splittext(t, ",")
for (var/name in ip_address)
config.ip_whitelist[name] = increment
increment += 1
return 1 return 1

View File

@@ -9,6 +9,10 @@
if(M == src) continue if(M == src) continue
if( M.key && (M.key != key) ) if( M.key && (M.key != key) )
var/matches var/matches
//CHOMPEDIT - IP exemptions for those who are known to live together
if (config.ip_whitelist[key] && config.ip_whitelist[key] == config.ip_whitelist[M.key])
continue
//CHOMPEDIT end
if( (M.lastKnownIP == client.address) ) if( (M.lastKnownIP == client.address) )
matches += "IP ([client.address])" matches += "IP ([client.address])"
if( (client.connection != "web") && (M.computer_id == client.computer_id) ) if( (client.connection != "web") && (M.computer_id == client.computer_id) )

View File

@@ -0,0 +1,4 @@
# this file is for exempting certain groups of keys from recieving the "you're already in the game go away" message when they connect with the same IP (ie, living together)
# each group should be on the same line, separated by a comma (and nothing else), and each group should be on a separate line
# EXAMPLE (remove the # and it would be valid):
#somekey1,somekey2,somekey3