mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Moves cross_address/allowed to the config. Merges the protected config into the regular. (#24584)
* Moves cross_address/allowed to the config * Protect it against modifications * I'll do you one better * Merge in the protected configuration
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
var/datum/configuration/config = null
|
||||
var/datum/protected_configuration/protected_config = null
|
||||
|
||||
var/host = null
|
||||
var/join_motd = null
|
||||
@@ -26,10 +25,6 @@ var/Debug2 = 0
|
||||
var/global/comms_key = "default_pwd"
|
||||
var/global/comms_allowed = 0 //By default, the server does not allow messages to be sent to it, unless the key is strong enough (this is to prevent misconfigured servers from becoming vulnerable)
|
||||
|
||||
//Cross server communications
|
||||
var/global/cross_address = "byond://" //This needs to be global as the message sent contains the comms key.
|
||||
var/global/cross_allowed = 0 //Don't bother attempting to send if the address wasn't set.
|
||||
|
||||
var/global/medal_hub = null
|
||||
var/global/medal_pass = " "
|
||||
var/global/medals_enabled = TRUE //will be auto set to false if the game fails contacting the medal hub to prevent unneeded calls.
|
||||
|
||||
@@ -5,20 +5,24 @@
|
||||
#define SECURITY_HAS_MAINT_ACCESS 2
|
||||
#define EVERYONE_HAS_MAINT_ACCESS 4
|
||||
|
||||
//Not accessible from usual debug controller verb
|
||||
/datum/protected_configuration
|
||||
var/autoadmin = 0
|
||||
var/autoadmin_rank = "Game Admin"
|
||||
|
||||
/datum/protected_configuration/vv_get_var(var_name)
|
||||
/datum/configuration/vv_get_var(var_name)
|
||||
var/static/list/banned_views = list("autoadmin", "autoadmin_rank")
|
||||
if(var_name in banned_views)
|
||||
return debug_variable(var_name, "SECRET", 0, src)
|
||||
return ..()
|
||||
|
||||
/datum/protected_configuration/vv_edit_var(var_name, var_value)
|
||||
/datum/configuration/vv_edit_var(var_name, var_value)
|
||||
var/static/list/banned_edits = list("cross_address", "cross_allowed", "autoadmin", "autoadmin_rank")
|
||||
if(var_name in banned_edits)
|
||||
return FALSE
|
||||
return ..()
|
||||
|
||||
/datum/configuration
|
||||
var/name = "Configuration" // datum name
|
||||
|
||||
var/autoadmin = 0
|
||||
var/autoadmin_rank = "Game Admin"
|
||||
|
||||
var/server_name = null // server name (the name of the game window)
|
||||
var/server_sql_name = null // short form server name used for the DB
|
||||
var/station_name = null // station name (the name of the station in-game)
|
||||
@@ -236,6 +240,8 @@
|
||||
var/client_error_message = "Your version of byond is too old, may have issues, and is blocked from accessing this server."
|
||||
|
||||
var/cross_name = "Other server"
|
||||
var/cross_address = "byond://"
|
||||
var/cross_allowed = FALSE
|
||||
var/showircname = 0
|
||||
|
||||
var/list/gamemode_cache = null
|
||||
@@ -415,9 +421,9 @@
|
||||
if(value != "default_pwd" && length(value) > 6) //It's the default value or less than 6 characters long, warn badmins
|
||||
global.comms_allowed = 1
|
||||
if("cross_server_address")
|
||||
global.cross_address = value
|
||||
cross_address = value
|
||||
if(value != "byond:\\address:port")
|
||||
global.cross_allowed = 1
|
||||
cross_allowed = 1
|
||||
if("cross_comms_name")
|
||||
cross_name = value
|
||||
if("panic_server_name")
|
||||
@@ -488,9 +494,9 @@
|
||||
if("maprotationchancedelta")
|
||||
config.maprotatechancedelta = text2num(value)
|
||||
if("autoadmin")
|
||||
protected_config.autoadmin = 1
|
||||
config.autoadmin = 1
|
||||
if(value)
|
||||
protected_config.autoadmin_rank = ckeyEx(value)
|
||||
config.autoadmin_rank = ckeyEx(value)
|
||||
if("generate_minimaps")
|
||||
config.generate_minimaps = 1
|
||||
if("client_warn_version")
|
||||
|
||||
@@ -394,7 +394,6 @@ var/datum/controller/subsystem/garbage_collector/SSgarbage
|
||||
SearchVar(WALLITEMS_INVERSE)
|
||||
SearchVar(sortInstance)
|
||||
SearchVar(config)
|
||||
SearchVar(protected_config)
|
||||
SearchVar(host)
|
||||
SearchVar(join_motd)
|
||||
SearchVar(station_name)
|
||||
@@ -412,8 +411,6 @@ var/datum/controller/subsystem/garbage_collector/SSgarbage
|
||||
SearchVar(Debug2)
|
||||
SearchVar(comms_key)
|
||||
SearchVar(comms_allowed)
|
||||
SearchVar(cross_address)
|
||||
SearchVar(cross_allowed)
|
||||
SearchVar(medal_hub)
|
||||
SearchVar(medal_pass)
|
||||
SearchVar(medals_enabled)
|
||||
|
||||
@@ -513,7 +513,7 @@ var/datum/controller/subsystem/ticker/ticker
|
||||
|
||||
CHECK_TICK
|
||||
|
||||
if(cross_allowed)
|
||||
if(config.cross_allowed)
|
||||
send_news_report()
|
||||
|
||||
CHECK_TICK
|
||||
|
||||
@@ -455,7 +455,7 @@ var/const/CALL_SHUTTLE_REASON_LENGTH = 12
|
||||
if (src.authenticated==2)
|
||||
dat += "<BR><BR><B>Captain Functions</B>"
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=announce'>Make a Captain's Announcement</A> \]"
|
||||
if(cross_allowed)
|
||||
if(config.cross_allowed)
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=crossserver'>Send a message to an allied station</A> \]"
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=purchase_menu'>Purchase Shuttle</A> \]"
|
||||
dat += "<BR>\[ <A HREF='?src=\ref[src];operation=changeseclevel'>Change Alert Level</A> \]"
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
return
|
||||
|
||||
/proc/send2otherserver(source,msg,type = "Ahelp")
|
||||
if(global.cross_allowed)
|
||||
if(config.cross_allowed)
|
||||
var/list/message = list()
|
||||
message["message_sender"] = source
|
||||
message["message"] = msg
|
||||
@@ -175,7 +175,7 @@
|
||||
message["key"] = global.comms_key
|
||||
message["crossmessage"] = type
|
||||
|
||||
world.Export("[global.cross_address]?[list2params(message)]")
|
||||
world.Export("[config.cross_address]?[list2params(message)]")
|
||||
|
||||
|
||||
/proc/ircadminwho()
|
||||
|
||||
@@ -166,11 +166,11 @@ var/next_external_rsc = 0
|
||||
if(localhost_rank)
|
||||
var/datum/admins/localhost_holder = new(localhost_rank, ckey)
|
||||
localhost_holder.associate(src)
|
||||
if(protected_config.autoadmin)
|
||||
if(config.autoadmin)
|
||||
if(!admin_datums[ckey])
|
||||
var/datum/admin_rank/autorank
|
||||
for(var/datum/admin_rank/R in admin_ranks)
|
||||
if(R.name == protected_config.autoadmin_rank)
|
||||
if(R.name == config.autoadmin_rank)
|
||||
autorank = R
|
||||
break
|
||||
if(!autorank)
|
||||
|
||||
@@ -64,7 +64,7 @@ var/global/static/observer_default_invisibility = INVISIBILITY_OBSERVER
|
||||
|
||||
verbs += /mob/dead/observer/proc/dead_tele
|
||||
|
||||
if(global.cross_allowed)
|
||||
if(config.cross_allowed)
|
||||
verbs += /mob/dead/observer/proc/server_hop
|
||||
|
||||
ghostimage = image(src.icon,src,src.icon_state)
|
||||
@@ -606,16 +606,20 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
set desc= "Jump to the other server"
|
||||
if(notransform)
|
||||
return
|
||||
if (alert(src, "Jump to server running at [global.cross_address]?", "Server Hop", "Yes", "No") != "Yes")
|
||||
if(!config.cross_allowed)
|
||||
verbs -= /mob/dead/observer/proc/server_hop
|
||||
src << "<span class='notice'>Server Hop has been disabled.</span>"
|
||||
return
|
||||
if (alert(src, "Jump to server running at [config.cross_address]?", "Server Hop", "Yes", "No") != "Yes")
|
||||
return 0
|
||||
if (client && global.cross_allowed)
|
||||
src << "<span class='notice'>Sending you to [global.cross_address].</span>"
|
||||
if (client && config.cross_allowed)
|
||||
src << "<span class='notice'>Sending you to [config.cross_address].</span>"
|
||||
new /obj/screen/splash(client)
|
||||
notransform = TRUE
|
||||
sleep(29) //let the animation play
|
||||
notransform = FALSE
|
||||
winset(src, null, "command=.options") //other wise the user never knows if byond is downloading resources
|
||||
client << link(global.cross_address + "?server_hop=[key]")
|
||||
client << link(config.cross_address + "?server_hop=[key]")
|
||||
else
|
||||
src << "<span class='error'>There is no other server configured!</span>"
|
||||
|
||||
|
||||
@@ -274,7 +274,6 @@
|
||||
join_motd = file2text("config/motd.txt") + "<br>" + revdata.GetTestMergeInfo()
|
||||
|
||||
/world/proc/load_configuration()
|
||||
protected_config = new /datum/protected_configuration()
|
||||
config = new /datum/configuration()
|
||||
config.load("config/config.txt")
|
||||
config.load("config/game_options.txt","game_options")
|
||||
|
||||
Reference in New Issue
Block a user