Skip to content

Commit b6f7bfd

Browse files
committed
[ci skip] Delegate ReleaseUrl formatting to VersionResponse
1 parent a052385 commit b6f7bfd

5 files changed

Lines changed: 3 additions & 9 deletions

File tree

src/Common/Models/VersionCacheEntry.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Text.Json.Serialization;
2-
using Ryujinx.Systems.Update.Common;
32

43
namespace Ryujinx.Systems.Update.Common;
54

src/Common/Models/VersionResponse.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ public class VersionResponse
1111

1212
[JsonPropertyName("download_url")]
1313
public required string ArtifactUrl { get; set; }
14-
15-
[JsonPropertyName("web_url")]
16-
public required string ReleaseUrl { get; set; }
14+
15+
[JsonPropertyName("web_url")] public string ReleaseUrl => string.Format(ReleaseUrlFormat, Version);
1716

1817
[JsonPropertyName("web_url_format")]
1918
public required string ReleaseUrlFormat { get; set; }

src/Server/Controllers/Api/v1/VersionController.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public async Task<ActionResult<VersionResponse>> GetLatestStable(
3131
{
3232
Version = latest.Tag,
3333
ArtifactUrl = latest.GetUrlFor(supportedPlatform, supportedArch),
34-
ReleaseUrl = vcache.FormatReleaseUrl(latest.Tag),
3534
ReleaseUrlFormat = vcache.ReleaseUrlFormat
3635
});
3736
}
@@ -59,7 +58,6 @@ public async Task<ActionResult<VersionResponse>> GetLatestCanary(
5958
{
6059
Version = latest.Tag,
6160
ArtifactUrl = latest.GetUrlFor(supportedPlatform, supportedArch),
62-
ReleaseUrl = vcache.FormatReleaseUrl(latest.Tag),
6361
ReleaseUrlFormat = vcache.ReleaseUrlFormat
6462
});
6563
}

src/Server/Controllers/LatestController.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public async Task<ActionResult<VersionResponse>> GetLatestCustom(
4646
{
4747
Version = latest.Tag,
4848
ArtifactUrl = latest.GetUrlFor(supportedPlatform, supportedArch),
49-
ReleaseUrl = vcache.FormatReleaseUrl(latest.Tag),
5049
ReleaseUrlFormat = vcache.ReleaseUrlFormat
5150
});
5251
}

src/Server/Services/GitLab/VersionCache.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public VersionCache(IConfiguration config, GitLabService gitlabService, ILogger<
5252
}
5353

5454
public string ReleaseUrlFormat => $"{_gitlabEndpoint.TrimEnd('/')}/{_cachedProject!.Value.Path}/-/releases/{{0}}";
55-
public string FormatReleaseUrl(string tag) => ReleaseUrlFormat.Format(tag);
5655

5756
public void Init(ProjectId projectId) => Executor.ExecuteBackgroundAsync(async () =>
5857
{
@@ -132,7 +131,7 @@ public async Task RefreshAsync()
132131
this[release.TagName] = new VersionCacheEntry
133132
{
134133
Tag = release.TagName,
135-
ReleaseUrl = FormatReleaseUrl(release.TagName),
134+
ReleaseUrl = ReleaseUrlFormat.Format(release.TagName),
136135
Downloads =
137136
{
138137
Windows =

0 commit comments

Comments
 (0)