Skip to content

Long-lived browser cache for uploads, result images and audio - #231

Merged
apedintensor merged 1 commit into
mainfrom
claude/long-media-cache
Oct 25, 2026
Merged

apedintensor merged 1 commit into
mainfrom
claude/long-media-cache

Conversation

@apedintensor

Copy link
Copy Markdown
Member

Owner 2026-10-25: 跨天也不用重下, 保持越久越好.

  • The service-worker cache now covers original media from /v1/artifacts/{id}/content and /v1/assets/{id}/content (image/video/audio, plus non-thumb renditions). Thumbnails keep their own lane and use the browser HTTP cache (Browser reuses uploads and result images/audio (bucketed immutable signing) h3-studio#567).
  • Keys: artifact originals keep their earlier key (existing cached videos stay valid); uploads use as_<id>, renditions add _r_<name>.
  • The full download must match the type the authorized HEAD reported, otherwise nothing is stored.
  • Limits 4 GB / 256 MB per file / 4096 entries, LRU. Each view still rechecks access with HEAD; signing out still clears the cache.
  • Pairs with Ask for durable storage so cached media survives #230 (storage.persist()).
  • Settings copy: "媒体缓存 … 最多 4 GB".

Tests: video-cache (+ upload image hit), media-read-gate (assets now go through the cache; they still stream when IndexedDB is unavailable), full npm test 882/882.

🤖 Generated with Claude Code

The service-worker cache held only result MP4s (1 GB, 64 MB each). It now
keeps any original image/video/audio from /v1/artifacts or /v1/assets
(thumbnails keep their own lane), checks the downloaded type matches the
authorized HEAD, and holds up to 4 GB / 256 MB per file with LRU eviction.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@apedintensor
apedintensor merged commit a575814 into main Oct 25, 2026
2 checks passed
apedintensor added a commit to inkseq/h3-studio that referenced this pull request Oct 25, 2026
Syncs inkseq/inkseq-design#231.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant