Skip to content

fix: MSDOS games fail to launch in console mode ("Error for site owner / Check console")#3294

Merged
gantoine merged 2 commits intomasterfrom
copilot/fix-msdos-games-launch-issue
Apr 20, 2026
Merged

fix: MSDOS games fail to launch in console mode ("Error for site owner / Check console")#3294
gantoine merged 2 commits intomasterfrom
copilot/fix-msdos-games-launch-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

dosbox_pure (MSDOS) requires SharedArrayBuffer for 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]+/play without those headers. Combined with the console Game.vue using 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:

    map $request_uri $coep_header {
        default        "";
        ~^/rom/.*/ejs$ "require-corp";
        ~^/console/rom/[0-9]+/play "require-corp";   # added
    }
  • frontend/src/console/views/Game.vue — make play() async, await router.push(…), then call router.go(0) to force a full HTTP request so nginx delivers the isolation headers. Mirrors the identical pattern already used in PlayBtn.vue.

  • frontend/src/console/views/Play.vue — add onUnmounted(() => window.location.reload()) to drop the cross-origin isolated context when the game session ends. Mirrors the identical teardown already in the normal Player.vue.

Copilot AI changed the title [WIP] Fix MSDOS games failing to launch in console mode fix: MSDOS games fail to launch in console mode ("Error for site owner / Check console") Apr 20, 2026
Copilot AI requested a review from gantoine April 20, 2026 18:09
@gantoine gantoine marked this pull request as ready for review April 20, 2026 20:40
Copilot AI review requested due to automatic review settings April 20, 2026 20:40
@gantoine gantoine merged commit 64ea056 into master Apr 20, 2026
11 checks passed
@gantoine gantoine deleted the copilot/fix-msdos-games-launch-issue branch April 20, 2026 20:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 353 to +385
@@ -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);
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +22
~^/console/rom/[0-9]+/play "require-corp";
}
map $request_uri $coop_header {
default "";
~^/rom/.*/ejs$ "same-origin";
~^/console/rom/[0-9]+/play "same-origin";
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(?:$|\?).

Suggested change
~^/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";

Copilot uses AI. Check for mistakes.
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.

[Bug] MSDOS games fail to launch in "console mode" – "error for site owner check console"

3 participants