fix(app): resumable, cancellable update download; portable copies get the portable zip
- UpdateFlow owns the update notice (check, download, cancel) as a plain class; AboutViewModel only maps it to text and commands. - A portable copy downloads and verifies Titano-win-x64-portable-<v>.zip instead of the setup; a release without the package or SHA256SUMS opens its page. - The download fails after 60 s without data instead of after 30 minutes, keeps its .part file and resumes it with a range request; Cancel stops it. - Older release folders under %TEMP%\Titano\updates are removed after a verified download; an unexpected exception never leaves "Downloading". - Tooltips show the package size; stale machine translations of the three rewritten tooltips are removed so they fall back to English. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
36 files changed
+828
-298
No files matched your search
@@ -39,8 +39,8 @@ public sealed class AppServices : IAsyncDisposable
|
||||
|
||||
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) });
|
||||
/// <summary>Update packages are large: their download fails when it stalls (<see cref="UpdateDownload.IdleTimeout"/>), never after a fixed total time.</summary>
|
||||
private static readonly Lazy<HttpClient> DownloadHttp = new(() => new HttpClient { Timeout = Timeout.InfiniteTimeSpan });
|
||||
private readonly CancellationTokenSource _stopping = new();
|
||||
private readonly Dictionary<Guid, Guid> _scans = [];
|
||||
private Task _polling = Task.CompletedTask;
|
||||
@@ -59,7 +59,8 @@ public sealed class AppServices : IAsyncDisposable
|
||||
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);
|
||||
UpdateDownload.DownloadAsync(DownloadHttp.Value, release, environment.IsPortable, UpdateDownload.Root(Path.GetTempPath()), VersionText, progress,
|
||||
UpdateDownload.IdleTimeout, ct);
|
||||
}
|
||||
|
||||
public AppEnvironment Environment { get; }
|
||||
@@ -94,7 +95,7 @@ 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>
|
||||
/// <summary>Downloads and verifies the package of a release for this copy (setup, or portable zip; 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>
|
||||
|
||||
Reference in new issue
Block a user