diff --git a/Kiseki.Launcher/Models/WebResponse.cs b/Kiseki.Launcher/Models/WebResponse.cs new file mode 100644 index 0000000..4ada137 --- /dev/null +++ b/Kiseki.Launcher/Models/WebResponse.cs @@ -0,0 +1,13 @@ +namespace Kiseki.Launcher.Models; + +public readonly struct WebResponse +{ + public WebResponse(int status, object? data) + { + Status = status; + Data = data; + } + + public int Status { get; } + public object? Data { get; } +} \ No newline at end of file diff --git a/Kiseki.Launcher/Web.cs b/Kiseki.Launcher/Web.cs index be4fd4d..2747d92 100644 --- a/Kiseki.Launcher/Web.cs +++ b/Kiseki.Launcher/Web.cs @@ -18,10 +18,10 @@ public static class Web CurrentUrl = IsInMaintenance ? $"{Constants.MAINTENANCE_DOMAIN}.{Constants.BASE_URL}" : Constants.BASE_URL; // Synchronous block is intentional - Task task = CheckHealth(); + Task task = CheckHealth(); task.Wait(); - int response = task.Result; + int response = task.Result.Status; if (response != RESPONSE_SUCCESS) { @@ -35,11 +35,11 @@ public static class Web public static string Url(string path) => $"https://{CurrentUrl}{path}"; - public static async Task CheckHealth() + public static async Task CheckHealth() { var response = await Helpers.Http.GetJson(Url("/api/health")); - return response?.Status ?? RESPONSE_FAILURE; + return new Models.WebResponse(response?.Status ?? RESPONSE_FAILURE, response); } public static bool LoadLicense(string license)