From 23a362d40e3af1e1103d27cc3b110e5ff0812a41 Mon Sep 17 00:00:00 2001 From: rjindael Date: Mon, 31 Jul 2023 05:31:31 -0700 Subject: [PATCH] fix(web): maintenance debounce --- Kiseki.Launcher/Web.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Kiseki.Launcher/Web.cs b/Kiseki.Launcher/Web.cs index f9640d7..098a893 100644 --- a/Kiseki.Launcher/Web.cs +++ b/Kiseki.Launcher/Web.cs @@ -19,6 +19,8 @@ namespace Kiseki.Launcher public static void Initialize() => CurrentUrl = BaseUrl; public static string Url(string path) => $"https://{CurrentUrl}{path}"; + private static bool MaintenanceMode = false; + public static int CheckHealth() { var response = Helpers.Http.GetJson(Url("/api/health")); @@ -28,7 +30,11 @@ namespace Kiseki.Launcher public static bool LoadLicense(string license) { - CurrentUrl = $"{MaintenanceDomain}.{CurrentUrl}"; + if (!MaintenanceMode) + { + CurrentUrl = $"{MaintenanceDomain}.{CurrentUrl}"; + MaintenanceMode = true; + } // the "license" is actually just headers required to access the website. // this can be cloudflare zero-trust headers (like what Kiseki does), or however @@ -36,6 +42,8 @@ namespace Kiseki.Launcher try { + HttpClient.DefaultRequestHeaders.Clear(); + var headers = JsonSerializer.Deserialize>(license)!; for (int i = 0; i < headers.Count; i++) {