diff --git a/code/__defines/art.dm b/code/__defines/art.dm deleted file mode 100644 index 473f7f3565e..00000000000 --- a/code/__defines/art.dm +++ /dev/null @@ -1,5 +0,0 @@ - -///tgui tab portrait categories- they're the same across all portrait tguis. -#define TAB_LIBRARY 1 -#define TAB_SECURE 2 -#define TAB_PRIVATE 3 diff --git a/code/_global_vars/_regexes.dm b/code/_global_vars/_regexes.dm index 336706fc468..cf5995f6999 100644 --- a/code/_global_vars/_regexes.dm +++ b/code/_global_vars/_regexes.dm @@ -3,6 +3,9 @@ GLOBAL_DATUM_INIT(is_http_protocol, /regex, regex("^https?://")) GLOBAL_DATUM_INIT(is_valid_url, /regex, regex("((?:https://)\[-a-zA-Z0-9@:%._+~#=]{1,256}.\[-a-zA-Z0-9@:%._+~#=]{1,256}\\b(?:\[-a-zA-Z0-9@():%_+.,~#?&/=]*\[^.,!?:; ()<>{}\\[]\n\"'ยด`]))", "gm")) +//finds text strings recognized as links on discord. Mainly used to stop embedding. +GLOBAL_DATUM_INIT(has_discord_embeddable_links, /regex, regex("(https?://\[^\\s|<\]{2,})")) + //All < and > characters GLOBAL_DATUM_INIT(angular_brackets, /regex, regex(@"[<>]", "g")) diff --git a/code/_helpers/chat.dm b/code/_helpers/chat.dm new file mode 100644 index 00000000000..dbb124b9508 --- /dev/null +++ b/code/_helpers/chat.dm @@ -0,0 +1,14 @@ +/** + * Asynchronously sends a message to TGS admin chat channels. + * + * category - The category of the mssage. + * message - The message to send. + */ +/proc/send2adminchat(category, message, embed_links = FALSE) + set waitfor = FALSE + + category = replacetext(replacetext(category, "\proper", ""), "\improper", "") + message = replacetext(replacetext(message, "\proper", ""), "\improper", "") + if(!embed_links) + message = GLOB.has_discord_embeddable_links.Replace(replacetext(message, "`", ""), " ```$1``` ") + world.TgsTargetedChatBroadcast(new /datum/tgs_message_content("[category] | [message]"), TRUE) diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm index 240d05f82b7..b0350a32564 100644 --- a/code/controllers/subsystems/ticker.dm +++ b/code/controllers/subsystems/ticker.dm @@ -237,9 +237,7 @@ SUBSYSTEM_DEF(ticker) var/list/adm = get_admin_counts() var/list/allmins = adm["present"] - // TODO: IMPLEMENT: send2adminchat("Server", "Round [GLOB.round_id ? "#[GLOB.round_id]" : ""] has started[allmins.len ? ".":" with no active admins online!"]") - if(!allmins.len) - send2adminirc("A round has started with no admins online.") + send2adminchat("Server", "Round [GLOB.round_id ? "#[GLOB.round_id]" : ""] has started[allmins.len ? ".":" with no active admins online!"]") setup_done = TRUE // TODO START diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index cdce34f3925..f7cdf7dd358 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -369,7 +369,7 @@ GLOBAL_LIST_EMPTY(additional_antag_types) if(escaped_on_pod_5 > 0) feedback_set("escaped_on_pod_5",escaped_on_pod_5) - send2mainirc("A round of [src.name] has ended - [surviving_total] survivors, [ghosts] ghosts.") + // send2mainirc("A round of [src.name] has ended - [surviving_total] survivors, [ghosts] ghosts.") SSwebhooks.send( WEBHOOK_ROUNDEND, list( diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index bd628f16592..c77eb775ec6 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -146,7 +146,6 @@ to_chat(src, span_admin_pm_notice("PM to-" + span_bold("Admins") + ": [rawmsg]")) admin_ticket_log(src, span_admin_pm_warning("Reply PM from-" + span_bold("[key_name(src, TRUE, TRUE)]") + " to " + span_italics("IRC") + ": [keywordparsedmsg]")) ircreplyamount-- - send2irc("Reply: [ckey]",rawmsg) else if(recipient.holder) if(holder) //both are admins diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 07c2275f164..3d4591f0806 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -112,16 +112,6 @@ cmd_mentor_pm(C, null) return - if(href_list["irc_msg"]) - if(!check_rights_for(src, R_HOLDER) && received_irc_pm < world.time - 6000) //Worse they can do is spam IRC for 10 minutes - to_chat(src, span_warning("You are no longer able to use this, it's been more than 10 minutes since an admin on IRC has responded to you")) - return - if(mute_irc) - to_chat(usr, span_warning("You cannot use this as your client has been muted from sending messages to the admins on IRC")) - return - send2adminirc(href_list["irc_msg"]) - return - //VOREStation Add if(href_list["discord_reg"]) var/their_id = html_decode(href_list["discord_reg"]) diff --git a/code/modules/ext_scripts/github.dm b/code/modules/ext_scripts/github.dm deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/code/modules/ext_scripts/irc.dm b/code/modules/ext_scripts/irc.dm deleted file mode 100644 index f5c1a0584d0..00000000000 --- a/code/modules/ext_scripts/irc.dm +++ /dev/null @@ -1,41 +0,0 @@ -/proc/send2irc(var/channel, var/msg) - return // VOREStation Edit - Can't exploit shell if we never call shell! - /* Unreachable with above VOREStation Edit - if (config.use_irc_bot) - if (config.use_node_bot) - shell("node bridge.js -h \"[config.irc_bot_host]\" -p \"[config.irc_bot_port]\" -c \"[channel]\" -m \"[escape_shell_arg(msg)]\"") - else - if (config.irc_bot_host) - if(config.irc_bot_export) - spawn(-1) // spawn here prevents hanging in the case that the bot isn't reachable - world.Export("http://[config.irc_bot_host]:45678?[list2params(list(pwd=config.comms_password, chan=channel, mesg=msg))]") - else - if(config.use_lib_nudge) - var/nudge_lib - if(world.system_type == MS_WINDOWS) - nudge_lib = "lib\\nudge.dll" - else - nudge_lib = "lib/nudge.so" - - spawn(0) - LIBCALL(nudge_lib, "nudge")("[config.comms_password]","[config.irc_bot_host]","[channel]","[escape_shell_arg(msg)]") - else - spawn(0) - ext_python("ircbot_message.py", "[config.comms_password] [config.irc_bot_host] [channel] [escape_shell_arg(msg)]") - return - */ - -/proc/send2mainirc(var/msg) - if(CONFIG_GET(string/main_irc)) - send2irc(CONFIG_GET(string/main_irc), msg) - return - -/proc/send2adminirc(var/msg) - if(CONFIG_GET(string/admin_irc)) - send2irc(CONFIG_GET(string/admin_irc), msg) - return - - -/hook/startup/proc/ircNotify() - send2mainirc("Server starting up on byond://[CONFIG_GET(string/serverurl) ? CONFIG_GET(string/serverurl) : (CONFIG_GET(string/server) ? CONFIG_GET(string/server) : "[world.address]:[world.port]")]") - return 1 diff --git a/code/modules/ext_scripts/python.dm b/code/modules/ext_scripts/python.dm deleted file mode 100644 index d7cb462d194..00000000000 --- a/code/modules/ext_scripts/python.dm +++ /dev/null @@ -1,30 +0,0 @@ -// Ported from /vg/. -/proc/escape_shell_arg(var/arg) - // RCE prevention - // - Encloses arg in single quotes - // - Escapes single quotes - // Also escapes %, ! on windows - if(world.system_type == MS_WINDOWS) - arg = replacetext(arg, "^", "^^") // Escape char - arg = replacetext(arg, "%", "%%") // %PATH% -> %%PATH%% - arg = replacetext(arg, "!", "^!") // !PATH!, delayed variable expansion on Windows - arg = replacetext(arg, "\"", "^\"") - arg = "\"[arg]\"" - else - arg = replacetext(arg, "\\", "\\\\'") // Escape char - arg = replacetext(arg, "'", "\\'") // No breaking out of the single quotes. - arg = "'[arg]'" - return arg - -/proc/ext_python(var/script, var/arguments, var/scriptsprefix = 1) - return // VOREStation Edit - Can't exploit shell if we never call shell! - /* Unreachable with above vorestation edit - if(scriptsprefix) - script = "scripts/" + script - - if(world.system_type == MS_WINDOWS) - script = replacetext(script, "/", "\\") - - var/command = config.python_path + " " + script + " " + arguments - return shell(command) - */ diff --git a/code/modules/mob/logout.dm b/code/modules/mob/logout.dm index c1a1a9ca814..1f7e49f67ff 100644 --- a/code/modules/mob/logout.dm +++ b/code/modules/mob/logout.dm @@ -6,15 +6,12 @@ update_client_z(null) log_access_out(src) unset_machine() + var/datum/admins/is_admin = GLOB.admin_datums[src.ckey] if(is_admin && is_admin.check_for_rights(R_HOLDER)) message_admins("Staff logout: [key_name(src)]") // Staff logout notice displays no matter what - if (SSticker && SSticker.current_state == GAME_STATE_PLAYING) //Only report this stuff if we are currently playing. - var/admins_number = GLOB.admins.len - if(admins_number == 0) //Apparently the admin logging out is no longer an admin at this point, so we have to check this towards 0 and not towards 1. Awell. - send2adminirc("[key_name(src)] logged out - no more admins online.") set_listening(NON_LISTENING_ATOM) //maybe remove this, even if it will cause a teensy bit more lag ..() - return 1 + return TRUE diff --git a/code/modules/tickets/procs.dm b/code/modules/tickets/procs.dm index 071f0d7b79b..b288fbcc19a 100644 --- a/code/modules/tickets/procs.dm +++ b/code/modules/tickets/procs.dm @@ -144,7 +144,7 @@ ADMIN_VERB(cmd_mentor_ticket_panel, (R_ADMIN|R_SERVER|R_MOD|R_MENTOR), "Mentor T //// VOREstation Additions Below -/datum/ticket/proc/send2adminchat() +/datum/ticket/proc/send2adminchatwebhook() if(!CONFIG_GET(string/chat_webhook_url)) return diff --git a/code/modules/tickets/tickets.dm b/code/modules/tickets/tickets.dm index 788de9810da..89b16161680 100644 --- a/code/modules/tickets/tickets.dm +++ b/code/modules/tickets/tickets.dm @@ -315,7 +315,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket_list) log_admin("Ticket #[id]: [key_name(initiator)]: [name] - heard by [admin_number_present] non-AFK admins who have +BAN.") if(admin_number_present <= 0) to_chat(C, span_notice("No active admins are online, your adminhelp was sent to the admin discord.")) - send2adminchat() + send2adminchatwebhook() var/list/adm = get_admin_counts() var/list/activemins = adm["present"] @@ -790,7 +790,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/statclick/ticket) final = "[msg] - No admins online" else final = "[msg] - All admins stealthed\[[english_list(stealthmins)]\], AFK\[[english_list(afkmins)]\], or lacks +BAN\[[english_list(powerlessmins)]\]! Total: [allmins.len] " - send2irc(source,final) + // send2irc(source,final) /proc/ircadminwho() var/list/message = list("Admins: ") diff --git a/vorestation.dme b/vorestation.dme index 49b9388e0cb..5dd0e32428d 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -249,6 +249,7 @@ #include "code\_helpers\announcements.dm" #include "code\_helpers\atmospherics.dm" #include "code\_helpers\atom_movables.dm" +#include "code\_helpers\chat.dm" #include "code\_helpers\datums.dm" #include "code\_helpers\events.dm" #include "code\_helpers\files.dm" @@ -2634,8 +2635,6 @@ #include "code\modules\examine\descriptions\telecomms.dm" #include "code\modules\examine\descriptions\turfs.dm" #include "code\modules\examine\descriptions\weapons.dm" -#include "code\modules\ext_scripts\irc.dm" -#include "code\modules\ext_scripts\python.dm" #include "code\modules\fireworks\firework_launcher.dm" #include "code\modules\fireworks\firework_stars.dm" #include "code\modules\fireworks\launcher_construction.dm"