diff --git a/Shoko.Server/API/WebUI/WebUIHelper.cs b/Shoko.Server/API/WebUI/WebUIHelper.cs
index 817bcccca..98933479f 100644
--- a/Shoko.Server/API/WebUI/WebUIHelper.cs
+++ b/Shoko.Server/API/WebUI/WebUIHelper.cs
@@ -29,23 +29,28 @@ public static partial class WebUIHelper
///
/// Web UI Version Info.
///
- public record WebUIVersionInfo {
+ public record WebUIVersionInfo
+ {
///
/// Package version.
///
- public string package = "1.0.0";
+ [JsonProperty("package")]
+ public string Package { get; set; } = "1.0.0";
///
/// Short-form git commit sha digest.
///
- public string git = "0000000";
+ [JsonProperty("git")]
+ public string Git { get; set; } = "0000000";
///
/// True if this is a debug package.
///
- public bool debug = false;
+ [JsonProperty("debug")]
+ public bool Debug { get; set; } = false;
///
/// Release date for web ui release.
///
- public DateTime? date = null;
+ [JsonProperty("date")]
+ public DateTime? Date { get; set; } = null;
}
///
@@ -158,12 +163,12 @@ private static void AddReleaseDate(DateTime releaseDate)
if (webUIFileInfo.Exists)
{
// Load the web ui version info from disk.
- var webuiVersion = Newtonsoft.Json.JsonConvert.DeserializeObject(System.IO.File.ReadAllText(webUIFileInfo.FullName));
+ var webuiVersion = JsonConvert.DeserializeObject(System.IO.File.ReadAllText(webUIFileInfo.FullName));
// Set the release data and save the info again if the date is not set.
- if (webuiVersion is not null && !webuiVersion.date.HasValue)
+ if (webuiVersion is not null && !webuiVersion.Date.HasValue)
{
- webuiVersion.date = releaseDate;
- System.IO.File.WriteAllText(webUIFileInfo.FullName, Newtonsoft.Json.JsonConvert.SerializeObject(webuiVersion));
+ webuiVersion.Date = releaseDate;
+ File.WriteAllText(webUIFileInfo.FullName, JsonConvert.SerializeObject(webuiVersion));
}
}
}
@@ -172,7 +177,7 @@ private static void AddReleaseDate(DateTime releaseDate)
{
var webUIFileInfo = new FileInfo(Path.Combine(Utils.ApplicationPath, "webui/version.json"));
if (webUIFileInfo.Exists)
- return Newtonsoft.Json.JsonConvert.DeserializeObject(System.IO.File.ReadAllText(webUIFileInfo.FullName));
+ return JsonConvert.DeserializeObject(File.ReadAllText(webUIFileInfo.FullName));
return null;
}
diff --git a/Shoko.Server/API/v3/Controllers/InitController.cs b/Shoko.Server/API/v3/Controllers/InitController.cs
index 2cf5ee2f3..de49d3f57 100644
--- a/Shoko.Server/API/v3/Controllers/InitController.cs
+++ b/Shoko.Server/API/v3/Controllers/InitController.cs
@@ -86,10 +86,10 @@ public ComponentVersionSet GetVersion()
{
versionSet.WebUI = new()
{
- Version = webuiVersion.package,
- ReleaseChannel = webuiVersion.debug ? ReleaseChannel.Debug : webuiVersion.package.Contains("-dev") ? ReleaseChannel.Dev : ReleaseChannel.Stable,
- Commit = webuiVersion.git,
- ReleaseDate = webuiVersion.date,
+ Version = webuiVersion.Package,
+ ReleaseChannel = webuiVersion.Debug ? ReleaseChannel.Debug : webuiVersion.Package.Contains("-dev") ? ReleaseChannel.Dev : ReleaseChannel.Stable,
+ Commit = webuiVersion.Git,
+ ReleaseDate = webuiVersion.Date,
};
}
diff --git a/Shoko.Server/API/v3/Controllers/WebUIController.cs b/Shoko.Server/API/v3/Controllers/WebUIController.cs
index ba846c6a4..82549a2d5 100644
--- a/Shoko.Server/API/v3/Controllers/WebUIController.cs
+++ b/Shoko.Server/API/v3/Controllers/WebUIController.cs
@@ -659,7 +659,7 @@ private static ReleaseChannel GetCurrentWebUIReleaseChannel()
{
var webuiVersion = WebUIHelper.LoadWebUIVersionInfo();
if (webuiVersion != null)
- return webuiVersion.debug ? ReleaseChannel.Debug : webuiVersion.package.Contains("-dev") ? ReleaseChannel.Dev : ReleaseChannel.Stable;
+ return webuiVersion.Debug ? ReleaseChannel.Debug : webuiVersion.Package.Contains("-dev") ? ReleaseChannel.Dev : ReleaseChannel.Stable;
return GetCurrentServerReleaseChannel();
}