fix(app): build update links from the releases repository address
CI / Build and test (pull_request) Failing after 2m28s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / Docker image (pull_request) Skipped
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 10s
CI / Build and test (pull_request) Failing after 2m28s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / Docker image (pull_request) Skipped
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 10s
Gitea writes a release's html_url and browser_download_url with its ROOT_URL, which on the owner's server is the plain-http LAN address http://192.168.30.23:3000. The update check accepts only https links, so it ignored v0.1.0-rc.1 entirely. The page and download links now come from ChronosReleasesUrl, the address the build names for its users; only the tags, file names and sizes are read from Gitea's answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f2b58522b9
commit
ee2d32f70f
6 files changed
+67
-16
No files matched your search
@@ -82,6 +82,31 @@ public sealed class UpdateCheckTests
|
||||
await Assert.ThrowsAsync<HttpRequestException>(() => UpdateCheck.FetchAsync(broken, Api, "0.1.0", CancellationToken.None));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task LinksComeFromTheRepositoryAddressNotFromGiteasRootUrl()
|
||||
{
|
||||
// The owner's Gitea writes its links with its ROOT_URL, a plain-http LAN address clients cannot use.
|
||||
const string json = """
|
||||
[ { "tag_name": "v1.0.0", "html_url": "http://192.168.30.23:3000/BalboSoft/Chronos/releases/tag/v1.0.0",
|
||||
"assets": [ { "name": "Chronos-Setup-1.0.0.exe", "size": 5, "browser_download_url": "http://192.168.30.23:3000/BalboSoft/Chronos/releases/download/v1.0.0/Chronos-Setup-1.0.0.exe" },
|
||||
{ "name": "Read me.txt", "size": 2, "browser_download_url": "http://192.168.30.23:3000/x" } ] } ]
|
||||
""";
|
||||
Assert.Null(UpdateCheck.Parse(json));
|
||||
|
||||
var release = UpdateCheck.Parse(json, "https://gitea.example/BalboSoft/Chronos/")!;
|
||||
Assert.Equal("https://gitea.example/BalboSoft/Chronos/releases/tag/v1.0.0", release.PageUrl);
|
||||
Assert.SequenceEqual(
|
||||
["https://gitea.example/BalboSoft/Chronos/releases/download/v1.0.0/Chronos-Setup-1.0.0.exe",
|
||||
"https://gitea.example/BalboSoft/Chronos/releases/download/v1.0.0/Read%20me.txt"],
|
||||
release.Assets.Select(a => a.DownloadUrl));
|
||||
Assert.Equal(5L, release.Assets[0].Size);
|
||||
Assert.Null(UpdateCheck.Parse(json, "http://gitea.example/BalboSoft/Chronos"));
|
||||
|
||||
using var ok = new HttpClient(new Reply(HttpStatusCode.OK, json));
|
||||
var fetched = await UpdateCheck.FetchAsync(ok, Api, "https://gitea.example/BalboSoft/Chronos", "0.1.0", CancellationToken.None);
|
||||
Assert.Equal("https://gitea.example/BalboSoft/Chronos/releases/tag/v1.0.0", fetched!.PageUrl);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ARepositoryThatCannotBeSeenIsAFailedCheckNotUpToDate()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user