Implemented "roundtrip" status checking. Added node ssl field.

This commit is contained in:
2024-12-13 20:12:56 +01:00
parent 3c88b60e8d
commit d15c5326ed
16 changed files with 872 additions and 7 deletions

View File

@@ -0,0 +1,54 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using MoonlightServers.Daemon.Services;
using MoonlightServers.DaemonShared.Http.Responses.Sys;
namespace MoonlightServers.Daemon.Http.Controllers.Sys;
[ApiController]
[Route("api/system/status")]
public class SystemStatusController : Controller
{
private readonly RemoteService RemoteService;
public SystemStatusController(RemoteService remoteService)
{
RemoteService = remoteService;
}
public async Task<SystemStatusResponse> Get()
{
SystemStatusResponse response;
var sw = new Stopwatch();
sw.Start();
try
{
await RemoteService.GetStatus();
sw.Stop();
response = new()
{
TripSuccess = true,
TripTime = sw.Elapsed,
Version = "2.1.0" // TODO: Set global
};
}
catch (Exception e)
{
sw.Stop();
response = new()
{
TripError = e.Message,
TripTime = sw.Elapsed,
TripSuccess = false,
Version = "2.1.0" // TODO: Set global
};
}
return response;
}
}