feat(server): API v1 with auth, uploads, sync, jobs, render nodes and events

- Security: PBKDF2-SHA512 (210,000 iterations) hashes, opaque bearer tokens
  stored as SHA-256 with sliding expiry and revocation, HttpOnly/Secure/
  SameSite=Strict admin cookie with a session-bound CSRF token, sign-in rate
  limit and lockout, role/permission metadata on every endpoint, audit log,
  first-run administrator bootstrap.
- Sequences with keyset paging, ETags and settings_version conflicts; sync
  manifest; frames, proxies, thumbnails and exports streamed with Range.
- Chunked resumable uploads with hash short-circuit, quota and disk checks,
  staging on the archive volume, SHA-256 verification and IArchiveIngest.
- Job engine host, jobs API, render nodes with heartbeat timeout and
  reassignment, WebSocket events, LAN discovery beacon, upload cleanup.
- Windows service host over advapi32 (--service, --install-service,
  --uninstall-service); fails fast without the archive module services.

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 11:32:19 +00:00
1 parent 7353c17d7b
commit c78747053e
56 files changed
+4726 -108

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
using Titano.Core.Model;
using Titano.Data;
namespace Titano.Server.Jobs;
/// <summary>
/// Follow-up work after frames arrive (BRIEF §14.4): thumbnails, proxies and light analysis of the sequence, queued at
/// background priority once per sequence while one is still waiting, and only for kinds this server can run.
/// </summary>
public sealed class SequenceJobs(TitanoDatabase db, JobEngineHost jobs)
{
private static readonly JobKind[] AfterNewFrames = [JobKind.Thumbs, JobKind.Proxies, JobKind.LightAnalyse];
private readonly SemaphoreSlim _gate = new(1, 1);
public async Task FramesAddedAsync(Sequence sequence, CancellationToken cancellationToken)
{
await _gate.WaitAsync(cancellationToken);
try
{
foreach (var kind in AfterNewFrames)
{
if (!jobs.CanRun(kind) || await db.Jobs.IsQueuedAsync(kind, sequence.Id, cancellationToken)) continue;
await jobs.Engine.EnqueueAsync(kind, [sequence.Id], sequence.DisplayTitle, priority: JobPriority.Background, cancellationToken: cancellationToken);
}
}
finally
{
_gate.Release();
}
}
}