mirror of
https://github.com/rommapp/romm.git
synced 2026-04-23 06:54:40 +00:00
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>
This commit is contained in:
committed by
GitHub
parent
ae9fb0b46e
commit
681efc6a46
@@ -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 {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user