mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 08:37:43 +01:00
Prevent admins from using restart option which can leak DB connections. Adds timeouts to TTS HTTPS requests (rust-g version bump required). (#90182)
🆑 config: Added `TTS_HTTP_TIMEOUT_SECONDS` for setting the maximum duration TTS HTTP requests can run for before being aborted. /🆑 DNM because we need the rust-g PR to get released: https://github.com/tgstation/rust-g/pull/210 Crit prio because rounds will not restart if there are hung TTS requests and the TTS server is absolute dogshit and doesn't prevent them.
This commit is contained in:
@@ -457,6 +457,11 @@
|
||||
|
||||
/datum/config_entry/str_list/tts_voice_blacklist
|
||||
|
||||
/// Maximum timeout for http calls
|
||||
/datum/config_entry/number/tts_http_timeout_seconds
|
||||
default = 30
|
||||
min_val = 0
|
||||
|
||||
/datum/config_entry/flag/give_tutorials_without_db
|
||||
|
||||
/datum/config_entry/string/new_player_alert_role_id
|
||||
|
||||
@@ -58,7 +58,7 @@ SUBSYSTEM_DEF(tts)
|
||||
var/datum/http_request/request = new()
|
||||
var/list/headers = list()
|
||||
headers["Authorization"] = CONFIG_GET(string/tts_http_token)
|
||||
request.prepare(RUSTG_HTTP_METHOD_GET, "[CONFIG_GET(string/tts_http_url)]/tts-voices", "", headers)
|
||||
request.prepare(RUSTG_HTTP_METHOD_GET, "[CONFIG_GET(string/tts_http_url)]/tts-voices", "", headers, timeout_seconds = CONFIG_GET(number/tts_http_timeout_seconds))
|
||||
request.begin_async()
|
||||
UNTIL(request.is_complete())
|
||||
var/datum/http_response/response = request.into_response()
|
||||
@@ -77,7 +77,7 @@ SUBSYSTEM_DEF(tts)
|
||||
var/datum/http_request/request_pitch = new()
|
||||
var/list/headers_pitch = list()
|
||||
headers_pitch["Authorization"] = CONFIG_GET(string/tts_http_token)
|
||||
request_pitch.prepare(RUSTG_HTTP_METHOD_GET, "[CONFIG_GET(string/tts_http_url)]/pitch-available", "", headers_pitch)
|
||||
request_pitch.prepare(RUSTG_HTTP_METHOD_GET, "[CONFIG_GET(string/tts_http_url)]/pitch-available", "", headers_pitch, timeout_seconds = CONFIG_GET(number/tts_http_timeout_seconds))
|
||||
request_pitch.begin_async()
|
||||
UNTIL(request_pitch.is_complete())
|
||||
pitch_enabled = TRUE
|
||||
@@ -295,8 +295,8 @@ SUBSYSTEM_DEF(tts)
|
||||
var/datum/http_request/request_blips = new()
|
||||
var/file_name = "tmp/tts/[identifier].ogg"
|
||||
var/file_name_blips = "tmp/tts/[identifier]_blips.ogg"
|
||||
request.prepare(RUSTG_HTTP_METHOD_GET, "[CONFIG_GET(string/tts_http_url)]/tts?voice=[speaker]&identifier=[identifier]&filter=[url_encode(filter)]&pitch=[pitch]&special_filters=[url_encode(special_filters)]", json_encode(list("text" = shell_scrubbed_input)), headers, file_name)
|
||||
request_blips.prepare(RUSTG_HTTP_METHOD_GET, "[CONFIG_GET(string/tts_http_url)]/tts-blips?voice=[speaker]&identifier=[identifier]&filter=[url_encode(filter)]&pitch=[pitch]&special_filters=[url_encode(special_filters)]", json_encode(list("text" = shell_scrubbed_input)), headers, file_name_blips)
|
||||
request.prepare(RUSTG_HTTP_METHOD_GET, "[CONFIG_GET(string/tts_http_url)]/tts?voice=[speaker]&identifier=[identifier]&filter=[url_encode(filter)]&pitch=[pitch]&special_filters=[url_encode(special_filters)]", json_encode(list("text" = shell_scrubbed_input)), headers, file_name, timeout_seconds = CONFIG_GET(number/tts_http_timeout_seconds))
|
||||
request_blips.prepare(RUSTG_HTTP_METHOD_GET, "[CONFIG_GET(string/tts_http_url)]/tts-blips?voice=[speaker]&identifier=[identifier]&filter=[url_encode(filter)]&pitch=[pitch]&special_filters=[url_encode(special_filters)]", json_encode(list("text" = shell_scrubbed_input)), headers, file_name_blips, timeout_seconds = CONFIG_GET(number/tts_http_timeout_seconds))
|
||||
var/datum/tts_request/current_request = new /datum/tts_request(identifier, request, request_blips, shell_scrubbed_input, target, local, language, message_range, volume_offset, listeners, pitch)
|
||||
var/list/player_queued_tts_messages = queued_tts_messages[target]
|
||||
if(!player_queued_tts_messages)
|
||||
|
||||
Reference in New Issue
Block a user