feat: owner review 2 phase 5b: the server as a project home (#17)
CI / Build and test (push) Successful in 9m58s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 14m8s
CI / PostgreSQL 16 integration (push) Successful in 8m55s
CI / PostgreSQL 17 integration (push) Successful in 8m50s
CI / Docker image (push) Successful in 57s
Release / Server image (push) Successful in 1m22s
CI / Build and test (push) Successful in 9m58s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 14m8s
CI / PostgreSQL 16 integration (push) Successful in 8m55s
CI / PostgreSQL 17 integration (push) Successful in 8m50s
CI / Docker image (push) Successful in 57s
Release / Server image (push) Successful in 1m22s
A Chronos Server keeps its sequences' projects, as a PC's archive does: Main and named projects with versions under /api/v1/sequences/{id}/projects, the projects capability and the projectChanged event. The desktop opens a server's sequences in the workspace (proxies downloaded, hash-checked, resumable) with Save version, Sync, conflicts, History, Restore and the project actions against the server. Renders can be of a project version. The admin panel lists a sequence's projects and versions. Strings in all 38 languages.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #17.
This commit is contained in:
1 parent
255e149087
commit
81c303f484
325 files changed
+11477
-516
No files matched your search
@@ -57,9 +57,68 @@ public sealed class AppEnvironment
|
||||
return new(paths.DataRoot, paths.IsPortable, isCapture: false, paths.SyncedFolder, paths.PortableSyncRoot, paths.EarlierPortableData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The data folder a capture shows in place of its temporary one (<see cref="Shown"/>): the default data folder of a
|
||||
/// sample user, so the screenshots show no path of the machine (its temporary folder, its user name).
|
||||
/// </summary>
|
||||
public const string SampleDataDirectory = @"C:\Users\Studio\AppData\Local\Chronos";
|
||||
|
||||
/// <summary>The folder a capture shows for its sample archive (<c>archive</c> in its data folder), as the sample settings name it.</summary>
|
||||
public const string SampleArchiveDirectory = @"D:\ChronosArchive";
|
||||
|
||||
/// <summary>The temporary data folder of the capture this process runs (the last one made); null outside a capture.</summary>
|
||||
private static string? _captureData;
|
||||
|
||||
/// <summary>A fresh temporary data folder for screenshots and smoke tests; delete it with <see cref="DeleteCaptureData"/>.</summary>
|
||||
public static AppEnvironment ForCapture() =>
|
||||
new(Path.Combine(Path.GetTempPath(), "chronos-capture-" + Guid.CreateVersion7().ToString("N")), portable: false, isCapture: true);
|
||||
public static AppEnvironment ForCapture()
|
||||
{
|
||||
var environment = new AppEnvironment(Path.Combine(Path.GetTempPath(), "chronos-capture-" + Guid.CreateVersion7().ToString("N")), portable: false, isCapture: true);
|
||||
_captureData = environment.DataDirectory;
|
||||
return environment;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A path as the screens show it: one under a capture's temporary data folder as under <see cref="SampleDataDirectory"/>
|
||||
/// (its sample archive as <see cref="SampleArchiveDirectory"/>), so the screenshots show nothing of the machine; any
|
||||
/// other as it is. Only for text on screen: a path typed there goes through <see cref="Actual"/>.
|
||||
/// </summary>
|
||||
public static string Shown(string path) => Shown(path, _captureData);
|
||||
|
||||
/// <summary>A path typed or shown on screen as the one it stands for: <see cref="Shown(string)"/> undone, so a capture never writes outside its temporary folder.</summary>
|
||||
public static string Actual(string shown) => Actual(shown, _captureData);
|
||||
|
||||
/// <summary><see cref="Shown(string)"/> for the capture whose data folder is <paramref name="captureData"/> (none: the path as it is).</summary>
|
||||
internal static string Shown(string path, string? captureData)
|
||||
{
|
||||
foreach (var (actual, shown) in CaptureFolders(captureData))
|
||||
{
|
||||
if (Swap(path, actual, shown) is { } swapped) return swapped;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
/// <summary><see cref="Actual(string)"/> for the capture whose data folder is <paramref name="captureData"/>.</summary>
|
||||
internal static string Actual(string shown, string? captureData)
|
||||
{
|
||||
foreach (var (actual, sample) in CaptureFolders(captureData))
|
||||
{
|
||||
if (Swap(shown, sample, actual) is { } swapped) return swapped;
|
||||
}
|
||||
return shown;
|
||||
}
|
||||
|
||||
/// <summary>A capture's folders and what the screens show for each, the more specific first.</summary>
|
||||
private static (string Actual, string Shown)[] CaptureFolders(string? captureData) =>
|
||||
captureData is null ? [] : [(Path.Combine(captureData, "archive"), SampleArchiveDirectory), (captureData, SampleDataDirectory)];
|
||||
|
||||
/// <summary><paramref name="path"/> with its root <paramref name="from"/> replaced by <paramref name="to"/>; null when it is not under it.</summary>
|
||||
private static string? Swap(string path, string from, string to)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) return null;
|
||||
var root = from.TrimEnd(Path.DirectorySeparatorChar);
|
||||
if (path.TrimEnd(Path.DirectorySeparatorChar).Equals(root, StringComparison.OrdinalIgnoreCase)) return to;
|
||||
return path.StartsWith(root + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) ? to + path[root.Length..] : null;
|
||||
}
|
||||
|
||||
/// <summary>Removes the temporary data folder of a capture environment (never a real one).</summary>
|
||||
public void DeleteCaptureData()
|
||||
|
||||
@@ -74,6 +74,9 @@ public sealed class AppServices : IAsyncDisposable
|
||||
Sync = new SyncHost(this);
|
||||
ScheduleHost = new DesktopScheduleHost(settings, () => Database, () => Archives);
|
||||
Workspace = new WorkspaceHost(environment, settings, saveSettings, () => Database, () => Archives, () => Engine);
|
||||
// A server that keeps projects is the home of the workspace projects of its sequences (owner review 2, R8, phase 5b).
|
||||
Workspace.ServerHomes = Sync.ProjectHome;
|
||||
Sync.ProjectChanged += Workspace.OnServerProjectChanged;
|
||||
Server = new ServerSession(settings, saveSettings, new ChronosServerApiFactory(), new DpapiTokenProtector());
|
||||
Encoders = new MediaFoundationInventory();
|
||||
Formats = new WicFormatInventory(() => _wic);
|
||||
@@ -120,7 +123,7 @@ public sealed class AppServices : IAsyncDisposable
|
||||
/// </summary>
|
||||
public event Action<Guid>? SequenceReorganized;
|
||||
|
||||
/// <summary>The workspace where Edit opens projects (owner review 2, R8), with this PC's archive as their home.</summary>
|
||||
/// <summary>The workspace where Edit opens projects (owner review 2, R8), with this PC's archive or the signed-in server as their home.</summary>
|
||||
public WorkspaceHost Workspace { get; }
|
||||
|
||||
public IEncoderInventory Encoders { get; set; }
|
||||
@@ -175,12 +178,13 @@ public sealed class AppServices : IAsyncDisposable
|
||||
typeof(AppServices).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "0.0.0";
|
||||
|
||||
/// <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). The workspace copy is the desktop's alone: it writes into this PC's workspace.</summary>
|
||||
/// queued (it is never claimed here). The workspace copy is the desktop's alone: it writes into this PC's workspace, from
|
||||
/// this PC's archive or, through the signed-in session, from a server.</summary>
|
||||
public static IReadOnlyList<IJobHandler> CreateJobHandlers(AppServices services) =>
|
||||
[
|
||||
.. services.Archives?.CreateJobHandlers() ?? [], .. services.Processing?.CreateJobHandlers() ?? [],
|
||||
.. services.Sync.Service?.CreateJobHandlers(services.Sync) ?? [],
|
||||
.. services.Database is { } db && services.Archives is { } archives ? WorkspaceJobs.CreateHandlers(db, archives) : [],
|
||||
.. services.Database is { } db && services.Archives is { } archives ? WorkspaceJobs.CreateHandlers(db, archives, services.Sync) : [],
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user