diff --git a/code/__DEFINES/tgs.dm b/code/__DEFINES/tgs.dm index e70955845c..3225f14d8c 100644 --- a/code/__DEFINES/tgs.dm +++ b/code/__DEFINES/tgs.dm @@ -1,6 +1,6 @@ // tgstation-server DMAPI -#define TGS_DMAPI_VERSION "5.2.8" +#define TGS_DMAPI_VERSION "5.2.10" // All functions and datums outside this document are subject to change with any version and should not be relied on. @@ -67,7 +67,7 @@ #define TGS_EVENT_REPO_CHECKOUT 1 /// When the repository performs a fetch operation. No parameters #define TGS_EVENT_REPO_FETCH 2 -/// When the repository merges a pull request. Parameters: PR Number, PR Sha, (Nullable) Comment made by TGS user +/// When the repository test merges. Parameters: PR Number, PR Sha, (Nullable) Comment made by TGS user #define TGS_EVENT_REPO_MERGE_PULL_REQUEST 3 /// Before the repository makes a sychronize operation. Parameters: Absolute repostiory path #define TGS_EVENT_REPO_PRE_SYNCHRONIZE 4 @@ -117,22 +117,22 @@ //REQUIRED HOOKS /** - * Call this somewhere in [/world/proc/New] that is always run. This function may sleep! - * - * * event_handler - Optional user defined [/datum/tgs_event_handler]. - * * minimum_required_security_level: The minimum required security level to run the game in which the DMAPI is integrated. Can be one of [TGS_SECURITY_ULTRASAFE], [TGS_SECURITY_SAFE], or [TGS_SECURITY_TRUSTED]. - */ + * Call this somewhere in [/world/proc/New] that is always run. This function may sleep! + * + * * event_handler - Optional user defined [/datum/tgs_event_handler]. + * * minimum_required_security_level: The minimum required security level to run the game in which the DMAPI is integrated. Can be one of [TGS_SECURITY_ULTRASAFE], [TGS_SECURITY_SAFE], or [TGS_SECURITY_TRUSTED]. + */ /world/proc/TgsNew(datum/tgs_event_handler/event_handler, minimum_required_security_level = TGS_SECURITY_ULTRASAFE) return /** - * Call this when your initializations are complete and your game is ready to play before any player interactions happen. - * - * This may use [/world/var/sleep_offline] to make this happen so ensure no changes are made to it while this call is running. - * Afterwards, consider explicitly setting it to what you want to avoid this BYOND bug: http://www.byond.com/forum/post/2575184 - * Before this point, note that any static files or directories may be in use by another server. Your code should account for this. - * This function should not be called before ..() in [/world/proc/New]. - */ + * Call this when your initializations are complete and your game is ready to play before any player interactions happen. + * + * This may use [/world/var/sleep_offline] to make this happen so ensure no changes are made to it while this call is running. + * Afterwards, consider explicitly setting it to what you want to avoid this BYOND bug: http://www.byond.com/forum/post/2575184 + * Before this point, note that any static files or directories may be in use by another server. Your code should account for this. + * This function should not be called before ..() in [/world/proc/New]. + */ /world/proc/TgsInitializationComplete() return @@ -140,8 +140,8 @@ #define TGS_TOPIC var/tgs_topic_return = TgsTopic(args[1]); if(tgs_topic_return) return tgs_topic_return /** - * Call this at the beginning of [world/proc/Reboot]. - */ + * Call this at the beginning of [world/proc/Reboot]. + */ /world/proc/TgsReboot() return @@ -175,36 +175,36 @@ var/deprefixed_parameter /** - * Returns [TRUE]/[FALSE] based on if the [/datum/tgs_version] contains wildcards. - */ + * Returns [TRUE]/[FALSE] based on if the [/datum/tgs_version] contains wildcards. + */ /datum/tgs_version/proc/Wildcard() return /** - * Returns [TRUE]/[FALSE] based on if the [/datum/tgs_version] equals some other version. - * - * other_version - The [/datum/tgs_version] to compare against. - */ + * Returns [TRUE]/[FALSE] based on if the [/datum/tgs_version] equals some other version. + * + * other_version - The [/datum/tgs_version] to compare against. + */ /datum/tgs_version/proc/Equals(datum/tgs_version/other_version) return /// Represents a merge of a GitHub pull request. /datum/tgs_revision_information/test_merge - /// The pull request number. + /// The test merge number. var/number - /// The pull request title when it was merged. + /// The test merge source's title when it was merged. var/title - /// The pull request body when it was merged. + /// The test merge source's body when it was merged. var/body - /// The GitHub username of the pull request's author. + /// The Username of the test merge source's author. var/author - /// An http URL to the pull request. + /// An http URL to the test merge source. var/url - /// The SHA of the pull request when that was merged. + /// The SHA of the test merge when that was merged. var/pull_request_commit - /// ISO 8601 timestamp of when the pull request was merged. + /// ISO 8601 timestamp of when the test merge was created on TGS. var/time_merged - /// (Nullable) Comment left by the TGS user who initiated the merge.. + /// Optional comment left by the TGS user who initiated the merge. var/comment /// Represents a connected chat channel. @@ -234,10 +234,10 @@ var/datum/tgs_chat_channel/channel /** - * User definable callback for handling TGS events. - * - * event_code - One of the TGS_EVENT_ defines. Extra parameters will be documented in each - */ + * User definable callback for handling TGS events. + * + * event_code - One of the TGS_EVENT_ defines. Extra parameters will be documented in each + */ /datum/tgs_event_handler/proc/HandleEvent(event_code, ...) set waitfor = FALSE return @@ -252,11 +252,11 @@ var/admin_only = FALSE /** - * Process command activation. Should return a string to respond to the issuer with. - * - * sender - The [/datum/tgs_chat_user] who issued the command. - * params - The trimmed string following the command `/datum/tgs_chat_command/var/name]. - */ + * Process command activation. Should return a string to respond to the issuer with. + * + * sender - The [/datum/tgs_chat_user] who issued the command. + * params - The trimmed string following the command `/datum/tgs_chat_command/var/name]. + */ /datum/tgs_chat_command/proc/Run(datum/tgs_chat_user/sender, params) CRASH("[type] has no implementation for Run()") @@ -271,48 +271,48 @@ return /** - * Returns [TRUE] if DreamDaemon was launched under TGS, the API matches, and was properly initialized. [FALSE] will be returned otherwise. - */ + * Returns [TRUE] if DreamDaemon was launched under TGS, the API matches, and was properly initialized. [FALSE] will be returned otherwise. + */ /world/proc/TgsAvailable() return // No function below this succeeds if it TgsAvailable() returns FALSE or if TgsNew() has yet to be called. /** - * Forces a hard reboot of DreamDaemon by ending the process. - * - * Unlike del(world) clients will try to reconnect. - * If TGS has not requested a [TGS_REBOOT_MODE_SHUTDOWN] DreamDaemon will be launched again - */ + * Forces a hard reboot of DreamDaemon by ending the process. + * + * Unlike del(world) clients will try to reconnect. + * If TGS has not requested a [TGS_REBOOT_MODE_SHUTDOWN] DreamDaemon will be launched again + */ /world/proc/TgsEndProcess() return /** - * Send a message to connected chats. - * - * message - The string to send. - * admin_only: If [TRUE], message will be sent to admin connected chats. Vice-versa applies. - */ + * Send a message to connected chats. + * + * message - The string to send. + * admin_only: If [TRUE], message will be sent to admin connected chats. Vice-versa applies. + */ /world/proc/TgsTargetedChatBroadcast(message, admin_only = FALSE) return /** - * Send a private message to a specific user. - * - * message - The string to send. - * user: The [/datum/tgs_chat_user] to PM. - */ + * Send a private message to a specific user. + * + * message - The string to send. + * user: The [/datum/tgs_chat_user] to PM. + */ /world/proc/TgsChatPrivateMessage(message, datum/tgs_chat_user/user) return // The following functions will sleep if a call to TgsNew() is sleeping /** - * Send a message to connected chats that are flagged as game-related in TGS. - * - * message - The string to send. - * channels - Optional list of [/datum/tgs_chat_channel]s to restrict the message to. - */ + * Send a message to connected chats that are flagged as game-related in TGS. + * + * message - The string to send. + * channels - Optional list of [/datum/tgs_chat_channel]s to restrict the message to. + */ /world/proc/TgsChatBroadcast(message, list/channels = null) return diff --git a/code/modules/tgs/v5/README.md b/code/modules/tgs/v5/README.md index 5f8d711fcd..5b48d57a1f 100644 --- a/code/modules/tgs/v5/README.md +++ b/code/modules/tgs/v5/README.md @@ -1,4 +1,4 @@ -# DMAPI V4 +# DMAPI V5 This DMAPI implements bridge requests using HTTP GET requests to TGS. It has no security restrictions. diff --git a/code/modules/tgs/v5/api.dm b/code/modules/tgs/v5/api.dm index 466a986237..7a2ff694e0 100644 --- a/code/modules/tgs/v5/api.dm +++ b/code/modules/tgs/v5/api.dm @@ -98,18 +98,19 @@ return json_encode(response) /datum/tgs_api/v5/OnTopic(T) - if(!initialized) - return FALSE //continue world/Topic - var/list/params = params2list(T) var/json = params[DMAPI5_TOPIC_DATA] if(!json) - return FALSE + return FALSE // continue to /world/Topic var/list/topic_parameters = json_decode(json) if(!topic_parameters) return TopicResponse("Invalid topic parameters json!"); + if(!initialized) + TGS_WARNING_LOG("Missed topic due to not being initialized: [T]") + return TRUE // too early to handle, but it's still our responsibility + var/their_sCK = topic_parameters[DMAPI5_PARAMETER_ACCESS_IDENTIFIER] if(their_sCK != access_identifier) return TopicResponse("Failed to decode [DMAPI5_PARAMETER_ACCESS_IDENTIFIER] from: [json]!");