fix: rename Health->HealthCheck & url format fix
This commit is contained in:
parent
d4c88052d9
commit
c1d58fbf7a
|
|
@ -1,7 +0,0 @@
|
||||||
namespace Kiseki.Launcher.Models
|
|
||||||
{
|
|
||||||
public class Health
|
|
||||||
{
|
|
||||||
public int Response { get; set; } = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace Kiseki.Launcher.Models
|
||||||
|
{
|
||||||
|
public class HealthCheck
|
||||||
|
{
|
||||||
|
[JsonPropertyName("status")]
|
||||||
|
public int Status { get; set; } = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,19 +14,19 @@ namespace Kiseki.Launcher
|
||||||
public static string CurrentUrl { get; private set; } = "";
|
public static string CurrentUrl { get; private set; } = "";
|
||||||
|
|
||||||
public static void Initialize() => CurrentUrl = BaseUrl;
|
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<int> CheckHealth()
|
public static async Task<int> CheckHealth()
|
||||||
{
|
{
|
||||||
var response = await Helpers.Http.GetJson<Models.Health>(Url("/api/health"));
|
var response = await Helpers.Http.GetJson<Models.HealthCheck>(Url("/api/health"));
|
||||||
|
|
||||||
return response?.Response ?? RESPONSE_FAILURE;
|
return response is null ? RESPONSE_FAILURE : response.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoadLicense(string license)
|
public static void LoadLicense(string license)
|
||||||
{
|
{
|
||||||
CurrentUrl = $"{MaintenanceDomain}.{CurrentUrl}";
|
CurrentUrl = $"{MaintenanceDomain}.{CurrentUrl}";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue