feat(android): Share to Shade — a video from the gallery is sealed on the phone and uploaded
ShadeUpload turns a shared content:// URI into meta and an upload job; KeystoreSecretFile keeps the owner seed under a Keystore key. The demo app takes SEND/SEND_MULTIPLE of video, images, audio and documents, uploads in a foreground service with progress, and its done notification plays the file or shares the link; the player gets a Share button. The live cross-check also uploads a content:// share under Robolectric. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -276,6 +276,22 @@ again: the media id is the same, so the relay picks up where it stopped, and a f
|
||||
already has gives the same link without sending anything. The relay must list
|
||||
`owner.id` among its owners.
|
||||
|
||||
`UploadJobs` does that bookkeeping: `uploader.upload(jobs, key, …)` seals once into an
|
||||
app-private job directory (sealed copy + seal result, file key included — keep it in
|
||||
`filesDir`), resumes after a kill with the same media id, and gives a finished job's
|
||||
grant again unless the relay says the file is gone. On Android, `ShadeUpload.describe(
|
||||
context, uri)` turns a shared `content://` URI into the meta to seal (name, type, size,
|
||||
duration, picture size as shown — nothing else, no location) and `ShadeUpload.upload`
|
||||
runs it as a job. `KeystoreSecretFile` (`:shade-android-keystore`) keeps the owner seed
|
||||
encrypted under a hardware-backed Keystore key.
|
||||
|
||||
The demo app shows the whole flow: share a video, photo, song or document to «Share to
|
||||
Shade», enter the relay once and add the owner id it shows to the relay's
|
||||
`--owners`; a foreground service seals and uploads with a progress notification, and
|
||||
the finished notification plays the file or shares its link. Android 15 limits
|
||||
`dataSync` foreground services to 6 hours a day, which is a lot of film; a killed
|
||||
upload resumes when the service starts again.
|
||||
|
||||
For playback, `:shade-android-media` hands a reader to Media3/ExoPlayer, so any
|
||||
container ExoPlayer understands plays and seeks from a sealed file:
|
||||
|
||||
@@ -529,7 +545,9 @@ done in v1. A deployment that needs it can pad above this layer.
|
||||
byte for byte (`MediaVectorTest`), owner signatures and encoded grants included.
|
||||
- `bun run scripts/media-live-kotlin.ts`: the Kotlin uploader against a real TS relay,
|
||||
with a lost answer and a refused piece injected; TS reads the 40 MiB film back
|
||||
byte for byte (`MediaLiveTest`, skipped without the driver).
|
||||
byte for byte (`MediaLiveTest`, skipped without the driver). The same run kills an
|
||||
upload job after its first piece and resumes it, and uploads a video shared by its
|
||||
`content://` URI under Robolectric (`ShadeUploadTest`).
|
||||
- `bench/media.ts`: throughput, seek latency and live fan-out, written as
|
||||
`bench/media.chart.json`.
|
||||
- `bench/media-store.ts`: disk store against S3 (+ Postgres) through the real routes,
|
||||
|
||||
Reference in New Issue
Block a user