fix(web): maintenance debounce

This commit is contained in:
rjindael 2023-07-31 05:31:31 -07:00
parent 8b61281f01
commit 23a362d40e
No known key found for this signature in database
GPG Key ID: D069369C906CCF31
1 changed files with 9 additions and 1 deletions

View File

@ -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<Models.HealthCheck>(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<Dictionary<string, string>>(license)!;
for (int i = 0; i < headers.Count; i++)
{