feat: owner review 2 phase 3: Library on the web panel, photo trash and web upload (#11)
CI / Build and test (push) Successful in 7m25s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 10s
CI / PostgreSQL 16 integration (push) Successful in 5m20s
CI / PostgreSQL 17 integration (push) Successful in 5m22s
CI / Docker image (push) Successful in 50s
Release / Build, test and publish (push) Successful in 12m1s
Release / Server image (push) Successful in 1m26s

- Web panel Library: browse, view, delete sequences and photos, mass operations (analyse, proxies, thumbnails, verify, retag, delete, CSV). It never edits the video.
- Photo trash with tombstones (migration 0008): crash-safe delete and restore, hash-checked restore with reasons, and emptying only by an explicit fingerprinted job. Sync and uploads keep deleted photos deleted; an explicit "Upload again" brings one back.
- Upload from the web panel: in-house SHA-256 in a worker with a fail-closed self-test, capture time from EXIF, chunked, resumable; no folders.
- Desktop trash dialog with photo entries and Empty.
- Admin files are revalidated (no-cache + ETag).

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 #11.
This commit is contained in:
Alby96andClaude Opus 5.5 authored and Alby96 committed 2026-10-27 15:08:39 +01:00
1 parent af9eeaab9b
commit 9aa818ed47
283 files changed
+24922 -293

No files matched your search

@@ -1,6 +1,7 @@
using System.Collections.Frozen;
using System.Reflection;
using System.Security.Cryptography;
using Microsoft.Extensions.Primitives;
namespace Chronos.Server.Hosting;
@@ -8,6 +9,12 @@ namespace Chronos.Server.Hosting;
/// Serves the admin panel from embedded resources named <c>admin/…</c> (no build step, single-file friendly),
/// with strong ETags, conditional GET and SPA fallback to <c>index.html</c>.
/// </summary>
/// <remarks>
/// Every file, the modules included, is sent with <c>Cache-Control: no-cache</c>: the browser keeps it but asks again
/// before each use, and an unchanged file costs a 304 without a body. The ETag is a hash of the content, so an upgrade
/// changes the ETag of exactly the files it changed and a browser never runs new modules next to cached old ones (with
/// <c>max-age</c> it could, until the cache expired).
/// </remarks>
public sealed class EmbeddedStaticFiles
{
private static readonly FrozenDictionary<string, string> ContentTypes = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
@@ -55,9 +62,9 @@ public sealed class EmbeddedStaticFiles
}
var response = context.Response;
response.Headers.ETag = file.ETag;
response.Headers.CacheControl = path.EndsWith(".html", StringComparison.OrdinalIgnoreCase) ? "no-cache" : "public, max-age=3600";
response.Headers.CacheControl = "no-cache";
response.Headers.XContentTypeOptions = "nosniff";
if (context.Request.Headers.IfNoneMatch == file.ETag)
if (NoneMatchHolds(context.Request.Headers.IfNoneMatch, file.ETag))
{
response.StatusCode = StatusCodes.Status304NotModified;
return true;
@@ -67,4 +74,23 @@ public sealed class EmbeddedStaticFiles
if (!HttpMethods.IsHead(context.Request.Method)) await response.Body.WriteAsync(file.Content, context.RequestAborted);
return true;
}
/// <summary>
/// Whether an <c>If-None-Match</c> header names <paramref name="etag"/>: <c>*</c>, or one of its entity tags under the
/// weak comparison GET uses (RFC 9110 §13.1.2), so a tag a proxy marked <c>W/</c> still matches.
/// </summary>
internal static bool NoneMatchHolds(StringValues header, string etag)
{
foreach (var value in header)
{
if (string.IsNullOrEmpty(value)) continue;
foreach (var part in value.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries))
{
if (part == "*") return true;
var tag = part.StartsWith("W/", StringComparison.Ordinal) ? part[2..] : part;
if (string.Equals(tag, etag, StringComparison.Ordinal)) return true;
}
}
return false;
}
}
+2
View File
@@ -173,12 +173,14 @@ public static class ServerHost
AuthEndpoints.Map(api);
UserEndpoints.Map(api);
SequenceEndpoints.Map(api);
LibraryEndpoints.Map(api);
FileEndpoints.Map(api);
UploadEndpoints.Map(api);
JobEndpoints.Map(api);
ScheduleEndpoints.Map(api);
NodeEndpoints.Map(api);
ArchiveEndpoints.Map(api);
TrashEndpoints.Map(api);
AdminEndpoints.Map(api);
DiagnosticsEndpoints.Map(api);
EventEndpoints.Map(api);