Conversation
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/487d4506-1203-499e-afc4-a45ee1f2438b Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes MSDOS (dosbox_pure) launch failures in console mode by ensuring the /console/rom/:rom/play route runs in a cross-origin isolated context (COEP/COOP headers) and by forcing hard reloads so the browser actually receives (and later drops) those headers.
Changes:
- Extend nginx COEP/COOP header maps to include
/console/rom/[0-9]+/play. - In console
Game.vue, force a full reload after navigating to the play route so the response includes isolation headers. - In console
Play.vue, force a full reload on unmount to exit cross-origin isolation after the session ends.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docker/nginx/templates/default.conf.template | Adds COEP/COOP header mapping for the console play route. |
| frontend/src/console/views/Game.vue | Forces hard reload after routing to console play so isolation headers are applied. |
| frontend/src/console/views/Play.vue | Forces hard reload on teardown to drop cross-origin isolation after exiting play. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -375,11 +375,14 @@ function play() { | |||
| if (origin.id) query.id = Number(origin.id); | |||
| if (origin.collection) query.collection = Number(origin.collection); | |||
|
|
|||
| router.push({ | |||
| await router.push({ | |||
| name: ROUTES.CONSOLE_PLAY, | |||
| params: { rom: rom.value.id }, | |||
| query: Object.keys(query).length ? query : undefined, | |||
| }); | |||
| // Force full reload to retrieve COEP/COOP headers from nginx, | |||
| // required to enable multi-threading in EmulatorJS (e.g., for dosbox_pure/MSDOS). | |||
| router.go(0); | |||
There was a problem hiding this comment.
play() now forces a full page reload via router.go(0). Because romApi.updateUserRomProps(..., updateLastPlayed: true) is currently fire-and-forget, the pending PUT can be aborted by the reload, so last_played may not get updated reliably. Consider awaiting that request (or sending it via a keepalive/beacon-style call) before triggering the reload.
| ~^/console/rom/[0-9]+/play "require-corp"; | ||
| } | ||
| map $request_uri $coop_header { | ||
| default ""; | ||
| ~^/rom/.*/ejs$ "same-origin"; | ||
| ~^/console/rom/[0-9]+/play "same-origin"; |
There was a problem hiding this comment.
The new map $request_uri regex for /console/rom/[0-9]+/play isn’t anchored, so it will also match unintended prefixes (e.g. /console/rom/123/playground). Consider tightening it to only match the exact play route (optionally allowing query strings), e.g. ^/console/rom/[0-9]+/play(?:$|\?).
| ~^/console/rom/[0-9]+/play "require-corp"; | |
| } | |
| map $request_uri $coop_header { | |
| default ""; | |
| ~^/rom/.*/ejs$ "same-origin"; | |
| ~^/console/rom/[0-9]+/play "same-origin"; | |
| ~^/console/rom/[0-9]+/play(?:$|\?) "require-corp"; | |
| } | |
| map $request_uri $coop_header { | |
| default ""; | |
| ~^/rom/.*/ejs$ "same-origin"; | |
| ~^/console/rom/[0-9]+/play(?:$|\?) "same-origin"; |
dosbox_pure(MSDOS) requiresSharedArrayBufferfor multi-threading, which browsers gate behind Cross-Origin Isolation (COEP: require-corp+COOP: same-origin). The nginx COEP/COOP maps only matched/rom/.*/ejs(normal player), leaving the console play path/console/rom/[0-9]+/playwithout those headers. Combined with the consoleGame.vueusing SPA navigation without a subsequent hard reload, the emulator never received a cross-origin isolated context and failed immediately.Changes
docker/nginx/templates/default.conf.template— extend COEP/COOP header maps to also match/console/rom/[0-9]+/play:frontend/src/console/views/Game.vue— makeplay()async,await router.push(…), then callrouter.go(0)to force a full HTTP request so nginx delivers the isolation headers. Mirrors the identical pattern already used inPlayBtn.vue.frontend/src/console/views/Play.vue— addonUnmounted(() => window.location.reload())to drop the cross-origin isolated context when the game session ends. Mirrors the identical teardown already in the normalPlayer.vue.