fix(web/claw): render and download the images a turn hands over

An attachment card lands inside the turn that produced it, and both
passes that touch image cards scanned only the top-level rows. The pass
that fetches bytes never saw the card, so it stayed a name and a size
with no picture. The pass that stores the fetched object URL had the
same blind spot, so even a fetch that ran dropped its result. Both now
walk finished turns and the live one, through one helper that knows
where cards live. Consents move to the same helper: a card whose turn
already closed had the same problem.

The download control was hidden for `media: "image"`, which left an
image with no way out of the store when its bytes did not paint, as
they never did. Every card offers it now. The anchor also joins the
document for the click, which some browsers require before they follow
a `download` on a blob URL.
This commit is contained in:
vhaudiquet committed 2026-11-24 21:17:02 +01:00
1 parent 1a1ace014a
commit 04b06e7623
4 files changed
+83 -67

No files matched your search

+10 -5
View File
@@ -112,11 +112,16 @@ Two consequences worth knowing before changing this code:
and again on the stream's `consent_resolved` echo; nothing persists
client-side, so a reload rebuilds the cards from the replay.
- **Attachments render inline.** An `attachment` event becomes a card
— media glyph, file name, B/KB/MB size, caption. Images fetch the
bearer-guarded bytes (`GET /v1/attachments/{id}`, blob → object URL,
like the identity images) and render capped at 240px; code and file
cards download on click. Object URLs cache per id, so a replay never
refetches.
— media glyph, file name, B/KB/MB size, caption. The media kind comes
from the file extension, decided by the daemon when it stores the
file, so a `.png` renders and a `.patch` downloads without the client
guessing. Images fetch the bearer-guarded bytes
(`GET /v1/attachments/{id}`, blob → object URL, like the identity
images) and render capped at 240px; every card downloads on click,
images included. A card lives inside the turn that produced it, so
the scan that fetches image bytes walks finished turns and the live
one, not just the top-level rows. Object URLs cache per id, so a
replay never refetches.
- **Your images ride along.** The composer's `+` — and an image on the
clipboard — stage as removable chips (`▣1 photo.png 1.2 MB`), the
claw's own budget enforced client-side (8 a message, 5 MiB decoded