From 31dd228b0e26047d3752fc54f1ce60eae5601926 Mon Sep 17 00:00:00 2001 From: gremlingss Date: Thu, 28 Sep 2023 15:56:10 +0100 Subject: [PATCH 1/3] Adds a whitelist wrapper --- code/datums/world_topic.dm | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/code/datums/world_topic.dm b/code/datums/world_topic.dm index 790e317d223..217448f5d1f 100644 --- a/code/datums/world_topic.dm +++ b/code/datums/world_topic.dm @@ -286,6 +286,7 @@ /datum/world_topic/jsonrevision keyword = "jsonrevision" + require_comms_key = TRUE /datum/world_topic/jsonrevision/Run(list/input, addr) var/datum/getrev/revdata = GLOB.revdata @@ -308,3 +309,44 @@ )) return json_encode(data) + +// Border Control Wrapper for removing/adding whitelists +// Key - "border" // The method to call this wrapper +// Mode Choice - "mode" // 0 - 1 - 2, 0: Check whitelist + // 1: Whitelist, + // 2: Unwhitelist. +// CKey - "ckey" // The target user. + +#define CHK_WHTLST 0 +#define WHTLST 1 +#define UNWHTLST 2 + +/datum/world_topic/bordercontrol + keyword = "border" + require_comms_key = TRUE + +/datum/world_topic/bordercontrol/Run(list/input, addr) + var/ckey = input["ckey"] + var/modeInput = text2num(input["mode"]) + var/whitelistResult = BC_IsKeyWhitelisted(ckey) + switch(modeInput) + if(CHK_WHTLST) + return "[ckey] is [whitelistResult ? "" : "**NOT** "]whitelisted" + + if(WHTLST) // If the proc returns true, they have been whitelisted, if not, they have already been whitelisted. + if(BC_WhitelistKey(ckey)) + return "[ckey] has been whitelisted." + else + return "[ckey] has already been whitelisted." + + if(WHTLST) // If the proc returns true, they have been removed, if not, they weren't on it originally. + if(BC_RemoveKey(ckey)) + return "[ckey] has been removed." + else + return "[ckey] is already not on the whitelist." + + return "Formatting error - KEY: [input["key"]] | MODE: [input["mode"]] | CKEY: [input["ckey"]] | WhitelistResult: [whitelistResult]" + +#undef CHK_WHTLST +#undef WHTLST +#undef UNWHTLST From 15ee4af4b508b1a3304788b471297cf37c3e4f1a Mon Sep 17 00:00:00 2001 From: gremlingss Date: Thu, 28 Sep 2023 15:58:20 +0100 Subject: [PATCH 2/3] Forgot to author the comment woopsies --- code/datums/world_topic.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/world_topic.dm b/code/datums/world_topic.dm index 217448f5d1f..353b862a63a 100644 --- a/code/datums/world_topic.dm +++ b/code/datums/world_topic.dm @@ -310,7 +310,7 @@ return json_encode(data) -// Border Control Wrapper for removing/adding whitelists +// Border Control Wrapper for removing/adding whitelists - Gremling da smoothbrain // Key - "border" // The method to call this wrapper // Mode Choice - "mode" // 0 - 1 - 2, 0: Check whitelist // 1: Whitelist, From a0226da599e55a5e8b6f9b2ce6ead4cc8f549a5c Mon Sep 17 00:00:00 2001 From: gremlingss Date: Thu, 28 Sep 2023 16:01:59 +0100 Subject: [PATCH 3/3] Fixes a typo --- code/datums/world_topic.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/world_topic.dm b/code/datums/world_topic.dm index 353b862a63a..ed824fbbdfe 100644 --- a/code/datums/world_topic.dm +++ b/code/datums/world_topic.dm @@ -311,7 +311,7 @@ return json_encode(data) // Border Control Wrapper for removing/adding whitelists - Gremling da smoothbrain -// Key - "border" // The method to call this wrapper +// Keyword - "border" // The method to call this wrapper // Mode Choice - "mode" // 0 - 1 - 2, 0: Check whitelist // 1: Whitelist, // 2: Unwhitelist.