refactor!: rename Titano to Chronos and move CI and releases to Gitea (#6)
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout and the system SQLite. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow; the throw-away server runs without durability) and pe-check. - Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR, 3 on the shared runner; the weekly performance gates keep theirs). BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. 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 #6.
This commit is contained in:
1 parent
c99842cc86
commit
f2b58522b9
1801 files changed
+11804
-10676
No files matched your search
@@ -0,0 +1,304 @@
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
using Chronos.App.Infrastructure;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Data.Sync;
|
||||
using Chronos.Ui.Controls;
|
||||
|
||||
namespace Chronos.App.Server;
|
||||
|
||||
/// <summary>Filter chips of the sync table (Server.html).</summary>
|
||||
public enum SyncFilter
|
||||
{
|
||||
All,
|
||||
LocalOnly,
|
||||
Remote,
|
||||
Conflicts,
|
||||
}
|
||||
|
||||
/// <summary>What a row of the sync table offers.</summary>
|
||||
public enum SyncAction
|
||||
{
|
||||
Upload,
|
||||
OpenWithProxies,
|
||||
DownloadOriginals,
|
||||
SyncSettings,
|
||||
KeepMine,
|
||||
TakeServer,
|
||||
SaveBoth,
|
||||
GetExports,
|
||||
SendExports,
|
||||
Pause,
|
||||
Resume,
|
||||
}
|
||||
|
||||
/// <summary>What the signed-in account may do (server permission bits).</summary>
|
||||
/// <param name="CanUpload">Send originals, settings and renders (upload and edit rights).</param>
|
||||
/// <param name="CanFetchOriginals">Download originals (editors and render nodes).</param>
|
||||
/// <param name="CanEdit">Change the server's copy of a sequence's settings, title, tags, rating and notes.</param>
|
||||
public readonly record struct SyncRights(bool CanUpload, bool CanFetchOriginals, bool CanEdit)
|
||||
{
|
||||
public static SyncRights Of(long permissions) => new(
|
||||
(permissions & (long)Permissions.Upload) != 0 && (permissions & (long)Permissions.Edit) != 0,
|
||||
(permissions & (long)(Permissions.Edit | Permissions.RenderNode)) != 0,
|
||||
(permissions & (long)Permissions.Edit) != 0);
|
||||
}
|
||||
|
||||
/// <summary>The words, glyphs and actions of the sync table (BRIEF §12.7): plain functions of a <see cref="SyncEntry"/>.</summary>
|
||||
public static class SyncText
|
||||
{
|
||||
/// <summary>Resource keys of the settings and sequence fields a conflict can show, by JSON path (sections, then members).</summary>
|
||||
private static readonly Dictionary<string, string> SettingKeys = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["sequence.title"] = "Server.Setting.Title",
|
||||
["sequence.tags"] = "Server.Setting.Tags",
|
||||
["sequence.rating"] = "Server.Setting.Rating",
|
||||
["sequence.notes"] = "Server.Setting.Notes",
|
||||
["timing.mode"] = "Server.Setting.TimingMode",
|
||||
["timing.frameRate"] = "Server.Setting.FrameRate",
|
||||
["timing.fitToSeconds"] = "Server.Setting.FitToDuration",
|
||||
["timing.remapCurve"] = "Server.Setting.TimeRemap",
|
||||
["exposure.deflicker"] = "Server.Setting.Deflicker",
|
||||
["exposure.deflickerWindow"] = "Server.Setting.DeflickerWindow",
|
||||
["exposure.deflickerStrength"] = "Server.Setting.DeflickerStrength",
|
||||
["exposure.regions"] = "Server.Setting.Regions",
|
||||
["exposure.holyGrail"] = "Server.Setting.HolyGrail",
|
||||
["exposure.transitionLength"] = "Server.Setting.Transitions",
|
||||
["exposure.whiteBalanceSmoothing"] = "Server.Setting.WhiteBalance",
|
||||
["exposure.exposureOffsetEv"] = "Server.Setting.ExposureOffset",
|
||||
["exposure.highlightKnee"] = "Server.Setting.HighlightKnee",
|
||||
["motion.motionBlur"] = "Server.Setting.MotionBlur",
|
||||
["motion.targetShutterAngle"] = "Server.Setting.ShutterAngle",
|
||||
["motion.flowQuality"] = "Server.Setting.FlowQuality",
|
||||
["motion.stabilize"] = "Server.Setting.Stabilize",
|
||||
["motion.stabilizeSmoothing"] = "Server.Setting.StabilizeSmoothing",
|
||||
["camera.crop"] = "Server.Setting.Crop",
|
||||
["camera.aspect"] = "Server.Setting.Aspect",
|
||||
["camera.offsetX"] = "Server.Setting.CameraOffset",
|
||||
["camera.offsetY"] = "Server.Setting.CameraOffset",
|
||||
["camera.keyframes"] = "Server.Setting.Keyframes",
|
||||
["stack.mode"] = "Server.Setting.Stacking",
|
||||
["stack.length"] = "Server.Setting.TrailLength",
|
||||
["export.preset"] = "Server.Setting.ExportPreset",
|
||||
["export.overrides"] = "Server.Setting.ExportValues",
|
||||
["export.nameTemplate"] = "Server.Setting.OutputName",
|
||||
["export.folder"] = "Server.Setting.ExportFolder",
|
||||
["export.batch"] = "Server.Setting.Batch",
|
||||
["excludedFrames"] = "Server.Setting.ExcludedFrames",
|
||||
["heroFrame"] = "Server.Setting.HeroFrame",
|
||||
};
|
||||
|
||||
/// <summary>"originals · proxies", "proxies" (cached server proxies) or "—".</summary>
|
||||
public static string Local(SyncEntry entry)
|
||||
{
|
||||
if (entry.HasLocalOriginals)
|
||||
{
|
||||
return (entry.Local!.Status & SequenceStatus.ProxiesBuilt) != 0
|
||||
? Join(Loc.L("Server.Sync.Originals"), Loc.L("Server.Sync.Proxies"))
|
||||
: Loc.L("Server.Sync.Originals");
|
||||
}
|
||||
return entry.Link is { ProxiesCached: > 0 } ? Loc.L("Server.Sync.Proxies") : Loc.L("Server.Sync.None");
|
||||
}
|
||||
|
||||
/// <summary>"originals · proxies · 3 exports", "46 % received" while uploading, or "—".</summary>
|
||||
public static string Server(SyncEntry entry)
|
||||
{
|
||||
if (entry.Transfer is { Kind: JobKind.UploadCommit, State: JobState.Running, ProgressTotal: > 0 } upload)
|
||||
return Loc.L("Server.Sync.Received", Formatting.Percent((double)upload.ProgressDone / upload.ProgressTotal));
|
||||
if (entry.Link is not { } link) return Loc.L("Server.Sync.None");
|
||||
var parts = new List<string>(3) { Loc.L("Server.Sync.Originals") };
|
||||
if (link.ServerHasProxies) parts.Add(Loc.L("Server.Sync.Proxies"));
|
||||
if (link.RenderCount > 0) parts.Add(Loc.Plural("Server.Sync.Exports", link.RenderCount));
|
||||
return Join([.. parts]);
|
||||
}
|
||||
|
||||
/// <summary>The State column: glyph kind, word and tooltip (never colour alone).</summary>
|
||||
public static (StatusKind Kind, string Text, string ToolTip) State(SyncEntry entry)
|
||||
{
|
||||
if (entry.Transfer is { } job)
|
||||
{
|
||||
var upload = job.Kind == JobKind.UploadCommit;
|
||||
return job.State switch
|
||||
{
|
||||
JobState.Paused => (StatusKind.Paused, Loc.L("Server.Sync.State.Paused"), Loc.L("Tooltips.Server.Sync.State.Paused")),
|
||||
JobState.Queued => (StatusKind.Queued, Loc.L("Server.Sync.State.Waiting"), Loc.L("Tooltips.Server.Sync.State.Waiting")),
|
||||
_ => (StatusKind.Running, Loc.L(upload ? "Server.Sync.State.Uploading" : "Server.Sync.State.Downloading"),
|
||||
Loc.L(upload ? "Tooltips.Server.Sync.State.Uploading" : "Tooltips.Server.Sync.State.Downloading")),
|
||||
};
|
||||
}
|
||||
if (entry.Link?.Error is { } error) return (StatusKind.Warning, Loc.L("Server.Sync.State.Failed"), Loc.L("Tooltips.Server.Sync.State.Failed", error));
|
||||
return entry.Status switch
|
||||
{
|
||||
SyncStatus.InSync => (StatusKind.Done, Loc.L("Server.Sync.State.InSync"), Loc.L("Tooltips.Server.Sync.State.InSync")),
|
||||
SyncStatus.LocalOnly => (StatusKind.Offline, Loc.L("Server.Sync.State.LocalOnly"), Loc.L("Tooltips.Server.Sync.State.LocalOnly")),
|
||||
SyncStatus.RemoteOnly => (StatusKind.Remote, Loc.L("Server.Sync.State.RemoteOnly"), Loc.L("Tooltips.Server.Sync.State.RemoteOnly")),
|
||||
SyncStatus.ProxiesOnly => (StatusKind.Remote, Loc.L("Server.Sync.State.ProxiesOnly"), Loc.L("Tooltips.Server.Sync.State.ProxiesOnly")),
|
||||
SyncStatus.LocalAhead => (StatusKind.Synced, Loc.L("Server.Sync.State.LocalAhead"), Loc.L("Tooltips.Server.Sync.State.LocalAhead")),
|
||||
SyncStatus.ServerAhead => (StatusKind.Remote, Loc.L("Server.Sync.State.ServerAhead"), Loc.L("Tooltips.Server.Sync.State.ServerAhead")),
|
||||
_ => (StatusKind.Warning, Loc.L("Server.Sync.State.Conflict"), ConflictSummary(entry)),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>One line for the State tooltip: "Deflicker window 41 here, 33 on the server · +2".</summary>
|
||||
public static string ConflictSummary(SyncEntry entry)
|
||||
{
|
||||
var lines = Conflict(entry, int.MaxValue);
|
||||
return lines.Count switch
|
||||
{
|
||||
0 => Loc.L("Tooltips.Server.Sync.State.Conflict"),
|
||||
1 => lines[0],
|
||||
_ => Loc.L("Server.Conflict.More", lines[0], Formatting.Count(lines.Count - 1)),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What differs, one line per setting or sequence field in project order ("Deflicker window 41 here, 33 on the
|
||||
/// server", "Tags differ"), at most <paramref name="max"/>.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<string> Conflict(SyncEntry entry, int max) => entry is { Local: { } local, Link.ConflictRemote: { } theirs }
|
||||
? Differences(SyncRules.Differences(SyncPayload.Of(local), theirs, 64), max)
|
||||
: [];
|
||||
|
||||
/// <summary>
|
||||
/// One line per setting or sequence field among <paramref name="differences"/> ("Deflicker window 41 here, 33 on the
|
||||
/// server", "Tags differ"), at most <paramref name="max"/>; the editor's settings conflicts read the same.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<string> Differences(IEnumerable<SettingsDifference> differences, int max)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(differences);
|
||||
var lines = new List<string>();
|
||||
var shown = new HashSet<string>(StringComparer.Ordinal);
|
||||
foreach (var difference in differences)
|
||||
{
|
||||
var (key, field) = Setting(difference.Path);
|
||||
if (!shown.Add(key)) continue;
|
||||
var label = Loc.L(key);
|
||||
var metadata = difference.Path.StartsWith(SyncRules.MetadataPath, StringComparison.Ordinal);
|
||||
lines.Add((metadata ? Text(difference.Mine) : Value(difference.Mine, field)) is { } mine
|
||||
&& (metadata ? Text(difference.Theirs) : Value(difference.Theirs, field)) is { } server
|
||||
? Loc.L("Server.Conflict.Difference", label, mine, server)
|
||||
: Loc.L("Server.Conflict.Changed", label));
|
||||
if (lines.Count == max) break;
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
/// <summary>The row's buttons, in the order the mockup shows them.</summary>
|
||||
public static IReadOnlyList<SyncAction> Actions(SyncEntry entry, SyncRights rights)
|
||||
{
|
||||
if (entry.Transfer is { } job) return job.State == JobState.Paused ? [SyncAction.Resume] : [SyncAction.Pause];
|
||||
var actions = new List<SyncAction>(3);
|
||||
switch (entry.Status)
|
||||
{
|
||||
case SyncStatus.LocalOnly when rights.CanUpload:
|
||||
actions.Add(SyncAction.Upload);
|
||||
break;
|
||||
case SyncStatus.RemoteOnly or SyncStatus.ProxiesOnly:
|
||||
actions.Add(SyncAction.OpenWithProxies);
|
||||
if (rights.CanFetchOriginals) actions.Add(SyncAction.DownloadOriginals);
|
||||
break;
|
||||
case SyncStatus.LocalAhead when entry.Link is { MissingRemote: > 0 }:
|
||||
if (rights.CanUpload) actions.Add(SyncAction.Upload);
|
||||
break;
|
||||
case SyncStatus.ServerAhead when entry.Link is { MissingLocal: > 0 }:
|
||||
if (rights.CanFetchOriginals) actions.Add(SyncAction.DownloadOriginals);
|
||||
break;
|
||||
case SyncStatus.LocalAhead when rights.CanEdit:
|
||||
case SyncStatus.ServerAhead:
|
||||
actions.Add(SyncAction.SyncSettings);
|
||||
break;
|
||||
case SyncStatus.Conflict:
|
||||
if (rights.CanEdit) actions.Add(SyncAction.KeepMine);
|
||||
actions.AddRange([SyncAction.TakeServer, SyncAction.SaveBoth]);
|
||||
return actions;
|
||||
}
|
||||
// Renders travel on request once no original is waiting to go either way.
|
||||
if (entry is { Local: not null, Link: { MissingRemote: 0, MissingLocal: 0 } link })
|
||||
{
|
||||
if (link.ExportsToGet > 0) actions.Add(SyncAction.GetExports);
|
||||
if (link.ExportsToSend > 0 && rights.CanUpload) actions.Add(SyncAction.SendExports);
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
/// <summary>The bytes an action moves (for the tooltips).</summary>
|
||||
public static long Size(SyncEntry entry, SyncAction action) => action switch
|
||||
{
|
||||
SyncAction.Upload => entry.Local?.TotalBytes ?? 0,
|
||||
SyncAction.DownloadOriginals => entry.Link?.TotalBytes ?? 0,
|
||||
SyncAction.GetExports => entry.Link?.ExportsToGetBytes ?? 0,
|
||||
SyncAction.SendExports => entry.Link?.ExportsToSendBytes ?? 0,
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
/// <summary>The tooltip of a row button: what it does and, for transfers, what it moves.</summary>
|
||||
public static string ToolTip(SyncEntry entry, SyncAction action) => action switch
|
||||
{
|
||||
SyncAction.Upload or SyncAction.DownloadOriginals => Loc.L("Tooltips.Server.Sync." + action, Formatting.Bytes(Size(entry, action))),
|
||||
SyncAction.GetExports => Loc.Plural("Tooltips.Server.Sync.GetExports", entry.Link!.ExportsToGet, Formatting.Bytes(Size(entry, action))),
|
||||
SyncAction.SendExports => Loc.Plural("Tooltips.Server.Sync.SendExports", entry.Link!.ExportsToSend, Formatting.Bytes(Size(entry, action))),
|
||||
_ => Loc.L("Tooltips.Server.Sync." + action),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The chips sort by where the originals are: a sequence being transferred still counts as only on this PC (no server
|
||||
/// copy yet) or only on the server (no local originals yet), as the chip tooltips say.
|
||||
/// </summary>
|
||||
public static bool Matches(SyncEntry entry, SyncFilter filter, string search) =>
|
||||
(filter switch
|
||||
{
|
||||
SyncFilter.LocalOnly => entry.Status == SyncStatus.LocalOnly || entry is { Status: SyncStatus.Transferring, Link: null },
|
||||
SyncFilter.Remote => entry.Status is SyncStatus.RemoteOnly or SyncStatus.ProxiesOnly
|
||||
|| entry is { Status: SyncStatus.Transferring, HasLocalOriginals: false, Link: not null },
|
||||
SyncFilter.Conflicts => entry.Status == SyncStatus.Conflict,
|
||||
_ => true,
|
||||
}) && (search.Length == 0 || entry.Title.Contains(search, StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
/// <summary>
|
||||
/// The label key of a difference path and the member below the setting it reaches ("isAuto", "manual", … of an
|
||||
/// Auto parameter; null for the setting itself): "exposure.deflickerWindow.manual" is the deflicker window's manual value.
|
||||
/// </summary>
|
||||
private static (string Key, string? Field) Setting(string path)
|
||||
{
|
||||
var segments = path.Split('.');
|
||||
for (var length = segments.Length; length > 0; length--)
|
||||
{
|
||||
if (SettingKeys.TryGetValue(string.Join('.', segments[..length]), out var key)) return (key, length < segments.Length ? segments[length] : null);
|
||||
}
|
||||
return ("Server.Setting.Other", segments[^1]);
|
||||
}
|
||||
|
||||
/// <summary>A title, tags, rating or notes value as shown ("—" when empty).</summary>
|
||||
private static string Text(string? value) => string.IsNullOrWhiteSpace(value) ? Loc.L("Server.Sync.None") : Shorten(value);
|
||||
|
||||
/// <summary>A side's value as shown ("41", "on", "auto"); null when it is not a single value worth printing.</summary>
|
||||
private static string? Value(string? json, string? field)
|
||||
{
|
||||
if (json is null) return field is null or "manual" ? Loc.L("Server.Sync.None") : null;
|
||||
if (field is not (null or "manual" or "autoValue" or "isAuto")) return null;
|
||||
JsonNode? node;
|
||||
try
|
||||
{
|
||||
node = JsonNode.Parse(json);
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (field == "isAuto") return node is JsonValue v && v.TryGetValue<bool>(out var auto) ? Loc.L(auto ? "Server.Setting.Auto" : "Server.Setting.Manual") : null;
|
||||
return node switch
|
||||
{
|
||||
null => Loc.L("Server.Sync.None"),
|
||||
JsonValue value when value.TryGetValue<bool>(out var flag) => Loc.L(flag ? "Server.Setting.On" : "Server.Setting.Off"),
|
||||
JsonValue value when value.TryGetValue<double>(out var number) => number.ToString("0.###", Loc.Culture),
|
||||
JsonValue value when value.TryGetValue<string>(out var text) => Shorten(text),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
private static string Shorten(string text) => text.Length <= 40 ? text : string.Concat(text.AsSpan(0, 39), "…");
|
||||
|
||||
private static string Join(params string[] parts) => string.Join(Loc.Separator, parts);
|
||||
}
|
||||
Reference in new issue
Block a user