Skip to content

Commit

Permalink
fix: don't transform web ui version
Browse files Browse the repository at this point in the history
  • Loading branch information
revam committed Oct 20, 2024
1 parent 7b4273f commit d72f0b1
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions Shoko.Server/API/v3/Controllers/WebUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,6 @@ public ActionResult UpdateWebUI([FromQuery] ReleaseChannel channel = ReleaseChan
public ActionResult UpdateWebUIOld([FromQuery] ReleaseChannel channel = ReleaseChannel.Auto)
=> UpdateWebUI(channel);

[GeneratedRegex(@"^[Vv]?(?<version>(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+))(?:-dev.(?<buildNumber>\d+))?$", RegexOptions.Compiled, "en-US")]
private static partial Regex ReleaseVersionRegex();

/// <summary>
/// Check for latest version for the selected <paramref name="channel"/> and
/// return a <see cref="ComponentVersion"/> containing the version
Expand All @@ -486,19 +483,11 @@ public ActionResult<ComponentVersion> LatestWebUIVersion([FromQuery] ReleaseChan
// Check for dev channel updates.
case ReleaseChannel.Dev:
{
var regex = ReleaseVersionRegex();
var releases = WebUIHelper.DownloadApiResponse("releases?per_page=10&page=1");
foreach (var release in releases)
{
string tagName = release.tag_name;
if (regex.Match(tagName) is not { Success: true } regexResult)
continue;

var version = regexResult.Groups["version"].Value;
if (regexResult.Groups["buildNumber"].Success)
version += "." + regexResult.Groups["buildNumber"].Value;
else
version += ".0";
var version = tagName[0] == 'v' ? tagName[1..] : tagName;
foreach (var asset in release.assets)
{
// We don't care what the zip is named, only that it is attached.
Expand Down Expand Up @@ -558,6 +547,9 @@ public ActionResult<ComponentVersion> LatestWebUIVersion([FromQuery] ReleaseChan
}
}

[GeneratedRegex(@"^[Vv]?(?<version>(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+))(?:-dev.(?<buildNumber>\d+))?$", RegexOptions.Compiled, "en-US")]
private static partial Regex ServerReleaseVersionRegex();

/// <summary>
/// Check for latest version for the selected <paramref name="channel"/> and
/// return a <see cref="ComponentVersion"/> containing the version
Expand Down Expand Up @@ -587,7 +579,7 @@ public ActionResult<ComponentVersion> LatestServerWebUIVersion([FromQuery] Relea
var version = string.Empty;
var tagName = string.Empty;
var commitSha = string.Empty;
var regex = ReleaseVersionRegex();
var regex = ServerReleaseVersionRegex();
foreach (var tagInfo in latestTags)
{
string localTagName = tagInfo.name;
Expand Down

0 comments on commit d72f0b1

Please sign in to comment.