feat(app): server sync table, conflict resolution, sync options and Library sync glyphs

SyncHost runs the sync agent of the signed-in session and gives transfer jobs
their connection; the Server screen lists every sequence of this PC and of the
server with its state and actions (upload, download originals, open with
proxies, keep mine / take server / save both, pause, resume), filter chips,
search, Upload all local and the comparison footer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-02 22:53:24 +00:00
1 parent c02d1867d0
commit 25653c052b
16 files changed
+1072 -10

No files matched your search

+18 -3
View File
@@ -29,7 +29,7 @@ namespace Titano.App.Infrastructure;
/// archive engine (WIC first, then managed decoders), the analysis and render engine (the same decoders; Media
/// Foundation, then managed encoders), the one <see cref="JobEngine"/> of this PC with the handlers of
/// <see cref="CreateJobHandlers"/>, thumbnails, the server session, the render node, the encoder inventory and the
/// update check. Started after the window shows, stopped when the app exits. The last archive is reopened at start and
/// update check, and the sync with the signed-in server (<see cref="SyncHost"/>). Started after the window shows, stopped when the app exits. The last archive is reopened at start and
/// rescanned every <see cref="ScanInterval"/> (BRIEF §7: polling, no file-system watchers). The render node runs while
/// the user offers this PC (<see cref="AppSettings.RenderNodeOptIn"/>) and a server session is open.
/// </summary>
@@ -52,6 +52,7 @@ public sealed class AppServices : IAsyncDisposable
SaveSettingsAction = saveSettings;
Dialogs = dialogs;
ArchiveSetup = new EngineArchiveSetup(this);
Sync = new SyncHost(this);
Server = new ServerSession(settings, saveSettings, new TitanoServerApiFactory(), new DpapiTokenProtector());
Encoders = new MediaFoundationInventory();
CheckForUpdateAsync = ct => UpdateCheck.FetchAsync(Http.Value, ProductLinks.LatestReleaseApi, VersionText, ct);
@@ -81,9 +82,13 @@ public sealed class AppServices : IAsyncDisposable
_server = value;
_server.PropertyChanged += OnServerChanged;
UpdateRenderNode();
Sync.Update();
}
}
/// <summary>Sync with the signed-in server: engine, job connection, background comparison.</summary>
public SyncHost Sync { get; }
public IEncoderInventory Encoders { get; set; }
/// <summary>Latest public release (GitHub Releases API of the releases repository, BRIEF §18).</summary>
@@ -111,7 +116,10 @@ public sealed class AppServices : IAsyncDisposable
/// <summary>The job handlers of this PC's engine — the single registration list; a kind without a handler stays
/// queued (it is never claimed here).</summary>
public static IReadOnlyList<IJobHandler> CreateJobHandlers(AppServices services) =>
[.. services.Archives?.CreateJobHandlers() ?? [], .. services.Processing?.CreateJobHandlers() ?? []];
[
.. services.Archives?.CreateJobHandlers() ?? [], .. services.Processing?.CreateJobHandlers() ?? [],
.. services.Sync.Service?.CreateJobHandlers(services.Sync) ?? [],
];
/// <summary>Queues a scan of <paramref name="archive"/> unless one is already waiting or running.</summary>
public async Task QueueScanAsync(Archive archive, bool full, CancellationToken ct = default)
@@ -174,6 +182,7 @@ public sealed class AppServices : IAsyncDisposable
_server.PropertyChanged -= OnServerChanged;
await _nodeSwitch;
await StopRenderNodeAsync();
await Sync.DisposeAsync();
(Jobs as IDisposable)?.Dispose();
if (Engine is not null) await Engine.DisposeAsync();
Thumbnails?.Dispose();
@@ -209,6 +218,7 @@ public sealed class AppServices : IAsyncDisposable
var archive = new ArchiveServiceOptions { Decoder = DecoderFactory.CreateClient(new WicDecoderProvider()) };
Archives = new ArchiveService(database, archive);
Processing = new ProcessingService(database, ProcessingOptions(archive));
Sync.Open(database, Archives, archive);
var handlers = CreateJobHandlers(this);
var kinds = handlers.Select(h => h.Kind).Distinct().ToArray();
Engine = new JobEngine(database, handlers, new JobEngineOptions { WorkerId = WorkerId, Kinds = kinds });
@@ -218,6 +228,7 @@ public sealed class AppServices : IAsyncDisposable
Jobs = new EngineJobQueue(database, Engine, started);
Log.Info("jobs", started ? $"Job engine started with {Engine.Options.Workers} worker(s) for {string.Join(", ", kinds)}" : "No job handlers registered; jobs stay queued");
UpdateRenderNode();
Sync.Update();
}
/// <summary>Media Foundation (hardware first, software H.264) then managed encoders; frames spill into the cache folder
@@ -235,7 +246,11 @@ public sealed class AppServices : IAsyncDisposable
},
};
private void OnServerChanged(object? sender, PropertyChangedEventArgs e) => UpdateRenderNode();
private void OnServerChanged(object? sender, PropertyChangedEventArgs e)
{
UpdateRenderNode();
Sync.Update();
}
/// <summary>Waits for the previous switch, then runs the node for the current session, or stops it.</summary>
private async Task SwitchRenderNodeAsync(Task previous)