This commit is contained in:
kevinz000
2020-01-07 04:54:11 -08:00
parent ab2292dfd5
commit fa7dcad49a
5 changed files with 18 additions and 5 deletions

View File

@@ -47,6 +47,7 @@
// Subsystems shutdown in the reverse of the order they initialize in // Subsystems shutdown in the reverse of the order they initialize in
// The numbers just define the ordering, they are meaningless otherwise. // The numbers just define the ordering, they are meaningless otherwise.
#define INIT_ORDER_FAIL2TOPIC 22
#define INIT_ORDER_TITLE 20 #define INIT_ORDER_TITLE 20
#define INIT_ORDER_GARBAGE 19 #define INIT_ORDER_GARBAGE 19
#define INIT_ORDER_DBCORE 18 #define INIT_ORDER_DBCORE 18

View File

@@ -139,7 +139,7 @@
if (CONFIG_GET(flag/log_job_debug)) if (CONFIG_GET(flag/log_job_debug))
WRITE_LOG(GLOB.world_job_debug_log, "JOB: [text]") WRITE_LOG(GLOB.world_job_debug_log, "JOB: [text]")
/proc/log_ss(subsystem, text) /proc/log_subsystem(subsystem, text)
WRITE_LOG(GLOB.subsystem_log, "[subsystem]: [text]") WRITE_LOG(GLOB.subsystem_log, "[subsystem]: [text]")
/* Log to both DD and the logfile. */ /* Log to both DD and the logfile. */

View File

@@ -30,6 +30,8 @@ GLOBAL_VAR(world_virus_log)
GLOBAL_PROTECT(world_virus_log) GLOBAL_PROTECT(world_virus_log)
GLOBAL_VAR(world_map_error_log) GLOBAL_VAR(world_map_error_log)
GLOBAL_PROTECT(world_map_error_log) GLOBAL_PROTECT(world_map_error_log)
GLOBAL_VAR(subsystem_log)
GLOBAL_PROTECT(subsystem_log)
GLOBAL_LIST_EMPTY(bombers) GLOBAL_LIST_EMPTY(bombers)
GLOBAL_PROTECT(bombers) GLOBAL_PROTECT(bombers)

View File

@@ -13,3 +13,7 @@
/datum/config_entry/number/topic_max_size /datum/config_entry/number/topic_max_size
config_entry_value = 8192 config_entry_value = 8192
/datum/config_entry/keyed_list/topic_rate_limit_whitelist
key_type = KEY_MODE_TEXT
value_type = VALUE_MODE_FLAG

View File

@@ -1,7 +1,8 @@
SUBSYSTEM_DEF(fail2topic) SUBSYSTEM_DEF(fail2topic)
name = "Fail2Topic" name = "Fail2Topic"
init_order = SS_INIT_MISC_FIRST init_order = INIT_ORDER_FAIL2TOPIC
flags = SS_FIRE_IN_LOBBY | SS_BACKGROUND flags = SS_BACKGROUND
runlevels = ALL
var/list/rate_limiting = list() var/list/rate_limiting = list()
var/list/fail_counts = list() var/list/fail_counts = list()
@@ -47,8 +48,13 @@ SUBSYSTEM_DEF(fail2topic)
/datum/controller/subsystem/fail2topic/proc/IsRateLimited(ip) /datum/controller/subsystem/fail2topic/proc/IsRateLimited(ip)
var/last_attempt = rate_limiting[ip] var/last_attempt = rate_limiting[ip]
if (config?.api_rate_limit_whitelist[ip]) var/static/datum/config_entry/keyed_list/topic_rate_limit_whitelist/cached_whitelist_entry
return FALSE if(!istype(cached_whitelist_entry))
cached_whitelist_entry = CONFIG_GET(keyed_list/topic_rate_limit_whitelist)
if(istype(cached_whitelist_entry))
if(cached_whitelist_entry.config_entry_value[ip])
return FALSE
if (active_bans[ip]) if (active_bans[ip])
return TRUE return TRUE