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:
@@ -31,6 +31,10 @@ shade media put Film.mkv --server https://relay.example
|
||||
# Back on disk, decrypted and verified.
|
||||
shade media get '<link>' -o Film.mkv
|
||||
|
||||
# A season, a photo album: every file, plus one link that opens them all.
|
||||
shade media put "Sesong 1/" --server https://relay.example
|
||||
shade media get '<album link>' -o "Sesong 1" # the whole directory back
|
||||
|
||||
# Live logs.
|
||||
tail -f /var/log/app.log | shade live text --server https://relay.example --name "api logs" --channel ~/.config/shade/api-logs.json
|
||||
shade live watch '<link>' # in a terminal — or open the link in a browser
|
||||
@@ -253,6 +257,35 @@ cannot tell which ids exist. A link is `…/watch/#shade=<b64u(grant JSON)>`. Th
|
||||
fragment is never sent to a server, and the page removes it from the address bar
|
||||
once it has read it.
|
||||
|
||||
## Albums
|
||||
|
||||
An album is a sealed file like any other, with meta `mime`
|
||||
`application/vnd.shade.album+json` and this plaintext:
|
||||
|
||||
```jsonc
|
||||
{ "kind": "shade.album/v1", "title": "Sesong 1",
|
||||
"items": [ { "kind": "shade.media-grant/v1", … }, { "kind": "shade.live-grant/v1", … }, … ] }
|
||||
```
|
||||
|
||||
Items are grants in their wire form, so an album can hold films, pictures, live
|
||||
channels and other albums (`shade media put dir/` turns subdirectories into nested
|
||||
albums, in natural order). Parsing is strict on both sides: every item must be a
|
||||
valid grant, at most 10 000 items, a title of at most 512 characters.
|
||||
|
||||
The relay stores an album as one more opaque object. It cannot tell an album from a
|
||||
film, see its title, count its items or link it to them. Holding the album link means
|
||||
holding every item's keys: deleting the album does not take them back from someone who
|
||||
has already opened it. To revoke, delete the items.
|
||||
|
||||
Names in an album (and in any sealed file's meta) come from whoever sealed it, so
|
||||
`shade media get` never uses them as paths: only the last path segment is kept,
|
||||
without control characters or leading dots, and duplicates get a ` (2)` suffix.
|
||||
|
||||
`MediaClient.uploadAlbum`, `openAlbum` / `readAlbum` and `encodeAlbum` / `parseAlbum`
|
||||
in TS, `Albums.parse` / `Albums.read` in Kotlin. The `/watch/` page shows an album as a
|
||||
grid with decrypted previews, and Back returns from an item to its album. History
|
||||
entries hold only a depth, never a grant.
|
||||
|
||||
## What the relay learns
|
||||
|
||||
- **Sealed:** that an opaque id exists, its size (to within a segment), when it was
|
||||
|
||||
Reference in New Issue
Block a user