From c1d58fbf7a7729b35ded5e12d3042b72ac830b84 Mon Sep 17 00:00:00 2001 From: rjindael Date: Mon, 31 Jul 2023 02:55:12 -0700 Subject: [PATCH] fix: rename Health->HealthCheck & url format fix --- Kiseki.Launcher/Models/Health.cs | 7 ------- Kiseki.Launcher/Models/HealthCheck.cs | 10 ++++++++++ Kiseki.Launcher/Web.cs | 10 +++++----- 3 files changed, 15 insertions(+), 12 deletions(-) delete mode 100644 Kiseki.Launcher/Models/Health.cs create mode 100644 Kiseki.Launcher/Models/HealthCheck.cs diff --git a/Kiseki.Launcher/Models/Health.cs b/Kiseki.Launcher/Models/Health.cs deleted file mode 100644 index 97d3fe0..0000000 --- a/Kiseki.Launcher/Models/Health.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Kiseki.Launcher.Models -{ - public class Health - { - public int Response { get; set; } = -1; - } -} \ No newline at end of file diff --git a/Kiseki.Launcher/Models/HealthCheck.cs b/Kiseki.Launcher/Models/HealthCheck.cs new file mode 100644 index 0000000..4a9f71f --- /dev/null +++ b/Kiseki.Launcher/Models/HealthCheck.cs @@ -0,0 +1,10 @@ +using System.Text.Json.Serialization; + +namespace Kiseki.Launcher.Models +{ + public class HealthCheck + { + [JsonPropertyName("status")] + public int Status { get; set; } = -1; + } +} \ No newline at end of file diff --git a/Kiseki.Launcher/Web.cs b/Kiseki.Launcher/Web.cs index 1245bcc..2fe6378 100644 --- a/Kiseki.Launcher/Web.cs +++ b/Kiseki.Launcher/Web.cs @@ -14,19 +14,19 @@ namespace Kiseki.Launcher public static string CurrentUrl { get; private set; } = ""; public static void Initialize() => CurrentUrl = BaseUrl; - public static string Url(string path) => $"https://{CurrentUrl}/{path}"; + public static string Url(string path) => $"https://{CurrentUrl}{path}"; public static async Task CheckHealth() { - var response = await Helpers.Http.GetJson(Url("/api/health")); - - return response?.Response ?? RESPONSE_FAILURE; + var response = await Helpers.Http.GetJson(Url("/api/health")); + + return response is null ? RESPONSE_FAILURE : response.Status; } public static void LoadLicense(string license) { CurrentUrl = $"{MaintenanceDomain}.{CurrentUrl}"; - + } }