Adds format=json support to world/topic (#50446)

random fact: the original game banners from erro used a custom url decoder. It wasn't until a year or two in to me being host that i caught on and fixed this.
This commit is contained in:
Kyle Spier-Swenson
2020-04-18 11:01:20 +12:00
committed by GitHub
parent 555b156edc
commit 8cddfcdef0
+9 -4
View File
@@ -27,11 +27,16 @@
/datum/world_topic/proc/TryRun(list/input)
key_valid = config && (CONFIG_GET(string/comms_key) == input["key"])
if(require_comms_key && !key_valid)
return "Bad Key"
input -= "key"
. = Run(input)
if(islist(.))
if(require_comms_key && !key_valid)
. = "Bad Key"
if (input["format"] == "json")
. = list("error" = .)
else
. = Run(input)
if (input["format"] == "json")
. = json_encode(.)
else if(islist(.))
. = list2params(.)
/datum/world_topic/proc/Run(list/input)