feat(app): library, jobs, settings, server, welcome and about screens

Local-mode composition root (SQLite index, one JobEngine fed by a single
handler registration list), keyset-paged library with thumbnail cache and
hover scrub, live job list with throttled updates and the shell job bar,
settings with live template validation and encoder self-test, server
connection with trust-on-first-use and DPAPI token, first-run welcome,
About with update check, and --capture screenshots with synthetic data.

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 12:26:58 +00:00
1 parent 446daeae2b
commit ffbea7cb74
94 files changed
+10130 -374

No files matched your search

@@ -0,0 +1,104 @@
using System.IO;
using Titano.Core.Diagnostics;
namespace Titano.App.Infrastructure;
/// <summary>
/// First-run archive choices (BRIEF §12.1): create a local archive or adopt an existing folder tree. The
/// integrator replaces <see cref="LocalArchiveSetup"/> with an implementation backed by the archive engine (folder
/// layout, index, adopt job); see <see cref="AppServices"/>.
/// </summary>
public interface IArchiveSetup
{
/// <summary>Creates (or opens) the local archive rooted at <paramref name="root"/>.</summary>
Task CreateAsync(string root, CancellationToken cancellationToken = default);
/// <summary>Indexes the photos under <paramref name="folder"/> in place, or opens a previous Titano archive there.</summary>
Task AdoptAsync(string folder, CancellationToken cancellationToken = default);
}
/// <summary>Until the archive engine is connected: remembers the chosen root in the settings and nothing else.</summary>
public sealed class LocalArchiveSetup(AppSettings settings, Action save) : IArchiveSetup
{
public Task CreateAsync(string root, CancellationToken cancellationToken = default)
{
Remember(root);
Log.Info("archive", $"Local archive root set to {root}");
return Task.CompletedTask;
}
public Task AdoptAsync(string folder, CancellationToken cancellationToken = default)
{
Remember(folder);
Log.Info("archive", $"Adopted folder recorded: {folder}");
return Task.CompletedTask;
}
private void Remember(string path)
{
settings.LastArchivePath = Path.GetFullPath(path);
save();
}
}
/// <summary>Archive roots offered by default and their free space.</summary>
public static class ArchiveLocations
{
public const string DefaultFolderName = "TitanoArchive";
/// <summary>"&lt;fixed drive with the most free space&gt;\TitanoArchive".</summary>
public static string SuggestRoot()
{
try
{
var best = DriveInfo.GetDrives()
.Where(d => d.DriveType == DriveType.Fixed && d.IsReady)
.OrderByDescending(d => d.AvailableFreeSpace)
.FirstOrDefault();
if (best is not null) return Path.Combine(best.RootDirectory.FullName, DefaultFolderName);
}
catch (IOException)
{
}
catch (UnauthorizedAccessException)
{
}
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), DefaultFolderName);
}
/// <summary>Free bytes on the volume of <paramref name="path"/>; null when unknown.</summary>
public static long? FreeSpace(string? path)
{
if (string.IsNullOrWhiteSpace(path)) return null;
try
{
var root = Path.GetPathRoot(Path.GetFullPath(path));
if (string.IsNullOrEmpty(root)) return null;
var drive = new DriveInfo(root);
return drive.IsReady ? drive.AvailableFreeSpace : null;
}
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or ArgumentException or NotSupportedException)
{
return null;
}
}
/// <summary>The problem of an archive root as a localized sentence; null when it can be used.</summary>
public static string? Validate(string? path)
{
if (string.IsNullOrWhiteSpace(path)) return Core.Localization.Loc.L("Errors.Path.Empty");
try
{
if (!Path.IsPathFullyQualified(path)) return Core.Localization.Loc.L("Errors.Path.NotAbsolute");
var full = Path.GetFullPath(path);
if (File.Exists(full)) return Core.Localization.Loc.L("Errors.Path.IsFile");
var root = Path.GetPathRoot(full);
if (string.IsNullOrEmpty(root) || !Directory.Exists(root)) return Core.Localization.Loc.L("Errors.Path.NoDrive");
return null;
}
catch (Exception ex) when (ex is ArgumentException or NotSupportedException or PathTooLongException)
{
return Core.Localization.Loc.L("Errors.Path.Invalid");
}
}
}