Skip to content

Commit

Permalink
fix: more plexora things i forgot to fix earlier (Monkestation#4897)
Browse files Browse the repository at this point in the history
  • Loading branch information
flleeppyy authored Jan 15, 2025
1 parent 4ca4323 commit 12f05a0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions monkestation/code/controllers/subsystem/plexora.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ SUBSYSTEM_DEF(plexora)
http_root = config["ip"]
http_port = config["port"]

default_headers = list(
"Content-Type" = "application/json",
"Authorization" = AUTH_HEADER,
)

// Do a ping test to check if Plexora is actually running
if (!is_plexora_alive())
stack_trace("SSplexora is enabled BUT plexora is not alive or running! SS has not been aborted, subsequent fires will take place.")
Expand All @@ -81,10 +86,6 @@ SUBSYSTEM_DEF(plexora)

RegisterSignal(SSticker, COMSIG_TICKER_ROUND_STARTING, PROC_REF(roundstarted))

default_headers = list(
"Content-Type" = "application/json",
"Authorization" = AUTH_HEADER,
)
return SS_INIT_SUCCESS

/datum/controller/subsystem/plexora/Recover()
Expand All @@ -109,6 +110,7 @@ SUBSYSTEM_DEF(plexora)
var/datum/http_response/response = request.into_response()
if (response.errored)
plexora_is_alive = FALSE
log_admin("Failed to check if Plexora is alive! She probably isn't. Check config on both sides")
CRASH("Failed to check if Plexora is alive! She probably isn't. Check config on both sides")
else
var/list/json_body = json_decode(response.body)
Expand Down Expand Up @@ -209,7 +211,7 @@ SUBSYSTEM_DEF(plexora)
"id" = id
)

var/datum/http_request/request = new(RUSTG_HTTP_METHOD_GET, "http://[http_root]:[http_port]/byondserver_alive", json_encode(body))
var/datum/http_request/request = new(RUSTG_HTTP_METHOD_GET, "http://[http_root]:[http_port]/byondserver_alive", json_encode(body), default_headers)
request.begin_async()
UNTIL_OR_TIMEOUT(request.is_complete(), 5 SECONDS)
var/datum/http_response/response = request.into_response()
Expand Down

0 comments on commit 12f05a0

Please sign in to comment.