fix(play): make scene-image proxy opt-in — default deployers connect direct
b805b1drouted every scene <img> through fetch → Blob → createObjectURL to kill QUIC progressive-paint, but in doing so added an *unconditional* dependency on a CORS-adding proxy. That breaks the default deployment: im.runware.ai sends no Access-Control-Allow-Origin, so a direct fetch().blob() throws and the scene image silently fails to load for anyone who hasn't stood up the Cloudflare Worker. Restore the pre-b805b1d behavior as the *default* and make the proxy strictly opt-in: - Direct path (no env set): preloadImage() warms the HTTP cache + decodes, then <img> uses the original https://im.runware.ai URL — as beforeb805b1d. No fetch().blob(), no CORS dependency: a fresh clone just works. - Proxy path (NEXT_PUBLIC_IMAGE_PROXY_URL set): fetch the proxied URL → Blob → createObjectURL, exactly asb805b1d, gaining the QUIC-immune HTTP/2 edge + atomic paint. shouldProxy(url) gates the two paths: proxy only when a base is configured AND the host is in NEXT_PUBLIC_IMAGE_PROXY_ALLOWED_HOSTS (default im.runware.ai). data: / non-http / unknown-host URLs always take the direct path. blobUrlCache + revoke logic is unchanged and safe for both paths (revoke is a no-op on non-blob: URLs). The Cloudflare Worker moves out of this repo into a standalone, one-click- deployable project (infiplot-image-proxy) so the optional infra isn't carried by every clone; .env.example and the READMEs link to it. restore: preloadImage() helper deleted byb805b1dadd: NEXT_PUBLIC_IMAGE_PROXY_ALLOWED_HOSTS (default im.runware.ai) remove: worker/ (moved to standalone repo) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -155,6 +155,10 @@ Where to set them (see `.env.example` for the exact shape):
|
||||
|
||||
With the recommended trio, each scene's cost comes mainly from the image generation model. The FLUX.2 [klein] 9B KV image is roughly **\$0.00078** per scene (1792×1024, 4 steps, sub-second); the text model uses `deepseek-v4-flash`, so text costs are negligible by comparison. Tapping through a scene's beats is free. To keep transitions instant, the engine also pre-generates scenes you might pick but ultimately don't — so real spend runs somewhat higher than the scenes you actually see.
|
||||
|
||||
**4. Image proxy (optional)**
|
||||
|
||||
By default the browser fetches images directly from the provider — no setup needed; leave `NEXT_PUBLIC_IMAGE_PROXY_URL` blank and you're completely unaffected. You only want this if you hit progressive "top-to-bottom" image loading (Chrome's `ERR_QUIC_PROTOCOL_ERROR` on some networks paints partial PNGs row by row): deploy a tiny Cloudflare Worker that re-fetches images server-side and serves them atomically over HTTP/2. One-click deploy at **[infiplot-image-proxy](https://github.com/zonghaoyuan/infiplot-image-proxy)**, then paste the `workers.dev` URL it prints into `NEXT_PUBLIC_IMAGE_PROXY_URL`.
|
||||
|
||||
---
|
||||
|
||||
## Roadmap
|
||||
|
||||
Reference in New Issue
Block a user