This commit is contained in:
Jordan Brown
2020-04-22 01:39:04 -04:00
parent cfbe382892
commit c20200fdca
2 changed files with 30 additions and 30 deletions
+11 -11
View File
@@ -7,9 +7,9 @@
var/reboot_mode = TGS_REBOOT_MODE_NORMAL
var/security_level
var/server_port
var/list/intercepted_message_queue
var/list/custom_commands
var/list/cached_test_merges
@@ -41,7 +41,7 @@
if(cached_json[DMAPI5_RUNTIME_INFORMATION_API_VALIDATE_ONLY])
TGS_INFO_LOG("Validating DMAPI and exiting...")
Bridge(DMAPI5_BRIDGE_COMMAND_VALIDATE, list(DMAPI5_BRIDGE_PARAMETER_MINIMUM_SECURITY_LEVEL = minimum_required_security_level, DMAPI5_BRIDGE_PARAMETER_VERSION = Version()))
Bridge(DMAPI5_BRIDGE_COMMAND_VALIDATE, list(DMAPI5_BRIDGE_PARAMETER_MINIMUM_SECURITY_LEVEL = minimum_required_security_level, DMAPI5_BRIDGE_PARAMETER_VERSION = ApiVersion()))
del(world)
security_level = cached_json[DMAPI5_RUNTIME_INFORMATION_SECURITY_LEVEL]
@@ -91,7 +91,7 @@
if(world.sleep_offline == tgs4_secret_sleep_offline_sauce) //if not someone changed it
world.sleep_offline = old_sleep_offline
/datum/tgs_api/v5/TopicError(message)
/datum/tgs_api/v5/proc/TopicError(message)
return json_encode(list(DMAPI5_RESPONSE_ERROR_MESSAGE = message))
/datum/tgs_api/v5/OnTopic(T)
@@ -181,7 +181,7 @@
TGS_ERROR_LOG("Failed export request: [json]")
return
var/response_json = file2text(export_result["CONTENT"])
var/response_json = file2text(export_response["CONTENT"])
if(!response_json)
TGS_ERROR_LOG("Failed export request, missing content!")
return
@@ -190,19 +190,19 @@
if(!bridge_response)
TGS_ERROR_LOG("Failed export request, bad json: [response_json]")
return
var/error = bridge_response[DMAPI5_RESPONSE_ERROR_MESSAGE]
if(error)
TGS_ERROR_LOG("Failed export request, bad request: [error]")
return
return bridge_response
/datum/tgs_api/v5/OnReboot()
var/list/result = Bridge(DMAPI5_BRIDGE_COMMAND_REBOOT)
if(!result)
return
//okay so the standard TGS4 proceedure is: right before rebooting change the port to whatever was sent to us in the above json's data parameter
var/port = result[DMAPI5_BRIDGE_RESPONSE_NEW_PORT]
@@ -221,7 +221,7 @@
/datum/tgs_api/v5/TestMerges()
return cached_test_merges
/datum/tgs_api/v5/EndProcess()
Bridge(DMAPI5_BRIDGE_COMMAND_KILL)
@@ -251,14 +251,14 @@
if(intercepted_message_queue)
intercepted_message_queue += list(message)
else
Export(TGS4_COMM_CHAT, message)
Bridge(TGS4_COMM_CHAT, message)
/datum/tgs_api/v5/ChatPrivateMessage(message, datum/tgs_chat_user/user)
message = list(DMAPI5_CHAT_MESSAGE_TEXT = message, DMAPI5_CHAT_MESSAGE_CHANNEL_IDS = list(user.channel.id))
if(intercepted_message_queue)
intercepted_message_queue += list(message)
else
Export(TGS4_COMM_CHAT, message)
Bridge(TGS4_COMM_CHAT, message)
/datum/tgs_api/v5/ChatChannelInfo()
. = list()
+19 -19
View File
@@ -21,9 +21,9 @@
text2file(json_encode(results), commands_file)
/datum/tgs_api/v5/proc/HandleCustomCommand(list/command_json)
var/command = data[DMAPI5_CHAT_COMMAND_NAME]
var/user = data[DMAPI5_CHAT_COMMAND_USER]
var/params = data[DMAPI5_CHAT_COMMAND_PARAMS]
var/command = command_json[DMAPI5_CHAT_COMMAND_NAME]
var/user = command_json[DMAPI5_CHAT_COMMAND_USER]
var/params = command_json[DMAPI5_CHAT_COMMAND_PARAMS]
var/datum/tgs_chat_user/u = new
u.id = user[DMAPI5_CHAT_USER_ID]
@@ -36,7 +36,7 @@
var/textResponse = sc.Run(u, params)
var/list/topic_response = list()
if(textResponse != null)
topic_response(DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE_MESSAGE = textResponse)
topic_response[DMAPI5_TOPIC_RESPONSE_COMMAND_RESPONSE_MESSAGE] = textResponse
return topic_response
return TopicError("Unknown custom chat command: [command]!")
@@ -46,24 +46,24 @@ The MIT License
Copyright (c) 2020 Jordan Brown
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and
associated documentation files (the "Software"), to
deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom
the Software is furnished to do so,
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and
associated documentation files (the "Software"), to
deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom
the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice
The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/