From d98146d76b9339221899e893765c708445585003 Mon Sep 17 00:00:00 2001 From: Seiya KONNO Date: Sat, 31 Oct 2026 16:03:42 +0900 Subject: [PATCH 1/3] test(embed): scope the play-mode spec's Pause button to the controls bar The picture is a Pause button too, so the HUD-wide locator matched two elements and failed in strict mode. --- packages/app-play/e2e/embed.spec.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/app-play/e2e/embed.spec.ts b/packages/app-play/e2e/embed.spec.ts index cf6478b2d..99eac7bc4 100644 --- a/packages/app-play/e2e/embed.spec.ts +++ b/packages/app-play/e2e/embed.spec.ts @@ -89,7 +89,9 @@ test('?mode=play lets the viewer play: no seeking, and M is a lane rather than m await expect(hud.getByRole('button', { name: 'Unmute' })).toBeAttached(); await page.keyboard.press('KeyM'); await play.click(); - await expect(hud.getByRole('button', { name: 'Pause', exact: true })).toBeAttached({ timeout: 30_000 }); + // The picture is a Pause button too: ask the controls bar's. + const controls = hud.locator('be-music-playback-controls'); + await expect(controls.getByRole('button', { name: 'Pause', exact: true })).toBeAttached({ timeout: 30_000 }); await expect(hud.getByRole('slider', { name: 'Seek' })).toBeDisabled(); await page.keyboard.press('KeyM'); await expect(hud.getByRole('button', { name: 'Mute', exact: true })).toBeAttached(); From afcbc07d6a6efad1714ad1466cafdfe8369e299e Mon Sep 17 00:00:00 2001 From: Seiya KONNO Date: Sat, 31 Oct 2026 17:14:49 +0900 Subject: [PATCH 2/3] fix(worker-play): let the browser revalidate proxied archives instead of downloading them again /__url-load-proxy answered no-store and dropped the upstream's validators, so every embed ?track= (and player ?music=) load from another origin downloaded the whole archive. Move the proxy into url-load-proxy.ts, answer no-cache, and pass ETag / Last-Modified and If-None-Match / If-Modified-Since through, so an unchanged archive comes back as a 304. --- .changeset/url-load-proxy-revalidate.md | 5 ++ docs/player-web.ja.md | 2 +- docs/player-web.md | 2 +- packages/worker-play/src/index.ts | 51 +------------ .../worker-play/src/url-load-proxy.test.ts | 74 ++++++++++++++++++ packages/worker-play/src/url-load-proxy.ts | 75 +++++++++++++++++++ 6 files changed, 157 insertions(+), 52 deletions(-) create mode 100644 .changeset/url-load-proxy-revalidate.md create mode 100644 packages/worker-play/src/url-load-proxy.test.ts create mode 100644 packages/worker-play/src/url-load-proxy.ts diff --git a/.changeset/url-load-proxy-revalidate.md b/.changeset/url-load-proxy-revalidate.md new file mode 100644 index 000000000..6fd373c09 --- /dev/null +++ b/.changeset/url-load-proxy-revalidate.md @@ -0,0 +1,5 @@ +--- +'@be-music/worker-play': patch +--- + +An embed `?track=` or player `?music=` archive from another origin was downloaded in full on every load, because `/__url-load-proxy` answered `no-store` and dropped the host's validators. The proxy now answers `no-cache` and passes `ETag` / `Last-Modified` and the browser's `If-None-Match` / `If-Modified-Since` through, so an unchanged archive comes back as a 304 from the browser's cache. diff --git a/docs/player-web.ja.md b/docs/player-web.ja.md index 8c6d471a2..042cc97bb 100644 --- a/docs/player-web.ja.md +++ b/docs/player-web.ja.md @@ -875,7 +875,7 @@ PixiJS scene wiring は browser rendering や WebAudio resource に依存する ## 埋め込みプレビュー -`/embed/?track=`(`play.be-music.app`、プレビュー環境は `play.preview.be-music.app`)は、譜面のアーカイブを iframe の中でプレビューする。`@be-music/app-play` の 2 つ目のエントリ(`embed/index.html`、`src/embed/`)で、同じ Worker が配信する。Worker は iframe では自動サインインを始めない。アーカイブは `?music=` と同じく、同じオリジンからは直接、別の https オリジンからは `/__url-load-proxy` を経由して取得する。 +`/embed/?track=`(`play.be-music.app`、プレビュー環境は `play.preview.be-music.app`)は、譜面のアーカイブを iframe の中でプレビューする。`@be-music/app-play` の 2 つ目のエントリ(`embed/index.html`、`src/embed/`)で、同じ Worker が配信する。Worker は iframe では自動サインインを始めない。アーカイブは `?music=` と同じく、同じオリジンからは直接、別の https オリジンからは `/__url-load-proxy` を経由して取得する。ブラウザはアーカイブを保存し、読み込むたびに再検証する。プロキシは `no-cache` を付け、配信元の `ETag` / `Last-Modified` とブラウザの条件付きリクエストを中継するので、変わっていないアーカイブはダウンロードし直さない。どちらの検証子も送らない配信元からは毎回ダウンロードする。 ```html