diff --git a/frontend/src/utils/index.test.ts b/frontend/src/utils/index.test.ts index 95284baef..2475efe46 100644 --- a/frontend/src/utils/index.test.ts +++ b/frontend/src/utils/index.test.ts @@ -148,8 +148,7 @@ describe("isJsDosEmulationSupported", () => { }); describe("isJsDosBundle", () => { - const withExt = (fs_extension: string) => - makeRom({ fs_extension } as Partial); + const withExt = (fs_extension: string) => makeRom({ fs_extension }); it("accepts a .jsdos bundle regardless of case", () => { expect(isJsDosBundle(withExt("jsdos"))).toBe(true); diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts index 9ca29dfd9..de4cdd17b 100644 --- a/frontend/src/utils/index.ts +++ b/frontend/src/utils/index.ts @@ -702,9 +702,6 @@ export function isRuffleEmulationSupported( return ["flash", "browser"].includes(slug.toLowerCase()); } -/** File extension of a js-dos bundle. */ -export const JSDOS_BUNDLE_EXTENSION = "jsdos"; - /** * Check if js-dos emulation is supported for a given platform. * @@ -727,16 +724,14 @@ export function isJsDosEmulationSupported( /** * Check if a ROM file is a js-dos bundle. * - * js-dos boots only its own bundle format: an archive carrying - * `.jsdos/dosbox.conf`. Handed a bare game folder or a plain archive it panics - * with "Broken bundle", so the play routes gate on the extension rather than - * offering a player that cannot start. + * js-dos panics on anything that is not an archive carrying + * `.jsdos/dosbox.conf`. * * @param rom The ROM to check. * @returns True if the file is a js-dos bundle, false otherwise. */ export function isJsDosBundle(rom: SimpleRom | null | undefined) { - return rom?.fs_extension.toLowerCase() === JSDOS_BUNDLE_EXTENSION; + return rom?.fs_extension.toLowerCase() === "jsdos"; } export type PlayingStatus = diff --git a/frontend/src/v2/views/Player/JsDos.vue b/frontend/src/v2/views/Player/JsDos.vue index 0c2a51537..4e4dd112a 100644 --- a/frontend/src/v2/views/Player/JsDos.vue +++ b/frontend/src/v2/views/Player/JsDos.vue @@ -27,11 +27,9 @@ import { useSnackbar } from "@/v2/composables/useSnackbar"; import storeGalleryRoms from "@/v2/stores/galleryRoms"; import { isJsResource, loadScript } from "./scriptLoader"; -// The full image serves the runtime same-origin. Slim images and the dev -// server ship no local copy, so fall back to jsDelivr: it serves the same -// pinned dist with `cross-origin-resource-policy: cross-origin`, which the -// player's COEP requires. Keep the version in step with docker/Dockerfile. const JSDOS_LOCAL_BASE = "/assets/jsdos"; +// Fallback for slim images and the dev server, which ship no local copy. Pinned +// to the image's JSDOS_VERSION; jsDelivr sends the CORP the player's COEP needs. const JSDOS_CDN_BASE = "https://cdn.jsdelivr.net/npm/js-dos@8.4.1/dist"; // Where the runtime actually came from, so the emulator payloads follow it. diff --git a/frontend/src/v2/views/Player/scriptLoader.ts b/frontend/src/v2/views/Player/scriptLoader.ts index f6d3bb74d..ebfa46f6e 100644 --- a/frontend/src/v2/views/Player/scriptLoader.ts +++ b/frontend/src/v2/views/Player/scriptLoader.ts @@ -1,6 +1,5 @@ -// Shared runtime injection for the player views. EmulatorJS and js-dos both -// ship their runtime as a local asset in the full image and fall back to a CDN -// in slim images and under the dev server, which serve no local copy. +// Shared runtime injection for the player views. EmulatorJS and js-dos serve +// their runtime locally in the full image and fall back to a CDN without it. /** Inject a