feat: owner review 2 phase 1: :latest, Unraid array space, Settings with About, whole-folder import (#9)
CI / Build and test (push) Successful in 5m11s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 6s
Release / Build, test and publish (push) Successful in 8m57s
CI / PostgreSQL 16 integration (push) Successful in 3m10s
CI / PostgreSQL 17 integration (push) Successful in 3m30s
CI / Docker image (push) Successful in 49s
Release / Server image (push) Successful in 1m4s

- :latest follows the highest stable release, or the highest pre-release while none is stable (Chronos.Tools release-channels); bad tags are refused before anything is built.
- Unraid: CHRONOS_SPACE_PATH and the template's Array view show the array's free space; the write volume (cache) is shown apart; completions check the archive volume (507).
- Settings is a gear, docked at the foot of the admin sidebar; About is the last part of Settings on the desktop and the panel.
- Import > Folder > Whole folder: one sequence per format (desktop only).

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 #9.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-10-27 01:09:59 +01:00
1 parent 5acdf146c7
commit 1f089888e8
320 files changed
+3030 -927

No files matched your search

@@ -46,6 +46,39 @@ public sealed class ServerImportSinkTests(TestContext context)
Assert.Empty(Directory.EnumerateFileSystemEntries(staging));
}
[Test]
public async Task AWholeFolderImportedAgainKeepsTheNameItsSequenceWasGivenOnTheServer()
{
var folder = Card(Path.Combine(context.CreateTempDirectory("folder"), "Etna"), 4, Start);
var staging = context.CreateTempDirectory("staging");
var server = new FakeUploadServer(chunkSize: 4096);
using var client = new ChronosClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
var destination = new UnindexedDestination(ImportDestinationKind.Server, staging);
var options = new ImportChoices { Grouping = ImportGrouping.WholeFolder }.ToOptions();
var first = await destination.PlanAsync(folder, options, null, null, context.Cancellation);
await LocalImport.RunAsync(first, new ServerImportSink(client, staging), "Etna", verify: true, null, context.Cancellation);
var (sequence, title) = server.Titles.Single();
Assert.Equal("Etna", title, "a new sequence takes the folder's name");
// Renamed on the server; a photo added to the folder joins the same sequence and leaves its name alone.
server.Titles[sequence] = "Etna 2026 eruption";
var photos = Path.Combine(folder, "DCIM", "100CANON");
File.WriteAllBytes(Path.Combine(photos, "IMG_0005.JPG"), Jpeg(Start.AddMinutes(10), 5));
var again = await destination.PlanAsync(folder, options, null, null, context.Cancellation);
var outcome = await LocalImport.RunAsync(again, new ServerImportSink(client, staging), "Etna", verify: true, null, context.Cancellation);
Assert.Equal((1, 4), (outcome.Copied, outcome.Duplicates));
Assert.Equal("Etna 2026 eruption", server.Titles[sequence]);
Assert.Equal(1, server.TitleUpdates, "only the new sequence was named");
// A title the user types still names it.
File.WriteAllBytes(Path.Combine(photos, "IMG_0006.JPG"), Jpeg(Start.AddMinutes(20), 6));
var typed = ImportPlans.WithTitles(await destination.PlanAsync(folder, options, null, null, context.Cancellation),
new Dictionary<string, string> { [again.Sessions[0].SessionKey] = "Etna at night" });
await LocalImport.RunAsync(typed, new ServerImportSink(client, staging), "Etna", verify: true, null, context.Cancellation);
Assert.Equal("Etna at night", server.Titles.Single().Value);
}
[Test]
public async Task PhotosTheServerAlreadyHoldsAreNotSentAgain()
{
@@ -233,7 +266,7 @@ public sealed class ServerImportSinkTests(TestContext context)
public void Advance(TimeSpan by) => Interlocked.Add(ref _ticks, by.Ticks);
}
/// <summary>Start, chunk and complete of BRIEF §14.4, plus the title update and card reports; the hash is checked at completion.</summary>
/// <summary>Start, chunk and complete of BRIEF §14.4, plus the sequence's title and card reports; the hash is checked at completion.</summary>
private sealed class FakeUploadServer(int chunkSize) : HttpMessageHandler
{
private readonly Dictionary<Guid, Upload> _open = [];
@@ -241,7 +274,11 @@ public sealed class ServerImportSinkTests(TestContext context)
private readonly Dictionary<string, Guid> _frames = new(StringComparer.Ordinal);
public List<Upload> Committed { get; } = [];
/// <summary>Each sequence's title on the server (a test may rename one, as a user would there).</summary>
public Dictionary<Guid, string> Titles { get; } = [];
public int TitleUpdates { get; private set; }
public int ChunkCount { get; private set; }
/// <summary>Flip a byte of every chunk of this file (a damaged transfer).</summary>
@@ -321,16 +358,21 @@ public sealed class ServerImportSinkTests(TestContext context)
return Json(new CompleteUploadResponse(frame, sequence, Committed.Count(u => u.SessionKey == upload.SessionKey) - 1),
ProtocolJson.Default.CompleteUploadResponse);
}
if (request.Method == HttpMethod.Get && path is ["api", "v1", "sequences", var read])
return Json(Sequence(Guid.Parse(read), Titles.GetValueOrDefault(Guid.Parse(read))), ProtocolJson.Default.SequenceDto);
if (request.Method == HttpMethod.Patch && path is ["api", "v1", "sequences", var sequenceId])
{
var update = (await request.Content!.ReadFromJsonAsync(ProtocolJson.Default.UpdateSequenceRequest, cancellationToken))!;
Titles[Guid.Parse(sequenceId)] = update.Title!;
return Json(new SequenceDto(Guid.Parse(sequenceId), update.Title, update.Title!, "f", null, null, null, null, null, 0, null, 0, 0, 0, null, [], 0, null,
1, 1, 0, null, DateTimeOffset.UtcNow), ProtocolJson.Default.SequenceDto);
TitleUpdates++;
return Json(Sequence(Guid.Parse(sequenceId), update.Title), ProtocolJson.Default.SequenceDto);
}
return new HttpResponseMessage(HttpStatusCode.NotFound);
}
private static SequenceDto Sequence(Guid id, string? title) =>
new(id, title, title ?? "f", "f", null, null, null, null, null, 0, null, 0, 0, 0, null, [], 0, null, 1, 1, 0, null, DateTimeOffset.UtcNow);
private static HttpResponseMessage Json<T>(T value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> type, HttpStatusCode status = HttpStatusCode.OK) =>
new(status) { Content = JsonContent.Create(value, type) };