The upload dialog's completion helper called `api`, which only exists inside
openUpload, so every web upload failed with a ReferenceError at its last step.
complete() now takes the dialog's api. A new test lexes every admin module and
fails when a top-level function uses api without taking it; it flags the old
upload.js.
During a run Esc is now stopped on the document in the capture phase. The old
listener sat on the dialog, so with the focus on the body (Start disables
itself, a click on the dialog's text) a second Esc closed the dialog and threw
the uploads away. The listener is added when a run starts and removed when it
ends or the dialog closes.
A sequence page refreshes after any ended job, because jobState names no
sequence. That refresh now redraws the header only when the sequence changed,
and the renders only when their list did. Stars, tags and renders are redrawn
through redraw(), so the keyboard focus stays put. restoreFocus finds an
unnamed control by its place, not as the first unnamed one. Failed thumbnails
are retried with a doubling wait and at most 8 tries, counted again once the
sequence changes.
The trash page reads the emptying it follows from /api/v1/jobs/{id} on every
load and after the event socket reconnects (api.events now emits
"reconnected"), so Empty no longer stays disabled when the job's end was lost.
A Restore in flight stays disabled across redraws.
The Library list counts cancelled jobs as ended (shared JOB_ENDED). Comments
are corrected in shared.js and library.js.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 641b9cd96b95d523990d1414c2bdead4138c5f4d)
Second fix round of owner review 2, phase 3 (engine, server, desktop).
- A photo never hashed whose original is missing can be deleted again: it goes
into its trash record without a file and without a tombstone (nothing is left
to name), stays listed until Empty erases it, and a restore keeps it with the
reason "no file". FrameDeleteBlock.Unhashable now blocks only a present
original that cannot be read; the API answers it as 409 photo_unreadable
naming the photo, and every block has its own code and message.
- Deleting a whole sequence first settles an interrupted photo deletion,
restore or ingest of it (ReadLocked under its lease), so no journal or half
entry travels into the sequence's trash entry; it refuses while a restore
into it waits for its busy entry.
- FrameTrash.Settle takes the photo entry's lease and leaves the journal for
later while the entry is busy (an emptying), so it never races EraseAsync;
meanwhile no other restore writes its journal over it and scans do not adopt
its files.
- The hashes computed for frames that stay (to find a twin of a deleted photo)
go into the sidecar and index, and only a frame whose first and last 64 KiB
match a deleted photo's is read whole.
- A restore into a new sequence rewrites its record after each photo filed, so
a crash or a database failure never leaves filed photos listed.
- An upload completion no longer has a window before the commit: the ingest
checks the sidecar's tombstones under the sequence lease a deletion takes
(IngestRequest.RefuseRemoved), unless the upload asked to bring it back.
- A restore reports each kept photo with its reason (no longer matches its
record, could not be moved back, already in the sequence, had no file); the
desktop line and the API message say so in en and it, and the tooltip holds
the whole sentence. The desktop tells TrashMismatchException by its type.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 1858f1f450a35fb8383ede8d80ce5f8de9b7ceac)
Sync:
- A server frame that has not been hashed is known by content only once it is
downloaded: one this PC deleted (or holds as its replacement) is now deleted
from staging instead of filed again, which also dropped its tombstone.
- An unhashed local original that turns out to be a photo the server deleted
is not uploaded, and the archive verify then writes the hashes into the
index, so the row settles instead of offering Upload for good.
- A tombstone leaves a photo out of the comparison only when its side no longer
holds that content, so a tombstone left beside a held copy does not keep the
other side's copy missing forever.
Uploads:
- StartUploadRequest.Restore (optional, never sent by sync or older clients)
lets an explicit user upload file a photo deleted from the sequence again,
also after the trash was emptied; the completion repeats it with
?restore=true and the ingest drops the tombstone.
- The completion checks the tombstone again: a photo deleted while its bytes
were on the way is not filed (409 photo_removed, upload cancelled); the
protocol client reports that as not sent.
- A tombstone of content a frame of the target still holds refuses no repair.
- Hidden dot names (AppleDouble "._" files) are refused, as the archive
scanner leaves them out.
Web upload dialog:
- Upload again on rows marked Deleted before; the tooltip no longer promises
a trash restore that may be impossible.
- Sends a capture time: the Exif DateTimeOriginal of a JPEG or TIFF-based file
(minimal in-house reader, capture-time.js), else the file's time, so photos
without Exif keep their order.
- Esc is stopped at keydown during a run (Chromium allows one prevented cancel
per activation); hidden dot files are left out; a completion refused while
another one files the upload waits for it; the same photo picked under two
names waits for its first copy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit d051bcfc351f5a08500ca864a6508576a95492a4)
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)