mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-27 07:04:57 +01:00
I'm not angry
This commit is contained in:
+19
-1
@@ -121,7 +121,25 @@
|
||||
sleep(10)
|
||||
|
||||
/datum/tgs_api/v4/proc/Export(command)
|
||||
return file2text(world.Export("[host_path]/Interop/[instance_id]?command=[url_encode(command)]&access_token=[access_token]")["CONTENT"])
|
||||
var/list/res = world.Export("[host_path]/Interop?access=[url_encode(access_identifier)]&command=[url_encode(command)]")
|
||||
if(!istype(res))
|
||||
TGS_ERROR_LOG("Error contacting TGS webapi at [host_path]! Export returned something not a list (probably null): [res]")
|
||||
return
|
||||
var/byond_status = res["STATUS"]
|
||||
var/byond_content = res["CONTENT"]
|
||||
if(byond_status != "200 OK")
|
||||
TGS_ERROR_LOG("Error contacting TGS webapi at [host_path]! Top level HTTP [byond_status]: [byond_content]")
|
||||
return
|
||||
var/json = json_decode(byond_content) //always expecting json
|
||||
if(!json)
|
||||
TGS_ERROR_LOG("Error contacting TGS webapi at [host_path]! Byond content not json: [byond_content]")
|
||||
return
|
||||
var/status = json["STATUS"]
|
||||
var/content = json["CONTENT"]
|
||||
if(status != 200) //HTTP OK
|
||||
TGS_ERROR_LOG("Error contacting TGS webapi at [host_path]! HTTP [status]: [json_encode(content)]")
|
||||
return
|
||||
return content
|
||||
|
||||
/datum/tgs_api/v4/OnReboot()
|
||||
var/json = Export(TGS4_COMM_SERVER_REBOOT)
|
||||
|
||||
@@ -97,6 +97,13 @@ namespace Tgstation.Server.Host.Components
|
||||
SecurityLevel = DreamDaemonSecurity.Safe //all it needs to read the file and exit
|
||||
};
|
||||
|
||||
var dirA = ioManager.ConcatPath(job.DirectoryName.ToString(), ADirectoryName);
|
||||
var provider = new TemporaryDmbProvider(ioManager.ResolvePath(ioManager.GetDirectoryName(dirA)), ioManager.ResolvePath(ioManager.ConcatPath(dirA, String.Concat(job.DmeName, DmbExtension))));
|
||||
using (var controller = await sessionControllerFactory.LaunchNew(launchParameters, provider, true, true, true, cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
using (var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken))
|
||||
using (var control = interop.CreateRun(launchParameters.PrimaryPort.Value, null, null))
|
||||
{
|
||||
@@ -112,7 +119,6 @@ namespace Tgstation.Server.Host.Components
|
||||
if (e.EventType == ServerControlEventType.ServerUnresponsive)
|
||||
ddTcs.SetResult(null);
|
||||
};
|
||||
var dirA = ioManager.ConcatPath(job.DirectoryName.ToString(), ADirectoryName);
|
||||
var ddTestTask = dreamDaemonExecutor.RunDreamDaemon(launchParameters, null, dreamDaemonPath, new TemporaryDmbProvider(ioManager.ResolvePath(ioManager.GetDirectoryName(dirA)), ioManager.ResolvePath(ioManager.ConcatPath(dirA, String.Concat(job.DmeName, DmbExtension)))), interopInfo, true, false, cts.Token);
|
||||
|
||||
await Task.WhenAny(ddTcs.Task, ddTestTask).ConfigureAwait(false);
|
||||
|
||||
@@ -7,6 +7,11 @@ namespace Tgstation.Server.Host.Components.Watchdog
|
||||
/// </summary>
|
||||
sealed class LaunchResult
|
||||
{
|
||||
/// <summary>
|
||||
/// If the DMAPI was validated
|
||||
/// </summary>
|
||||
public bool? ApiValidated { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The time it took for <see cref="System.Diagnostics.Process.WaitForInputIdle"/> to return
|
||||
/// </summary>
|
||||
|
||||
@@ -39,9 +39,12 @@ namespace Tgstation.Server.Host.Controllers
|
||||
{
|
||||
var result = await instanceManager.HandleWorldExport(Request.Query, cancellationToken).ConfigureAwait(false);
|
||||
//explain things in very simple terms dream daemon can understand
|
||||
if (result != null)
|
||||
return Json(result);
|
||||
return NotFound();
|
||||
//EXCEPT DREAMDAENEN BUGS
|
||||
//THAT"S RIGHT !BUGS!
|
||||
//ON ANYTHING THAT ISNT A 200 RESPOSNCE REEEE
|
||||
if (result == null)
|
||||
result = new { STATUS = 404 };
|
||||
return Json(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user