mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-20 19:44:09 +01:00
Upgrades TGS DMAPI to 7.0.0 (#23657)
* Upgardes TGS DMAPI to 7.0.0 * Fix spacing * For this
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
#define TGS_DEFINE_AND_SET_GLOBAL(Name, Value) GLOBAL_VAR_INIT(##Name, ##Value); GLOBAL_PROTECT(##Name)
|
||||
#define TGS_READ_GLOBAL(Name) GLOB.##Name
|
||||
#define TGS_WRITE_GLOBAL(Name, Value) GLOB.##Name = ##Value
|
||||
#define TGS_WORLD_ANNOUNCE(message) to_chat(world, "<span class='boldannounce'>[html_encode(##message)]</span>")
|
||||
#define TGS_WORLD_ANNOUNCE(message) to_chat(world, "<hr><span class='boldannounce'>Host Announcement: [html_encode(##message)]</span><hr>")
|
||||
#define TGS_INFO_LOG(message) log_tgs(message, "INF")
|
||||
#define TGS_WARNING_LOG(message) log_tgs(message, "WRN")
|
||||
#define TGS_ERROR_LOG(message) log_tgs(message, "ERR")
|
||||
|
||||
+30
-9
@@ -1,6 +1,6 @@
|
||||
// tgstation-server DMAPI
|
||||
|
||||
#define TGS_DMAPI_VERSION "6.5.0"
|
||||
#define TGS_DMAPI_VERSION "7.0.0"
|
||||
|
||||
// All functions and datums outside this document are subject to change with any version and should not be relied on.
|
||||
|
||||
@@ -73,12 +73,12 @@
|
||||
#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
|
||||
/// Before a BYOND install operation begins. Parameters: [/datum/tgs_version] of the installing BYOND.
|
||||
#define TGS_EVENT_BYOND_INSTALL_START 5
|
||||
/// When a BYOND install operation fails. Parameters: Error message
|
||||
#define TGS_EVENT_BYOND_INSTALL_FAIL 6
|
||||
/// When the active BYOND version changes. Parameters: (Nullable) [/datum/tgs_version] of the current BYOND, [/datum/tgs_version] of the new BYOND.
|
||||
#define TGS_EVENT_BYOND_ACTIVE_VERSION_CHANGE 7
|
||||
/// Before a engine install operation begins. Parameters: Version string of the installing engine.
|
||||
#define TGS_EVENT_ENGINE_INSTALL_START 5
|
||||
/// When a engine install operation fails. Parameters: Error message
|
||||
#define TGS_EVENT_ENGINE_INSTALL_FAIL 6
|
||||
/// When the active engine version changes. Parameters: (Nullable) Version string of the current engine, version string of the new engine.
|
||||
#define TGS_EVENT_ENGINE_ACTIVE_VERSION_CHANGE 7
|
||||
/// When the compiler starts running. Parameters: Game directory path, origin commit SHA.
|
||||
#define TGS_EVENT_COMPILE_START 8
|
||||
/// When a compile is cancelled. No parameters.
|
||||
@@ -108,7 +108,7 @@
|
||||
// #define TGS_EVENT_DREAM_DAEMON_LAUNCH 22
|
||||
/// After a single submodule update is performed. Parameters: Updated submodule name.
|
||||
#define TGS_EVENT_REPO_SUBMODULE_UPDATE 23
|
||||
/// After CodeModifications are applied, before DreamMaker is run. Parameters: Game directory path, origin commit sha, byond version.
|
||||
/// After CodeModifications are applied, before DreamMaker is run. Parameters: Game directory path, origin commit sha, version string of the used engine.
|
||||
#define TGS_EVENT_PRE_DREAM_MAKER 24
|
||||
/// Whenever a deployment folder is deleted from disk. Parameters: Game directory path.
|
||||
#define TGS_EVENT_DEPLOYMENT_CLEANUP 25
|
||||
@@ -122,6 +122,7 @@
|
||||
/// The watchdog will restart on reboot.
|
||||
#define TGS_REBOOT_MODE_RESTART 2
|
||||
|
||||
// Note that security levels are currently meaningless in OpenDream
|
||||
/// DreamDaemon Trusted security level.
|
||||
#define TGS_SECURITY_TRUSTED 0
|
||||
/// DreamDaemon Safe security level.
|
||||
@@ -129,6 +130,18 @@
|
||||
/// DreamDaemon Ultrasafe security level.
|
||||
#define TGS_SECURITY_ULTRASAFE 2
|
||||
|
||||
/// DreamDaemon public visibility level.
|
||||
#define TGS_VISIBILITY_PUBLIC 0
|
||||
/// DreamDaemon private visibility level.
|
||||
#define TGS_VISIBILITY_PRIVATE 1
|
||||
/// DreamDaemon invisible visibility level.
|
||||
#define TGS_VISIBILITY_INVISIBLE 2
|
||||
|
||||
/// The Build Your Own Net Dream engine.
|
||||
#define TGS_ENGINE_TYPE_BYOND 0
|
||||
/// The OpenDream engine.
|
||||
#define TGS_ENGINE_TYPE_OPENDREAM 1
|
||||
|
||||
//REQUIRED HOOKS
|
||||
|
||||
/**
|
||||
@@ -154,7 +167,7 @@
|
||||
#define TGS_TOPIC var/tgs_topic_return = TgsTopic(args[1]); if(tgs_topic_return) return tgs_topic_return
|
||||
|
||||
/**
|
||||
* Call this as late as possible in [world/proc/Reboot].
|
||||
* Call this as late as possible in [world/proc/Reboot] (BEFORE ..()).
|
||||
*/
|
||||
/world/proc/TgsReboot()
|
||||
return
|
||||
@@ -442,6 +455,10 @@
|
||||
/world/proc/TgsVersion()
|
||||
return
|
||||
|
||||
/// Returns the running engine type
|
||||
/world/proc/TgsEngine()
|
||||
return
|
||||
|
||||
/// Returns the current [/datum/tgs_version] of the DMAPI being used if it was activated, null otherwise. This function may sleep if the call to [/world/proc/TgsNew] is sleeping!
|
||||
/world/proc/TgsApiVersion()
|
||||
return
|
||||
@@ -458,6 +475,10 @@
|
||||
/world/proc/TgsSecurityLevel()
|
||||
return
|
||||
|
||||
/// Returns the current BYOND visibility level as a TGS_VISIBILITY_ define if TGS is present, null otherwise. Requires TGS to be using interop API version 5 or higher otherwise the string "___unimplemented" wil be returned. This function may sleep if the call to [/world/proc/TgsNew] is sleeping!
|
||||
/world/proc/TgsVisibility()
|
||||
return
|
||||
|
||||
/// Returns a list of active [/datum/tgs_revision_information/test_merge]s if TGS is present, null otherwise. This function may sleep if the call to [/world/proc/TgsNew] is sleeping!
|
||||
/world/proc/TgsTestMerges()
|
||||
return
|
||||
|
||||
@@ -837,7 +837,7 @@
|
||||
var/device_id = params["id_tag"]
|
||||
var/cmd = params["cmd"]
|
||||
switch(cmd)
|
||||
if ("power",
|
||||
if("power",
|
||||
"adjust_external_pressure",
|
||||
"set_external_pressure",
|
||||
"checks",
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
This folder contains all DMAPI code not directly involved in an API.
|
||||
|
||||
- [_definitions.dm](./definitions.dm) contains defines needed across DMAPI internals.
|
||||
- [core.dm](./core.dm) contains the implementations of the `/world/proc/TgsXXX()` procs. Many map directly to the `/datum/tgs_api` functions. It also contains the /datum selection and setup code.
|
||||
- [datum.dm](./datum.dm) contains the `/datum/tgs_api` declarations that all APIs must implement.
|
||||
- [tgs_version.dm](./tgs_version.dm) contains the `/datum/tgs_version` definition
|
||||
- [tgs_core.dm](./core.dm) contains the implementations of the `/world/proc/TgsXXX()` procs. Many map directly to the `/datum/tgs_api` functions. It also contains the /datum selection and setup code.
|
||||
- [tgs_datum.dm](./datum.dm) contains the `/datum/tgs_api` declarations that all APIs must implement.
|
||||
- [tgs_version.dm](./tgs_version.dm) contains the `/datum/tgs_version` definition
|
||||
|
||||
@@ -1,2 +1,10 @@
|
||||
#if DM_VERSION < 510
|
||||
#error The TGS DMAPI does not support BYOND versions < 510!
|
||||
#endif
|
||||
|
||||
#define TGS_UNIMPLEMENTED "___unimplemented"
|
||||
#define TGS_VERSION_PARAMETER "server_service_version"
|
||||
|
||||
#ifndef TGS_DEBUG_LOG
|
||||
#define TGS_DEBUG_LOG(message)
|
||||
#endif
|
||||
|
||||
@@ -42,11 +42,11 @@
|
||||
|
||||
var/datum/tgs_version/max_api_version = TgsMaximumApiVersion();
|
||||
if(version.suite != null && version.minor != null && version.patch != null && version.deprecated_patch != null && version.deprefixed_parameter > max_api_version.deprefixed_parameter)
|
||||
TGS_ERROR_LOG("Detected unknown API version! Defaulting to latest. Update the DMAPI to fix this problem.")
|
||||
TGS_ERROR_LOG("Detected unknown Interop API version! Defaulting to latest. Update the DMAPI to fix this problem.")
|
||||
api_datum = /datum/tgs_api/latest
|
||||
|
||||
if(!api_datum)
|
||||
TGS_ERROR_LOG("Found unsupported API version: [raw_parameter]. If this is a valid version please report this, backporting is done on demand.")
|
||||
TGS_ERROR_LOG("Found unsupported Interop API version: [raw_parameter]. If this is a valid version please report this, backporting is done on demand.")
|
||||
return
|
||||
|
||||
TGS_INFO_LOG("Activating API for version [version.deprefixed_parameter]")
|
||||
@@ -107,6 +107,13 @@
|
||||
if(api)
|
||||
return api.ApiVersion()
|
||||
|
||||
/world/TgsEngine()
|
||||
#ifdef OPENDREAM
|
||||
return TGS_ENGINE_TYPE_OPENDREAM
|
||||
#else
|
||||
return TGS_ENGINE_TYPE_BYOND
|
||||
#endif
|
||||
|
||||
/world/TgsInstanceName()
|
||||
var/datum/tgs_api/api = TGS_READ_GLOBAL(tgs)
|
||||
if(api)
|
||||
@@ -153,4 +160,9 @@
|
||||
/world/TgsSecurityLevel()
|
||||
var/datum/tgs_api/api = TGS_READ_GLOBAL(tgs)
|
||||
if(api)
|
||||
api.SecurityLevel()
|
||||
return api.SecurityLevel()
|
||||
|
||||
/world/TgsVisibility()
|
||||
var/datum/tgs_api/api = TGS_READ_GLOBAL(tgs)
|
||||
if(api)
|
||||
return api.Visibility()
|
||||
|
||||
@@ -11,6 +11,15 @@ TGS_DEFINE_AND_SET_GLOBAL(tgs, null)
|
||||
src.event_handler = event_handler
|
||||
src.version = version
|
||||
|
||||
/datum/tgs_api/proc/TerminateWorld()
|
||||
while(TRUE)
|
||||
TGS_DEBUG_LOG("About to terminate world. Tick: [world.time], sleep_offline: [world.sleep_offline]")
|
||||
world.sleep_offline = FALSE // https://www.byond.com/forum/post/2894866
|
||||
del(world)
|
||||
world.sleep_offline = FALSE // just in case, this is BYOND after all...
|
||||
sleep(1)
|
||||
TGS_DEBUG_LOG("BYOND DIDN'T TERMINATE THE WORLD!!! TICK IS: [world.time], sleep_offline: [world.sleep_offline]")
|
||||
|
||||
/datum/tgs_api/latest
|
||||
parent_type = /datum/tgs_api/v5
|
||||
|
||||
@@ -57,3 +66,6 @@ TGS_PROTECT_DATUM(/datum/tgs_api)
|
||||
|
||||
/datum/tgs_api/proc/SecurityLevel()
|
||||
return TGS_UNIMPLEMENTED
|
||||
|
||||
/datum/tgs_api/proc/Visibility()
|
||||
return TGS_UNIMPLEMENTED
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
This DMAPI implements bridge using file output which TGS monitors for.
|
||||
|
||||
- [api.dm](./v3_api.dm) contains the bulk of the API code.
|
||||
- [commands.dm](./v3_commands.dm) contains functions relating to `/datum/tgs_chat_command`s.
|
||||
- [v3_api.dm](./v3_api.dm) contains the bulk of the API code.
|
||||
- [v3_commands.dm](./v3_commands.dm) contains functions relating to `/datum/tgs_chat_command`s.
|
||||
|
||||
@@ -99,7 +99,11 @@
|
||||
if(skip_compat_check && !fexists(SERVICE_INTERFACE_DLL))
|
||||
TGS_ERROR_LOG("Service parameter present but no interface DLL detected. This is symptomatic of running a service less than version 3.1! Please upgrade.")
|
||||
return
|
||||
CALL_EXT(SERVICE_INTERFACE_DLL, SERVICE_INTERFACE_FUNCTION)(instance_name, command) //trust no retval
|
||||
#if DM_VERSION >= 515
|
||||
call_ext(SERVICE_INTERFACE_DLL, SERVICE_INTERFACE_FUNCTION)(instance_name, command) //trust no retval
|
||||
#else
|
||||
call(SERVICE_INTERFACE_DLL, SERVICE_INTERFACE_FUNCTION)(instance_name, command) //trust no retval
|
||||
#endif
|
||||
return TRUE
|
||||
|
||||
/datum/tgs_api/v3210/OnTopic(T)
|
||||
@@ -175,7 +179,7 @@
|
||||
/datum/tgs_api/v3210/Revision()
|
||||
if(!warned_revison)
|
||||
var/datum/tgs_version/api_version = ApiVersion()
|
||||
TGS_ERROR_LOG("Use of TgsRevision on [api_version.deprefixed_parameter] origin_commit only points to master!")
|
||||
TGS_WARNING_LOG("Use of TgsRevision on [api_version.deprefixed_parameter] origin_commit only points to master!")
|
||||
warned_revison = TRUE
|
||||
var/datum/tgs_revision_information/ri = new
|
||||
ri.commit = commit
|
||||
@@ -189,16 +193,19 @@
|
||||
/datum/tgs_api/v3210/ChatChannelInfo()
|
||||
return list() // :omegalul:
|
||||
|
||||
/datum/tgs_api/v3210/ChatBroadcast(message, list/channels)
|
||||
/datum/tgs_api/v3210/ChatBroadcast(datum/tgs_message_content/message, list/channels)
|
||||
if(channels)
|
||||
return TGS_UNIMPLEMENTED
|
||||
message = UpgradeDeprecatedChatMessage(message)
|
||||
ChatTargetedBroadcast(message, TRUE)
|
||||
ChatTargetedBroadcast(message, FALSE)
|
||||
|
||||
/datum/tgs_api/v3210/ChatTargetedBroadcast(message, admin_only)
|
||||
ExportService("[admin_only ? SERVICE_REQUEST_IRC_ADMIN_CHANNEL_MESSAGE : SERVICE_REQUEST_IRC_BROADCAST] [message]")
|
||||
/datum/tgs_api/v3210/ChatTargetedBroadcast(datum/tgs_message_content/message, admin_only)
|
||||
message = UpgradeDeprecatedChatMessage(message)
|
||||
ExportService("[admin_only ? SERVICE_REQUEST_IRC_ADMIN_CHANNEL_MESSAGE : SERVICE_REQUEST_IRC_BROADCAST] [message.text]")
|
||||
|
||||
/datum/tgs_api/v3210/ChatPrivateMessage(message, datum/tgs_chat_user/user)
|
||||
UpgradeDeprecatedChatMessage(message)
|
||||
return TGS_UNIMPLEMENTED
|
||||
|
||||
/datum/tgs_api/v3210/SecurityLevel()
|
||||
|
||||
@@ -10,9 +10,12 @@
|
||||
var/warned_about_the_dangers_of_robutussin = !warnings_only
|
||||
for(var/I in typesof(/datum/tgs_chat_command) - /datum/tgs_chat_command)
|
||||
if(!warned_about_the_dangers_of_robutussin)
|
||||
TGS_ERROR_LOG("Custom chat commands in [ApiVersion()] lacks the /datum/tgs_chat_user/sender.channel field!")
|
||||
TGS_WARNING_LOG("Custom chat commands in [ApiVersion()] lacks the /datum/tgs_chat_user/sender.channel field!")
|
||||
warned_about_the_dangers_of_robutussin = TRUE
|
||||
var/datum/tgs_chat_command/stc = I
|
||||
if(stc.ignore_type == I)
|
||||
continue
|
||||
|
||||
var/command_name = initial(stc.name)
|
||||
if(!command_name || findtext(command_name, " ") || findtext(command_name, "'") || findtext(command_name, "\""))
|
||||
if(warnings_only && !warned_command_names[command_name])
|
||||
@@ -44,9 +47,12 @@
|
||||
user.friendly_name = sender
|
||||
|
||||
// Discord hack, fix the mention if it's only numbers (fuck you IRC trolls)
|
||||
var/regex/discord_id_regex = regex(@"^[0-9]+$")
|
||||
var/regex/discord_id_regex = regex("^\[0-9\]+$")
|
||||
if(findtext(sender, discord_id_regex))
|
||||
sender = "<@[sender]>"
|
||||
|
||||
user.mention = sender
|
||||
return stc.Run(user, params) || TRUE
|
||||
var/datum/tgs_message_content/result = stc.Run(user, params)
|
||||
result = UpgradeDeprecatedCommandResponse(result, command)
|
||||
|
||||
return result ? result.text : TRUE
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
This DMAPI implements bridge requests using file output which TGS monitors for. It has a safe mode restriction.
|
||||
|
||||
- [api.dm](./v4_api.dm) contains the bulk of the API code.
|
||||
- [commands.dm](./v4_commands.dm) contains functions relating to `/datum/tgs_chat_command`s.
|
||||
- [v4_api.dm](./v4_api.dm) contains the bulk of the API code.
|
||||
- [v4_commands.dm](./v4_commands.dm) contains functions relating to `/datum/tgs_chat_command`s.
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
if(cached_json["apiValidateOnly"])
|
||||
TGS_INFO_LOG("Validating API and exiting...")
|
||||
Export(TGS4_COMM_VALIDATE, list(TGS4_PARAMETER_DATA = "[minimum_required_security_level]"))
|
||||
del(world)
|
||||
TerminateWorld()
|
||||
|
||||
security_level = cached_json["securityLevel"]
|
||||
chat_channels_json_path = cached_json["chatChannelsJson"]
|
||||
@@ -188,7 +188,7 @@
|
||||
requesting_new_port = TRUE
|
||||
if(!world.OpenPort(0)) //open any port
|
||||
TGS_ERROR_LOG("Unable to open random port to retrieve new port![TGS4_PORT_CRITFAIL_MESSAGE]")
|
||||
del(world)
|
||||
TerminateWorld()
|
||||
|
||||
//request a new port
|
||||
export_lock = FALSE
|
||||
@@ -196,16 +196,16 @@
|
||||
|
||||
if(!new_port_json)
|
||||
TGS_ERROR_LOG("No new port response from server![TGS4_PORT_CRITFAIL_MESSAGE]")
|
||||
del(world)
|
||||
TerminateWorld()
|
||||
|
||||
var/new_port = new_port_json[TGS4_PARAMETER_DATA]
|
||||
if(!isnum(new_port) || new_port <= 0)
|
||||
TGS_ERROR_LOG("Malformed new port json ([json_encode(new_port_json)])![TGS4_PORT_CRITFAIL_MESSAGE]")
|
||||
del(world)
|
||||
TerminateWorld()
|
||||
|
||||
if(new_port != world.port && !world.OpenPort(new_port))
|
||||
TGS_ERROR_LOG("Unable to open port [new_port]![TGS4_PORT_CRITFAIL_MESSAGE]")
|
||||
del(world)
|
||||
TerminateWorld()
|
||||
requesting_new_port = FALSE
|
||||
|
||||
while(export_lock)
|
||||
|
||||
@@ -40,5 +40,5 @@
|
||||
var/datum/tgs_message_content/result = sc.Run(u, params)
|
||||
result = UpgradeDeprecatedCommandResponse(result, command)
|
||||
|
||||
return result?.text
|
||||
return result ? result.text : TRUE
|
||||
return "Unknown command: [command]!"
|
||||
|
||||
@@ -10,4 +10,4 @@ This DMAPI implements bridge requests using HTTP GET requests to TGS. It has no
|
||||
- [v5_commands.dm](./v5_commands.dm) contains functions relating to `/datum/tgs_chat_command`s.
|
||||
- [v5_serializers.dm](./v5_serializers.dm) contains function to help convert interop `/datum`s into a JSON encodable `list()` format.
|
||||
- [v5_topic.dm](./v5_topic.dm) contains functions related to processing topic requests.
|
||||
- [v5_undefs.dm](./v5_undefs.dm) Undoes the work of `_v5_defines.dm`.
|
||||
- [v5_undefs.dm](./v5_undefs.dm) Undoes the work of `_defines.dm`.
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
#define DMAPI5_TOPIC_DATA "tgs_data"
|
||||
|
||||
#define DMAPI5_BRIDGE_REQUEST_LIMIT 8198
|
||||
#define DMAPI5_TOPIC_REQUEST_LIMIT 65529
|
||||
#define DMAPI5_TOPIC_RESPONSE_LIMIT 65528
|
||||
#define DMAPI5_TOPIC_REQUEST_LIMIT 65528
|
||||
#define DMAPI5_TOPIC_RESPONSE_LIMIT 65529
|
||||
|
||||
#define DMAPI5_BRIDGE_COMMAND_PORT_UPDATE 0
|
||||
#define DMAPI5_BRIDGE_COMMAND_STARTUP 1
|
||||
#define DMAPI5_BRIDGE_COMMAND_PRIME 2
|
||||
#define DMAPI5_BRIDGE_COMMAND_REBOOT 3
|
||||
@@ -18,6 +17,7 @@
|
||||
|
||||
#define DMAPI5_PARAMETER_ACCESS_IDENTIFIER "accessIdentifier"
|
||||
#define DMAPI5_PARAMETER_CUSTOM_COMMANDS "customCommands"
|
||||
#define DMAPI5_PARAMETER_TOPIC_PORT "topicPort"
|
||||
|
||||
#define DMAPI5_CHUNK "chunk"
|
||||
#define DMAPI5_CHUNK_PAYLOAD "payload"
|
||||
@@ -48,6 +48,7 @@
|
||||
#define DMAPI5_RUNTIME_INFORMATION_REVISION "revision"
|
||||
#define DMAPI5_RUNTIME_INFORMATION_TEST_MERGES "testMerges"
|
||||
#define DMAPI5_RUNTIME_INFORMATION_SECURITY_LEVEL "securityLevel"
|
||||
#define DMAPI5_RUNTIME_INFORMATION_VISIBILITY "visibility"
|
||||
|
||||
#define DMAPI5_CHAT_UPDATE_CHANNELS "channels"
|
||||
|
||||
@@ -79,6 +80,7 @@
|
||||
#define DMAPI5_TOPIC_COMMAND_WATCHDOG_REATTACH 8
|
||||
#define DMAPI5_TOPIC_COMMAND_SEND_CHUNK 9
|
||||
#define DMAPI5_TOPIC_COMMAND_RECEIVE_CHUNK 10
|
||||
#define DMAPI5_TOPIC_COMMAND_RECEIVE_BROADCAST 11
|
||||
|
||||
#define DMAPI5_TOPIC_PARAMETER_COMMAND_TYPE "commandType"
|
||||
#define DMAPI5_TOPIC_PARAMETER_CHAT_COMMAND "chatCommand"
|
||||
@@ -88,6 +90,7 @@
|
||||
#define DMAPI5_TOPIC_PARAMETER_NEW_INSTANCE_NAME "newInstanceName"
|
||||
#define DMAPI5_TOPIC_PARAMETER_CHAT_UPDATE "chatUpdate"
|
||||
#define DMAPI5_TOPIC_PARAMETER_NEW_SERVER_VERSION "newServerVersion"
|
||||
#define DMAPI5_TOPIC_PARAMETER_BROADCAST_MESSAGE "broadcastMessage"
|
||||
|
||||
#define DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE "commandResponse"
|
||||
#define DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE_MESSAGE "commandResponseMessage"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
var/instance_name
|
||||
var/security_level
|
||||
var/visibility
|
||||
|
||||
var/reboot_mode = TGS_REBOOT_MODE_NORMAL
|
||||
|
||||
@@ -16,24 +17,32 @@
|
||||
var/list/chat_channels
|
||||
|
||||
var/initialized = FALSE
|
||||
var/initial_bridge_request_received = FALSE
|
||||
var/datum/tgs_version/interop_version
|
||||
|
||||
var/chunked_requests = 0
|
||||
var/list/chunked_topics = list()
|
||||
|
||||
var/detached = FALSE
|
||||
|
||||
/datum/tgs_api/v5/New()
|
||||
. = ..()
|
||||
interop_version = version
|
||||
TGS_DEBUG_LOG("V5 API created: [json_encode(args)]")
|
||||
|
||||
/datum/tgs_api/v5/ApiVersion()
|
||||
return new /datum/tgs_version(
|
||||
#include "v5_interop_version.dm"
|
||||
)
|
||||
|
||||
/datum/tgs_api/v5/OnWorldNew(minimum_required_security_level)
|
||||
TGS_DEBUG_LOG("OnWorldNew()")
|
||||
server_port = world.params[DMAPI5_PARAM_SERVER_PORT]
|
||||
access_identifier = world.params[DMAPI5_PARAM_ACCESS_IDENTIFIER]
|
||||
|
||||
var/datum/tgs_version/api_version = ApiVersion()
|
||||
version = null
|
||||
var/list/bridge_response = Bridge(DMAPI5_BRIDGE_COMMAND_STARTUP, list(DMAPI5_BRIDGE_PARAMETER_MINIMUM_SECURITY_LEVEL = minimum_required_security_level, DMAPI5_BRIDGE_PARAMETER_VERSION = api_version.raw_parameter, DMAPI5_PARAMETER_CUSTOM_COMMANDS = ListCustomCommands()))
|
||||
version = null // we want this to be the TGS version, not the interop version
|
||||
var/list/bridge_response = Bridge(DMAPI5_BRIDGE_COMMAND_STARTUP, list(DMAPI5_BRIDGE_PARAMETER_MINIMUM_SECURITY_LEVEL = minimum_required_security_level, DMAPI5_BRIDGE_PARAMETER_VERSION = api_version.raw_parameter, DMAPI5_PARAMETER_CUSTOM_COMMANDS = ListCustomCommands(), DMAPI5_PARAMETER_TOPIC_PORT = GetTopicPort()))
|
||||
if(!istype(bridge_response))
|
||||
TGS_ERROR_LOG("Failed initial bridge request!")
|
||||
return FALSE
|
||||
@@ -45,10 +54,12 @@
|
||||
|
||||
if(runtime_information[DMAPI5_RUNTIME_INFORMATION_API_VALIDATE_ONLY])
|
||||
TGS_INFO_LOG("DMAPI validation, exiting...")
|
||||
del(world)
|
||||
TerminateWorld()
|
||||
|
||||
version = new /datum/tgs_version(runtime_information[DMAPI5_RUNTIME_INFORMATION_SERVER_VERSION])
|
||||
initial_bridge_request_received = TRUE
|
||||
version = new /datum/tgs_version(runtime_information[DMAPI5_RUNTIME_INFORMATION_SERVER_VERSION]) // reassigning this because it can change if TGS updates
|
||||
security_level = runtime_information[DMAPI5_RUNTIME_INFORMATION_SECURITY_LEVEL]
|
||||
visibility = runtime_information[DMAPI5_RUNTIME_INFORMATION_VISIBILITY]
|
||||
instance_name = runtime_information[DMAPI5_RUNTIME_INFORMATION_INSTANCE_NAME]
|
||||
|
||||
var/list/revisionData = runtime_information[DMAPI5_RUNTIME_INFORMATION_REVISION]
|
||||
@@ -95,18 +106,36 @@
|
||||
initialized = TRUE
|
||||
return TRUE
|
||||
|
||||
/datum/tgs_api/v5/proc/GetTopicPort()
|
||||
#if defined(OPENDREAM) && defined(OPENDREAM_TOPIC_PORT_EXISTS)
|
||||
return "[world.opendream_topic_port]"
|
||||
#else
|
||||
return null
|
||||
#endif
|
||||
|
||||
/datum/tgs_api/v5/proc/RequireInitialBridgeResponse()
|
||||
while(!version)
|
||||
TGS_DEBUG_LOG("RequireInitialBridgeResponse()")
|
||||
var/logged = FALSE
|
||||
while(!initial_bridge_request_received)
|
||||
if(!logged)
|
||||
TGS_DEBUG_LOG("RequireInitialBridgeResponse: Starting sleep")
|
||||
logged = TRUE
|
||||
|
||||
sleep(1)
|
||||
|
||||
TGS_DEBUG_LOG("RequireInitialBridgeResponse: Passed")
|
||||
|
||||
/datum/tgs_api/v5/OnInitializationComplete()
|
||||
Bridge(DMAPI5_BRIDGE_COMMAND_PRIME)
|
||||
|
||||
/datum/tgs_api/v5/OnTopic(T)
|
||||
TGS_DEBUG_LOG("OnTopic()")
|
||||
RequireInitialBridgeResponse()
|
||||
TGS_DEBUG_LOG("OnTopic passed bridge request gate")
|
||||
var/list/params = params2list(T)
|
||||
var/json = params[DMAPI5_TOPIC_DATA]
|
||||
if(!json)
|
||||
TGS_DEBUG_LOG("No \"[DMAPI5_TOPIC_DATA]\" entry found, ignoring...")
|
||||
return FALSE // continue to /world/Topic
|
||||
|
||||
if(!initialized)
|
||||
@@ -156,7 +185,7 @@
|
||||
TGS_WARNING_LOG("Received legacy string when a [/datum/tgs_message_content] was expected. Please audit all calls to TgsChatBroadcast, TgsChatTargetedBroadcast, and TgsChatPrivateMessage to ensure they use the new /datum.")
|
||||
return new /datum/tgs_message_content(message)
|
||||
|
||||
/datum/tgs_api/v5/ChatBroadcast(datum/tgs_message_content/message, list/channels)
|
||||
/datum/tgs_api/v5/ChatBroadcast(datum/tgs_message_content/message2, list/channels)
|
||||
if(!length(channels))
|
||||
channels = ChatChannelInfo()
|
||||
|
||||
@@ -165,45 +194,45 @@
|
||||
var/datum/tgs_chat_channel/channel = I
|
||||
ids += channel.id
|
||||
|
||||
message = UpgradeDeprecatedChatMessage(message)
|
||||
message2 = UpgradeDeprecatedChatMessage(message2)
|
||||
|
||||
if(!length(channels))
|
||||
return
|
||||
|
||||
message = message._interop_serialize()
|
||||
message[DMAPI5_CHAT_MESSAGE_CHANNEL_IDS] = ids
|
||||
var/list/data = message2._interop_serialize()
|
||||
data[DMAPI5_CHAT_MESSAGE_CHANNEL_IDS] = ids
|
||||
if(intercepted_message_queue)
|
||||
intercepted_message_queue += list(message)
|
||||
intercepted_message_queue += list(data)
|
||||
else
|
||||
Bridge(DMAPI5_BRIDGE_COMMAND_CHAT_SEND, list(DMAPI5_BRIDGE_PARAMETER_CHAT_MESSAGE = message))
|
||||
Bridge(DMAPI5_BRIDGE_COMMAND_CHAT_SEND, list(DMAPI5_BRIDGE_PARAMETER_CHAT_MESSAGE = data))
|
||||
|
||||
/datum/tgs_api/v5/ChatTargetedBroadcast(datum/tgs_message_content/message, admin_only)
|
||||
/datum/tgs_api/v5/ChatTargetedBroadcast(datum/tgs_message_content/message2, admin_only)
|
||||
var/list/channels = list()
|
||||
for(var/I in ChatChannelInfo())
|
||||
var/datum/tgs_chat_channel/channel = I
|
||||
if(!channel.is_private_channel && ((channel.is_admin_channel && admin_only) || (!channel.is_admin_channel && !admin_only)))
|
||||
channels += channel.id
|
||||
|
||||
message = UpgradeDeprecatedChatMessage(message)
|
||||
message2 = UpgradeDeprecatedChatMessage(message2)
|
||||
|
||||
if(!length(channels))
|
||||
return
|
||||
|
||||
message = message._interop_serialize()
|
||||
message[DMAPI5_CHAT_MESSAGE_CHANNEL_IDS] = channels
|
||||
var/list/data = message2._interop_serialize()
|
||||
data[DMAPI5_CHAT_MESSAGE_CHANNEL_IDS] = channels
|
||||
if(intercepted_message_queue)
|
||||
intercepted_message_queue += list(message)
|
||||
intercepted_message_queue += list(data)
|
||||
else
|
||||
Bridge(DMAPI5_BRIDGE_COMMAND_CHAT_SEND, list(DMAPI5_BRIDGE_PARAMETER_CHAT_MESSAGE = message))
|
||||
Bridge(DMAPI5_BRIDGE_COMMAND_CHAT_SEND, list(DMAPI5_BRIDGE_PARAMETER_CHAT_MESSAGE = data))
|
||||
|
||||
/datum/tgs_api/v5/ChatPrivateMessage(datum/tgs_message_content/message, datum/tgs_chat_user/user)
|
||||
message = UpgradeDeprecatedChatMessage(message)
|
||||
message = message._interop_serialize()
|
||||
message[DMAPI5_CHAT_MESSAGE_CHANNEL_IDS] = list(user.channel.id)
|
||||
/datum/tgs_api/v5/ChatPrivateMessage(datum/tgs_message_content/message2, datum/tgs_chat_user/user)
|
||||
message2 = UpgradeDeprecatedChatMessage(message2)
|
||||
var/list/data = message2._interop_serialize()
|
||||
data[DMAPI5_CHAT_MESSAGE_CHANNEL_IDS] = list(user.channel.id)
|
||||
if(intercepted_message_queue)
|
||||
intercepted_message_queue += list(message)
|
||||
intercepted_message_queue += list(data)
|
||||
else
|
||||
Bridge(DMAPI5_BRIDGE_COMMAND_CHAT_SEND, list(DMAPI5_BRIDGE_PARAMETER_CHAT_MESSAGE = message))
|
||||
Bridge(DMAPI5_BRIDGE_COMMAND_CHAT_SEND, list(DMAPI5_BRIDGE_PARAMETER_CHAT_MESSAGE = data))
|
||||
|
||||
/datum/tgs_api/v5/ChatChannelInfo()
|
||||
RequireInitialBridgeResponse()
|
||||
@@ -211,6 +240,7 @@
|
||||
return chat_channels.Copy()
|
||||
|
||||
/datum/tgs_api/v5/proc/DecodeChannels(chat_update_json)
|
||||
TGS_DEBUG_LOG("DecodeChannels()")
|
||||
var/list/chat_channels_json = chat_update_json[DMAPI5_CHAT_UPDATE_CHANNELS]
|
||||
if(istype(chat_channels_json))
|
||||
chat_channels.Cut()
|
||||
@@ -235,3 +265,7 @@
|
||||
/datum/tgs_api/v5/SecurityLevel()
|
||||
RequireInitialBridgeResponse()
|
||||
return security_level
|
||||
|
||||
/datum/tgs_api/v5/Visibility()
|
||||
RequireInitialBridgeResponse()
|
||||
return visibility
|
||||
|
||||
@@ -48,7 +48,9 @@
|
||||
var/json = CreateBridgeData(command, data, TRUE)
|
||||
var/encoded_json = url_encode(json)
|
||||
|
||||
var/url = "http://127.0.0.1:[server_port]/Bridge?[DMAPI5_BRIDGE_DATA]=[encoded_json]"
|
||||
var/api_prefix = interop_version.minor >= 7 ? "api/" : ""
|
||||
|
||||
var/url = "http://127.0.0.1:[server_port]/[api_prefix]Bridge?[DMAPI5_BRIDGE_DATA]=[encoded_json]"
|
||||
return url
|
||||
|
||||
/datum/tgs_api/v5/proc/CreateBridgeData(command, list/data, needs_auth)
|
||||
@@ -81,11 +83,16 @@
|
||||
TGS_ERROR_LOG("Failed bridge request: [bridge_request]")
|
||||
return
|
||||
|
||||
var/response_json = file2text(export_response["CONTENT"])
|
||||
if(!response_json)
|
||||
var/content = export_response["CONTENT"]
|
||||
if(!content)
|
||||
TGS_ERROR_LOG("Failed bridge request, missing content!")
|
||||
return
|
||||
|
||||
var/response_json = file2text(content)
|
||||
if(!response_json)
|
||||
TGS_ERROR_LOG("Failed bridge request, failed to load content!")
|
||||
return
|
||||
|
||||
var/list/bridge_response = json_decode(response_json)
|
||||
if(!bridge_response)
|
||||
TGS_ERROR_LOG("Failed bridge request, bad json: [response_json]")
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
response = UpgradeDeprecatedCommandResponse(response, command)
|
||||
|
||||
var/list/topic_response = TopicResponse()
|
||||
topic_response[DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE_MESSAGE] = response?.text
|
||||
topic_response[DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE] = response?._interop_serialize()
|
||||
topic_response[DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE_MESSAGE] = response ? response.text : null
|
||||
topic_response[DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE] = response ? response._interop_serialize() : null
|
||||
return topic_response
|
||||
return TopicResponse("Unknown custom chat command: [command]!")
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
"5.6.1"
|
||||
"5.7.0"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/datum/tgs_message_content/proc/_interop_serialize()
|
||||
return list("text" = text, "embed" = embed?._interop_serialize())
|
||||
return list("text" = text, "embed" = embed ? embed._interop_serialize() : null)
|
||||
|
||||
/datum/tgs_chat_embed/proc/_interop_serialize()
|
||||
CRASH("Base /proc/interop_serialize called on [type]!")
|
||||
|
||||
/datum/tgs_chat_embed/structure/_interop_serialize()
|
||||
var/list/serialized_fields
|
||||
if(islist(fields))
|
||||
if(istype(fields, /list))
|
||||
serialized_fields = list()
|
||||
for(var/datum/tgs_chat_embed/field/field as anything in fields)
|
||||
serialized_fields += list(field._interop_serialize())
|
||||
@@ -16,12 +16,12 @@
|
||||
"url" = url,
|
||||
"timestamp" = timestamp,
|
||||
"colour" = colour,
|
||||
"image" = image?._interop_serialize(),
|
||||
"thumbnail" = thumbnail?._interop_serialize(),
|
||||
"video" = video?._interop_serialize(),
|
||||
"footer" = footer?._interop_serialize(),
|
||||
"provider" = provider?._interop_serialize(),
|
||||
"author" = author?._interop_serialize(),
|
||||
"image" = src.image ? src.image._interop_serialize() : null,
|
||||
"thumbnail" = thumbnail ? thumbnail._interop_serialize() : null,
|
||||
"video" = video ? video._interop_serialize() : null,
|
||||
"footer" = footer ? footer._interop_serialize() : null,
|
||||
"provider" = provider ? provider._interop_serialize() : null,
|
||||
"author" = author ? author._interop_serialize() : null,
|
||||
"fields" = serialized_fields
|
||||
)
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
return response
|
||||
|
||||
/datum/tgs_api/v5/proc/ProcessTopicJson(json, check_access_identifier)
|
||||
TGS_DEBUG_LOG("ProcessTopicJson(..., [check_access_identifier])")
|
||||
var/list/result = ProcessRawTopic(json, check_access_identifier)
|
||||
if(!result)
|
||||
result = TopicResponse("Runtime error!")
|
||||
@@ -25,16 +26,20 @@
|
||||
return response_json
|
||||
|
||||
/datum/tgs_api/v5/proc/ProcessRawTopic(json, check_access_identifier)
|
||||
TGS_DEBUG_LOG("ProcessRawTopic(..., [check_access_identifier])")
|
||||
var/list/topic_parameters = json_decode(json)
|
||||
if(!topic_parameters)
|
||||
TGS_DEBUG_LOG("ProcessRawTopic: json_decode failed")
|
||||
return TopicResponse("Invalid topic parameters json: [json]!");
|
||||
|
||||
var/their_sCK = topic_parameters[DMAPI5_PARAMETER_ACCESS_IDENTIFIER]
|
||||
if(check_access_identifier && their_sCK != access_identifier)
|
||||
return TopicResponse("Failed to decode [DMAPI5_PARAMETER_ACCESS_IDENTIFIER]!")
|
||||
TGS_DEBUG_LOG("ProcessRawTopic: access identifier check failed")
|
||||
return TopicResponse("Failed to decode [DMAPI5_PARAMETER_ACCESS_IDENTIFIER] or it does not match!")
|
||||
|
||||
var/command = topic_parameters[DMAPI5_TOPIC_PARAMETER_COMMAND_TYPE]
|
||||
if(!isnum(command))
|
||||
TGS_DEBUG_LOG("ProcessRawTopic: command type check failed")
|
||||
return TopicResponse("Failed to decode [DMAPI5_TOPIC_PARAMETER_COMMAND_TYPE]!")
|
||||
|
||||
return ProcessTopicCommand(command, topic_parameters)
|
||||
@@ -43,6 +48,7 @@
|
||||
return "response[payload_id]"
|
||||
|
||||
/datum/tgs_api/v5/proc/ProcessTopicCommand(command, list/topic_parameters)
|
||||
TGS_DEBUG_LOG("ProcessTopicCommand([command], ...)")
|
||||
switch(command)
|
||||
|
||||
if(DMAPI5_TOPIC_COMMAND_CHAT_COMMAND)
|
||||
@@ -55,7 +61,6 @@
|
||||
return result
|
||||
|
||||
if(DMAPI5_TOPIC_COMMAND_EVENT_NOTIFICATION)
|
||||
intercepted_message_queue = list()
|
||||
var/list/event_notification = topic_parameters[DMAPI5_TOPIC_PARAMETER_EVENT_NOTIFICATION]
|
||||
if(!istype(event_notification))
|
||||
return TopicResponse("Invalid [DMAPI5_TOPIC_PARAMETER_EVENT_NOTIFICATION]!")
|
||||
@@ -66,28 +71,30 @@
|
||||
|
||||
var/list/event_parameters = event_notification[DMAPI5_EVENT_NOTIFICATION_PARAMETERS]
|
||||
if(event_parameters && !istype(event_parameters))
|
||||
return TopicResponse("Invalid or missing [DMAPI5_EVENT_NOTIFICATION_PARAMETERS]!")
|
||||
. = TopicResponse("Invalid or missing [DMAPI5_EVENT_NOTIFICATION_PARAMETERS]!")
|
||||
else
|
||||
var/list/response = TopicResponse()
|
||||
. = response
|
||||
if(event_handler != null)
|
||||
var/list/event_call = list(event_type)
|
||||
if(event_parameters)
|
||||
event_call += event_parameters
|
||||
|
||||
intercepted_message_queue = list()
|
||||
event_handler.HandleEvent(arglist(event_call))
|
||||
response[DMAPI5_TOPIC_RESPONSE_CHAT_RESPONSES] = intercepted_message_queue
|
||||
intercepted_message_queue = null
|
||||
|
||||
var/list/event_call = list(event_type)
|
||||
if(event_type == TGS_EVENT_WATCHDOG_DETACH)
|
||||
detached = TRUE
|
||||
chat_channels.Cut() // https://github.com/tgstation/tgstation-server/issues/1490
|
||||
|
||||
if(event_parameters)
|
||||
event_call += event_parameters
|
||||
|
||||
if(event_handler != null)
|
||||
event_handler.HandleEvent(arglist(event_call))
|
||||
|
||||
var/list/response = TopicResponse()
|
||||
response[DMAPI5_TOPIC_RESPONSE_CHAT_RESPONSES] = intercepted_message_queue
|
||||
intercepted_message_queue = null
|
||||
return response
|
||||
return
|
||||
|
||||
if(DMAPI5_TOPIC_COMMAND_CHANGE_PORT)
|
||||
var/new_port = topic_parameters[DMAPI5_TOPIC_PARAMETER_NEW_PORT]
|
||||
if(!isnum(new_port) || !(new_port > 0))
|
||||
return TopicResponse("Invalid or missing [DMAPI5_TOPIC_PARAMETER_NEW_PORT]]")
|
||||
return TopicResponse("Invalid or missing [DMAPI5_TOPIC_PARAMETER_NEW_PORT]")
|
||||
|
||||
if(event_handler != null)
|
||||
event_handler.HandleEvent(TGS_EVENT_PORT_SWAP, new_port)
|
||||
@@ -122,8 +129,10 @@
|
||||
return TopicResponse()
|
||||
|
||||
if(DMAPI5_TOPIC_COMMAND_CHAT_CHANNELS_UPDATE)
|
||||
TGS_DEBUG_LOG("ProcessTopicCommand: It's a chat update")
|
||||
var/list/chat_update_json = topic_parameters[DMAPI5_TOPIC_PARAMETER_CHAT_UPDATE]
|
||||
if(!istype(chat_update_json))
|
||||
TGS_DEBUG_LOG("ProcessTopicCommand: failed \"[DMAPI5_TOPIC_PARAMETER_CHAT_UPDATE]\" check")
|
||||
return TopicResponse("Invalid or missing [DMAPI5_TOPIC_PARAMETER_CHAT_UPDATE]!")
|
||||
|
||||
DecodeChannels(chat_update_json)
|
||||
@@ -132,13 +141,13 @@
|
||||
if(DMAPI5_TOPIC_COMMAND_SERVER_PORT_UPDATE)
|
||||
var/new_port = topic_parameters[DMAPI5_TOPIC_PARAMETER_NEW_PORT]
|
||||
if(!isnum(new_port) || !(new_port > 0))
|
||||
return TopicResponse("Invalid or missing [DMAPI5_TOPIC_PARAMETER_NEW_PORT]]")
|
||||
return TopicResponse("Invalid or missing [DMAPI5_TOPIC_PARAMETER_NEW_PORT]")
|
||||
|
||||
server_port = new_port
|
||||
return TopicResponse()
|
||||
|
||||
if(DMAPI5_TOPIC_COMMAND_HEALTHCHECK)
|
||||
if(event_handler?.receive_health_checks)
|
||||
if(event_handler && event_handler.receive_health_checks)
|
||||
event_handler.HandleEvent(TGS_EVENT_HEALTH_CHECK)
|
||||
return TopicResponse()
|
||||
|
||||
@@ -148,7 +157,7 @@
|
||||
var/error_message = null
|
||||
if(new_port != null)
|
||||
if(!isnum(new_port) || !(new_port > 0))
|
||||
error_message = "Invalid [DMAPI5_TOPIC_PARAMETER_NEW_PORT]]"
|
||||
error_message = "Invalid [DMAPI5_TOPIC_PARAMETER_NEW_PORT]"
|
||||
else
|
||||
server_port = new_port
|
||||
|
||||
@@ -156,7 +165,7 @@
|
||||
if(!istext(new_version_string))
|
||||
if(error_message != null)
|
||||
error_message += ", "
|
||||
error_message += "Invalid or missing [DMAPI5_TOPIC_PARAMETER_NEW_SERVER_VERSION]]"
|
||||
error_message += "Invalid or missing [DMAPI5_TOPIC_PARAMETER_NEW_SERVER_VERSION]"
|
||||
else
|
||||
var/datum/tgs_version/new_version = new(new_version_string)
|
||||
if(event_handler)
|
||||
@@ -166,6 +175,7 @@
|
||||
|
||||
var/list/reattach_response = TopicResponse(error_message)
|
||||
reattach_response[DMAPI5_PARAMETER_CUSTOM_COMMANDS] = ListCustomCommands()
|
||||
reattach_response[DMAPI5_PARAMETER_TOPIC_PORT] = GetTopicPort()
|
||||
return reattach_response
|
||||
|
||||
if(DMAPI5_TOPIC_COMMAND_SEND_CHUNK)
|
||||
@@ -258,4 +268,16 @@
|
||||
|
||||
return chunk_to_send
|
||||
|
||||
if(DMAPI5_TOPIC_COMMAND_RECEIVE_BROADCAST)
|
||||
var/message = topic_parameters[DMAPI5_TOPIC_PARAMETER_BROADCAST_MESSAGE]
|
||||
if(!istext(message))
|
||||
return TopicResponse("Invalid or missing [DMAPI5_TOPIC_PARAMETER_BROADCAST_MESSAGE]")
|
||||
|
||||
TGS_WORLD_ANNOUNCE(message)
|
||||
return TopicResponse()
|
||||
|
||||
return TopicResponse("Unknown command: [command]")
|
||||
|
||||
/datum/tgs_api/v5/proc/WorldBroadcast(message)
|
||||
set waitfor = FALSE
|
||||
TGS_WORLD_ANNOUNCE(message)
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#undef DMAPI5_TOPIC_REQUEST_LIMIT
|
||||
#undef DMAPI5_TOPIC_RESPONSE_LIMIT
|
||||
|
||||
#undef DMAPI5_BRIDGE_COMMAND_PORT_UPDATE
|
||||
#undef DMAPI5_BRIDGE_COMMAND_STARTUP
|
||||
#undef DMAPI5_BRIDGE_COMMAND_PRIME
|
||||
#undef DMAPI5_BRIDGE_COMMAND_REBOOT
|
||||
@@ -18,6 +17,7 @@
|
||||
|
||||
#undef DMAPI5_PARAMETER_ACCESS_IDENTIFIER
|
||||
#undef DMAPI5_PARAMETER_CUSTOM_COMMANDS
|
||||
#undef DMAPI5_PARAMETER_TOPIC_PORT
|
||||
|
||||
#undef DMAPI5_CHUNK
|
||||
#undef DMAPI5_CHUNK_PAYLOAD
|
||||
@@ -48,6 +48,7 @@
|
||||
#undef DMAPI5_RUNTIME_INFORMATION_REVISION
|
||||
#undef DMAPI5_RUNTIME_INFORMATION_TEST_MERGES
|
||||
#undef DMAPI5_RUNTIME_INFORMATION_SECURITY_LEVEL
|
||||
#undef DMAPI5_RUNTIME_INFORMATION_VISIBILITY
|
||||
|
||||
#undef DMAPI5_CHAT_UPDATE_CHANNELS
|
||||
|
||||
@@ -77,6 +78,9 @@
|
||||
#undef DMAPI5_TOPIC_COMMAND_SERVER_PORT_UPDATE
|
||||
#undef DMAPI5_TOPIC_COMMAND_HEALTHCHECK
|
||||
#undef DMAPI5_TOPIC_COMMAND_WATCHDOG_REATTACH
|
||||
#undef DMAPI5_TOPIC_COMMAND_SEND_CHUNK
|
||||
#undef DMAPI5_TOPIC_COMMAND_RECEIVE_CHUNK
|
||||
#undef DMAPI5_TOPIC_COMMAND_RECEIVE_BROADCAST
|
||||
|
||||
#undef DMAPI5_TOPIC_PARAMETER_COMMAND_TYPE
|
||||
#undef DMAPI5_TOPIC_PARAMETER_CHAT_COMMAND
|
||||
@@ -86,6 +90,7 @@
|
||||
#undef DMAPI5_TOPIC_PARAMETER_NEW_INSTANCE_NAME
|
||||
#undef DMAPI5_TOPIC_PARAMETER_CHAT_UPDATE
|
||||
#undef DMAPI5_TOPIC_PARAMETER_NEW_SERVER_VERSION
|
||||
#undef DMAPI5_TOPIC_PARAMETER_BROADCAST_MESSAGE
|
||||
|
||||
#undef DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE
|
||||
#undef DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE_MESSAGE
|
||||
|
||||
Reference in New Issue
Block a user