feat: wire separate homes into the desktop (owner review 5 P3.2)

The desktop now uses the per-home layout from P3.1: each home keeps its
own projects, proxies and originals, and a server is known by its id
whichever address reaches it.

- Settings keep the known servers (id, name, last address, certificate,
  aliases, originals archive). Reset and Import keep them; Export leaves
  them out.
- SyncHost records each server the first time it signs in with an id. It
  names the cache and workspace folders by that id, and re-keys the
  folders a server had under its addresses at sign-in. The re-key waits
  while transfer or workspace jobs are pending.
- Download originals goes to the server's own archive. It is created
  beside this PC's archive at the first download, and a toast says
  where. A sequence that already has a local copy keeps receiving into
  that copy's archive. A server without an id keeps the 1.0 behaviour.
- At start, after the index opens and before any job runs, the folders
  are sorted into their homes. A toast reports the result: sorted,
  pending or failed.
- The workspace host gives each home's store its own sync. Find, List,
  usage, clean-up and the trash plan and empty cover every home. Server
  comparisons go through the identity, so a project stays Online when
  its server is reached by another address.
- The render-node downloads and the server import staging move into the
  server's folder of the cache. The cache trim keeps `servers`, and the
  scheduled scan also scans the originals archives.
- Settings shows the Home folders rows (Workspace) and the Known servers
  table (Server). The diagnostics bundle lists the homes.
- The dead `AppPaths.CreateDirectories` and `ThumbnailsDirectory` are
  removed.

Refs #66

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-15 14:00:46 +01:00
1 parent 4d697a4255
commit 9ad8c6f7a9
44 files changed
+1106 -220

No files matched your search

+8 -3
View File
@@ -84,7 +84,11 @@ public sealed class DesktopScheduleHost(AppSettings settings, Func<ChronosDataba
public async ValueTask<Archive?> GetArchiveAsync(CancellationToken cancellationToken)
{
if (database() is not { } db || archives() is not { } service) return null;
var archive = CurrentArchive.Pick(await db.Archives.ListAsync(cancellationToken).ConfigureAwait(false), settings.LastArchivePath);
var listed = await db.Archives.ListAsync(cancellationToken).ConfigureAwait(false);
// Never a server's originals archive in place of this PC's (owner review 5): the app scans those after this one.
var originals = settings.KnownServers.Select(k => k.OriginalsArchiveId).OfType<Guid>().ToHashSet();
var archive = (settings.LastArchivePath is { Length: > 0 } last ? CurrentArchive.At(listed, last) : null)
?? CurrentArchive.Pick([.. listed.Where(a => !originals.Contains(a.Id))], null) ?? CurrentArchive.Pick(listed, null);
if (archive is null || ArchiveService.GetAvailability(archive) == ArchiveAvailability.Offline) return null;
try
{
@@ -110,14 +114,15 @@ public sealed class DesktopScheduleHost(AppSettings settings, Func<ChronosDataba
/// The desktop's clean-up step <c>cache-trim</c> (owner review 2, R10): brings the cache folder down to Settings › Storage ›
/// Cache limit, oldest files first, skipping files in use (<see cref="CacheStore.Trim"/>). The proxies of server sequences
/// (complete sets the sync keeps), the render node's folder (it trims its own downloads to the same limit) and the copies an
/// import to the server stages are never trimmed; Settings › Storage › Clear still empties everything.
/// import to the server stages are never trimmed, in the former shared folders and in each server's own (<c>servers</c>,
/// owner review 5); Settings › Storage › Clear still empties everything.
/// </summary>
public sealed class CacheTrimStep(Func<string> folder, Func<long> limitBytes) : ICleanupStep
{
public const string StepName = "cache-trim";
/// <summary>Folders of the cache the trim leaves whole.</summary>
public static IReadOnlyList<string> Kept { get; } = ["proxies", "render-node", "server-import"];
public static IReadOnlyList<string> Kept { get; } = ["proxies", "render-node", "server-import", Chronos.Core.IO.HomeFolders.Servers];
public string Name => StepName;