Support hour-long uploads and videos: raise body limit, stream uploads to disk, cache up to 3 h, add deferred-ideas note
This commit is contained in:
12
CLAUDE.md
12
CLAUDE.md
@@ -28,8 +28,18 @@ API endpoints (notes/admin routes are listed in the header of `server/notes.js`)
|
||||
JSON shapes mirror the Tauri Rust bridge exactly — don't change one side alone
|
||||
(`/api/streams`' `data.serverCached` is additive and web-only).
|
||||
|
||||
## Long videos (1 h+)
|
||||
- Bun's default request-body cap is 128 MB — `Bun.serve` sets `maxRequestBodySize` to 5 GiB;
|
||||
routes enforce their own limits (uploads 4 GB, intake `P2P_INTAKE_MAX_BYTES` 3 GiB). Without it
|
||||
every large upload/intake died with 413.
|
||||
- Admin uploads use `PUT /api/admin/uploads/stream?name=…` (raw body → disk in chunks, browser
|
||||
sends the `File` itself); cover images go to `PUT /api/admin/uploads/:id/art`. The multipart
|
||||
`POST /api/admin/uploads` parses the whole body in memory — scripts with small files only.
|
||||
- Videos over `transcode.maxSeconds` are never re-encoded (lane would be tied up for hours).
|
||||
- Deferred ideas (Cloudflare Worker fetch, Android device download): `docs/deferred-ideas.md`.
|
||||
|
||||
## Server media cache (`server/media-cache.js`)
|
||||
- Every played (`/api/streams`, LOW priority, ≤ `MEDIA_AUTO_MAX_SECONDS`) or saved
|
||||
- Every played (`/api/streams`, LOW priority, ≤ `MEDIA_AUTO_MAX_SECONDS`, default 3 h) or saved
|
||||
(`/api/download`, HIGH, ≤ 3 h) video gets ONE copy: `$MEDIA_DIR/<id>.<gen>.mp4`
|
||||
(≤720p H.264 8-bit + AAC, faststart) + `<id>.<gen>.m4a` audio sidecar for audio-only
|
||||
mode. `MEDIA_DIR` defaults to `./data/media` (the `ytplayer-data` volume in prod).
|
||||
|
||||
Reference in New Issue
Block a user