Files
hyperframes/packages
James RussoandClaude Opus 5.5 80cda85d76 fix(studio-server): run thumbnail captures in an opaque origin (#7528)
* fix(studio-server): run thumbnail captures in an opaque origin

The thumbnail renderer loads each composition as a top-level page, so its
scripts ran on the Studio's origin. The capture document (`?hf-capture`) now
carries `Content-Security-Policy: sandbox allow-scripts`, so those scripts get
an opaque origin.

An opaque page's CORS-mode loads fail without a CORS header. The renderer that
opened the page is trusted, so it adds `Access-Control-Allow-Origin: null`
itself, over that page's own DevTools session, to the loads a frame needs:
- fonts, module scripts and images;
- the `.html` scenes, `.json` and `.cube` files the runtime fetches.
Only GETs of the project's preview files qualify, matched by file type. Both
thumbnail renderers do this: the CLI's and the Vite dev server's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(studio-server): let an opaque capture wait for a video's preview copy

A video the browser cannot decode is drawn from its `?hf-proxy=` copy. The
runtime waits for that copy with a ranged fetch, preflighted when it carries
the priority header. In the opaque capture page both failed, so each such
thumbnail fell back to a still after about five seconds of retries.

The renderer now answers that preflight itself. It also exposes the copy's
status headers to the wait, for video files under the preview path only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(studio-server): keep capture-load comments within the package share

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(studio-server): keep video pixels and project fetches in opaque thumbnail captures

- Media loads: the renderer now grants them, and a capture document loads the
  project's own videos with `crossorigin="anonymous"`. Color grading and shader
  textures can then read their pixels.
- Fetches: every GET of the project's preview files is granted, except a dotfile
  or dot-folder path such as `.env` or `.git/`. This covers the models and fonts
  that registry blocks fetch at runtime.
- Opt-in: the capture sandbox is now a `createStudioApi` option,
  `sandboxThumbnailCaptures`, off by default. The CLI Studio server and the Vite
  dev server turn it on, because their thumbnail renderers install the grant.
  Another app keeps its current capture documents until its renderer does the
  same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(shader-transitions): prepare transitions when IndexedDB is denied

An opaque-origin document, such as a sandboxed preview or thumbnail capture,
has no IndexedDB, and opening it throws. The snapshot cache now treats that
as no cache, so the transitions still prepare and draw.

Thumbnail captures also grant a CORS read of a missing preview file, so a
fetch() sees its status as a same-origin page would.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(studio-server): leave a video with another host's <source> out of capture CORS

A video whose <source> child points to another host now keeps its plain
load in a thumbnail capture. Adding crossorigin to it would make a CDN
that sends no CORS headers refuse the video, leaving the clip blank.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 07:50:59 +00:00
..
2026-11-11 06:32:08 +00:00
2026-11-11 06:32:08 +00:00
2026-11-11 06:32:08 +00:00
2026-11-11 06:32:08 +00:00
2026-11-11 06:32:08 +00:00
2026-11-11 06:32:08 +00:00
2026-11-11 06:32:08 +00:00
2026-11-11 06:32:08 +00:00
2026-11-11 06:32:08 +00:00