From 681efc6a46b8d2b9c07cb8e8c13abe9b65416f41 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Apr 2026 18:08:38 +0000 Subject: [PATCH] fix: enable COEP/COOP headers for console play route to fix MSDOS games Agent-Logs-Url: https://github.com/rommapp/romm/sessions/487d4506-1203-499e-afc4-a45ee1f2438b Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com> --- docker/nginx/templates/default.conf.template | 4 +++- frontend/src/console/views/Game.vue | 7 +++++-- frontend/src/console/views/Play.vue | 6 ++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docker/nginx/templates/default.conf.template b/docker/nginx/templates/default.conf.template index 330831aa5..8ccd10865 100644 --- a/docker/nginx/templates/default.conf.template +++ b/docker/nginx/templates/default.conf.template @@ -9,15 +9,17 @@ map $http_x_forwarded_proto $forwardscheme { } # COEP and COOP headers for cross-origin isolation, which are set only for the -# EmulatorJS player path, to enable SharedArrayBuffer support, which is needed +# EmulatorJS player paths, to enable SharedArrayBuffer support, which is needed # for multi-threaded cores. map $request_uri $coep_header { default ""; ~^/rom/.*/ejs$ "require-corp"; + ~^/console/rom/[0-9]+/play "require-corp"; } map $request_uri $coop_header { default ""; ~^/rom/.*/ejs$ "same-origin"; + ~^/console/rom/[0-9]+/play "same-origin"; } server { diff --git a/frontend/src/console/views/Game.vue b/frontend/src/console/views/Game.vue index 4c20761c4..ad0f7420e 100644 --- a/frontend/src/console/views/Game.vue +++ b/frontend/src/console/views/Game.vue @@ -350,7 +350,7 @@ function handleAction(action: InputAction): boolean { } } -function play() { +async function play() { if (!rom.value) return; romApi @@ -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); } const currentStateId = computed( diff --git a/frontend/src/console/views/Play.vue b/frontend/src/console/views/Play.vue index 19889083d..3c5e5be9e 100644 --- a/frontend/src/console/views/Play.vue +++ b/frontend/src/console/views/Play.vue @@ -5,6 +5,7 @@ import { computed, onMounted, onBeforeUnmount, + onUnmounted, ref, watch, nextTick, @@ -737,6 +738,11 @@ onBeforeUnmount(() => { detachKey?.(); detachPad?.(); }); + +onUnmounted(() => { + // Force full reload to reset COEP/COOP, so cross-origin isolation is turned off. + window.location.reload(); +});