feat(app): download the update and verify it against SHA256SUMS
Download now fetches the desktop setup of the latest release into %TEMP%\Titano\updates\<tag>, keeps it only when its SHA-256 matches the release's SHA256SUMS line, and shows it in Explorer. BRIEF 8.6 does not list starting an installer among the allowed shell actions, so the user runs it. A release without a setup or SHA256SUMS still opens its page; capture runs never download. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
11 files changed
+436
-15
No files matched your search
@@ -38,6 +38,9 @@ public sealed class AppServices : IAsyncDisposable
|
||||
public static readonly TimeSpan ScanInterval = TimeSpan.FromMinutes(10);
|
||||
|
||||
private static readonly Lazy<HttpClient> Http = new(() => new HttpClient { Timeout = TimeSpan.FromSeconds(20) });
|
||||
|
||||
/// <summary>Setups are large: the download is bounded by the caller's cancellation, not a short timeout.</summary>
|
||||
private static readonly Lazy<HttpClient> DownloadHttp = new(() => new HttpClient { Timeout = TimeSpan.FromMinutes(30) });
|
||||
private readonly CancellationTokenSource _stopping = new();
|
||||
private readonly Dictionary<Guid, Guid> _scans = [];
|
||||
private Task _polling = Task.CompletedTask;
|
||||
@@ -55,6 +58,8 @@ public sealed class AppServices : IAsyncDisposable
|
||||
Server = new ServerSession(settings, saveSettings, new TitanoServerApiFactory(), new DpapiTokenProtector());
|
||||
Encoders = new MediaFoundationInventory();
|
||||
CheckForUpdateAsync = ct => UpdateCheck.FetchAsync(Http.Value, ProductLinks.LatestReleaseApi, VersionText, ct);
|
||||
DownloadUpdateAsync = (release, progress, ct) =>
|
||||
UpdateDownload.DownloadAsync(DownloadHttp.Value, release, UpdateDownload.Folder(Path.GetTempPath(), release), VersionText, progress, ct);
|
||||
}
|
||||
|
||||
public AppEnvironment Environment { get; }
|
||||
@@ -89,6 +94,9 @@ public sealed class AppServices : IAsyncDisposable
|
||||
/// <summary>Latest public release (GitHub Releases API of the releases repository, BRIEF §18).</summary>
|
||||
public Func<CancellationToken, Task<ReleaseInfo?>> CheckForUpdateAsync { get; set; }
|
||||
|
||||
/// <summary>Downloads and verifies the setup of a release (BRIEF §18 P1) and returns its path.</summary>
|
||||
public Func<ReleaseInfo, IProgress<double>?, CancellationToken, Task<string>> DownloadUpdateAsync { get; set; }
|
||||
|
||||
/// <summary>The index; null until <see cref="OpenAsync"/> succeeded.</summary>
|
||||
public TitanoDatabase? Database { get; private set; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user