Owner review 2, R3: the panel can add photos to an existing or a new
sequence without the desktop app. upload.js is a dialog the library pages
open (openUpload({ api, sequence, onDone })): file picker or drag and drop
(folders are counted and left out: whole-folder import stays on the
desktop), per-photo state, a total bar, Cancel that deletes the started
uploads, and a leave-page guard while sending. Each photo is hashed in a
same-origin module worker with an in-house incremental SHA-256 (8 MiB
reads; crypto.subtle cannot hash in pieces), which runs the FIPS 180-4
known answers and a crypto.subtle cross-check before its first hash and
refuses to hash on any mismatch; the server verifies the hash again.
Chunks go through api.putBytes with the session's CSRF header, two files
and two chunks at a time, retrying no answer, 429 and 503; quota, space
and permission refusals stop the run with the server's message, and a
photo deleted from the sequence shows as deleted before.
server/info now lists the photo extensions the archive files, so the
dialog offers and sends only those. The CSP already allows the worker
(worker-src falls back to script-src 'self'); tests pin that, the module
walk follows the worker, and a browser-shaped upload runs end to end
through the cookie session.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit c64c60ab8bb41c102182e284177ac04a56bf1058)
28 lines
1.1 KiB
C#
28 lines
1.1 KiB
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace Chronos.Protocol;
|
|
|
|
/// <summary>Error body of every failed API call: <c>{ code, message, details }</c> (BRIEF §14.3).</summary>
|
|
public sealed record ApiError(string Code, string Message, string? Details = null);
|
|
|
|
/// <summary>Upload and account limits announced by the server.</summary>
|
|
public sealed record ServerLimits(long MaxUploadBytes, int ChunkSizeBytes, int PasswordMinLength = 10);
|
|
|
|
/// <summary><c>GET /api/v1/server/info</c>.</summary>
|
|
/// <param name="Extensions">
|
|
/// File extensions the archive files as photos (lower case, no dot): the admin panel's upload dialog offers and sends only
|
|
/// these (owner review 2, R3). Null from servers that do not announce them.
|
|
/// </param>
|
|
public sealed record ServerInfo(
|
|
string Name,
|
|
string Version,
|
|
int ApiVersion,
|
|
IReadOnlyList<string> Capabilities,
|
|
string? TlsFingerprint,
|
|
IReadOnlyList<string> Formats,
|
|
ServerLimits Limits,
|
|
IReadOnlyList<string>? Extensions = null);
|
|
|
|
/// <summary><c>GET /health</c>.</summary>
|
|
public sealed record HealthStatus(string Status, string Version, IReadOnlyDictionary<string, string> Checks);
|