IPIntel Configuration

This commit is contained in:
AffectedArc07
2021-05-23 15:18:32 +01:00
parent d68480b8b4
commit 110f579464
8 changed files with 66 additions and 50 deletions
-28
View File
@@ -47,16 +47,6 @@
var/shuttle_refuel_delay = 12000
//IP Intel vars
var/ipintel_email
var/ipintel_rating_bad = 1
var/ipintel_save_good = 12
var/ipintel_save_bad = 1
var/ipintel_domain = "check.getipintel.net"
var/ipintel_maxplaytime = 0
var/ipintel_whitelist = 0
var/ipintel_detailsurl = "https://iphub.info/?ip="
var/ban_legacy_system = 0 //Defines whether the server uses the legacy banning system with the files in /data or the SQL system. Config option in config.txt
var/simultaneous_pm_warning_timeout = 100
@@ -147,24 +137,6 @@
if("list_afk_minimum")
config.list_afk_minimum = text2num(value)
if("ipintel_email")
if(value != "ch@nge.me")
config.ipintel_email = value
if("ipintel_rating_bad")
config.ipintel_rating_bad = text2num(value)
if("ipintel_domain")
config.ipintel_domain = value
if("ipintel_save_good")
config.ipintel_save_good = text2num(value)
if("ipintel_save_bad")
config.ipintel_save_bad = text2num(value)
if("ipintel_maxplaytime")
config.ipintel_maxplaytime = text2num(value)
if("ipintel_whitelist")
config.ipintel_whitelist = 1
if("ipintel_detailsurl")
config.ipintel_detailsurl = value
if("pregame_timestart")
config.pregame_timestart = text2num(value)
@@ -21,6 +21,8 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
var/datum/configuration_section/gamemode_configuration/gamemode
/// Holder for the gateway configuration datum
var/datum/configuration_section/gateway_configuration/gateway
/// Holder for the IPIntel configuration datum
var/datum/configuration_section/ipintel_configuration/ipintel
/// Holder for the job configuration datum
var/datum/configuration_section/job_configuration/jobs
/// Holder for the logging configuration datum
@@ -61,6 +63,7 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
event = new()
gamemode = new()
gateway = new()
ipintel = new()
jobs = new()
logging = new()
mc = new()
@@ -87,6 +90,7 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new())
event.load_data(raw_config_data["event_configuration"])
gamemode.load_data(raw_config_data["gamemode_configuration"])
gateway.load_data(raw_config_data["gateway_configuration"])
ipintel.load_data(raw_config_data["ipintel_configuration"])
jobs.load_data(raw_config_data["job_configuration"])
logging.load_data(raw_config_data["logging_configuration"])
mc.load_data(raw_config_data["mc_configuration"])
@@ -0,0 +1,34 @@
/// Config holder for all things relating to IPIntel
/datum/configuration_section/ipintel_configuration
/// Is IPIntel enabled
var/enabled = FALSE
/// Arew we in whitelist mode (Auto-kick people who are on proxies/VPNs)
var/whitelist_mode = TRUE
/// 0-1 float for percentage threshold to kick people out
var/bad_rating = 0.9
/// IPIntel contact email. Required.
var/contact_email = null
/// How many hours to save good matches for. Cached due to rate limits
var/hours_save_good = 72
/// How many hours to save bad matches for. Cached due to rate limits
var/hours_save_bad = 24
/// IPIntel Domain. Do not prefix with a protocol
var/ipintel_domain = "check.getipintel.net"
/// Do not proxy-check players with more hours than the below threshold
var/playtime_ignore_threshold = 10
/// Details URL for more info on an IP, including ASN. IP is tacked straight on the end.
var/details_url = "https://iphub.info/?ip="
/datum/configuration_section/ipintel_configuration/load_data(list/data)
// Use the load wrappers here. That way the default isnt made 'null' if you comment out the config line
CONFIG_LOAD_BOOL(enabled, data["ipintel_enabled"])
CONFIG_LOAD_BOOL(whitelist_mode, data["whitelist_mode"])
CONFIG_LOAD_NUM(bad_rating, data["bad_rating"])
CONFIG_LOAD_NUM(hours_save_good, data["hours_save_good"])
CONFIG_LOAD_NUM(hours_save_bad, data["hours_save_bad"])
CONFIG_LOAD_NUM(playtime_ignore_threshold, data["playtime_ignore_threshold"])
CONFIG_LOAD_STR(contact_email, data["contact_email"])
CONFIG_LOAD_STR(ipintel_domain, data["ipintel_domain"])
CONFIG_LOAD_STR(details_url, data["details_url"])