feat(media): albums — one link for a season or a photo album; fix path traversal in media get

An album is a sealed file (shade.album/v1) listing grants, so the relay
cannot tell it from a film. `shade media put dir/` uploads every file and
the album (subdirectories nest, natural order); `media get` brings an
album back as a directory; /watch/ shows a grid with decrypted previews
and Back returns to the album without putting grants in history. Kotlin
reads albums (Albums.read) against a new shared vector.

Fixed: `media get` used the sealer-chosen meta.name as the output path.
Fixed a relay test race (flush() is sent, not received); the relay now
reports framesIn.

Verified: 64 TS tests x3, Kotlin 81/0, a 6-file album with a nested album
uploaded, browsed, played and downloaded back bit-identical.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-18 21:44:43 +02:00
parent e696d83283
commit 8c7300fa51
18 changed files with 726 additions and 44 deletions

View File

@@ -38,6 +38,13 @@ New package **`@shade/media`** — see `docs/media.md`.
frag_keyframe+empty_moov` for H.264/AAC; the container is detected).
`MediaSplitter`, `WebmSplitter` and `Fmp4Splitter` are exported for apps
that publish from their own source.
- **Albums.** One link for a season, a photo album or a camera wall: an
album is a sealed file listing grants (`shade.album/v1`), so the relay
cannot tell it from a film. `shade media put dir/` uploads every file
and prints the album's link (subdirectories become nested albums, in
natural order); `shade media get` downloads an album back into a
directory; `/watch/` shows it as a grid with decrypted previews.
`uploadAlbum`, `openAlbum`, `Albums.read` (Kotlin), and a shared vector.
- **Kotlin.** `no.zyon.shade.media`: SMF1 reader and sealer, grants, live
subscriber and publisher — byte-for-byte against `test-vectors/media.json`.
`:shade-android-media` plays sealed files in Media3/ExoPlayer
@@ -46,6 +53,13 @@ New package **`@shade/media`** — see `docs/media.md`.
### Fixed
- `shade media get` used the sealed file's `meta.name` as the output path,
so whoever sealed a file chose where it was written (`../../.bashrc`).
Names are now reduced to one safe path component.
- A relay test raced: `flush()` means sent, not received, so a viewer could
join mid-burst and (correctly) get an older backlog. The relay now counts
`framesIn` in `stats()`, and the test waits on it.
- The container refused every request body over 128 MiB (Bun's default),
which would have made every film a 413. The cap is raised only when media
is mounted, and every other route now has an explicit 128 MiB body limit.