From 27b28430a5e98e1e04b59e169bae5df38d9069cd Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Wed, 3 Jun 2026 16:59:09 +0200 Subject: [PATCH] fix: bypass js-dos bundleUpdateConfig by providing config + initFs separately js-dos v8.3.8 calls bundleUpdateConfig which uses libzip WASM to re-add .jsdos/jsdos.json into the downloaded bundle. This fails on our bundles (Unable to add .jsdos/jsdos.json into bundle.zip). Fix: Instead of using { url } option (which triggers bundleUpdateConfig), fetch the config from a new API endpoint (/api/games/{id}/config) and pass it directly via { dosboxConf, jsdosConf, initFs }. This bypasses the broken bundleUpdateConfig entirely. Changes: - New GET /api/games/{id}/config endpoint (GameResource + GameService) - Exposed resolveCdImages/pickBestCdImage as package-private - Frontend Play.svelte: fetch config + bundle separately, use new API - Frontend api.js: new getGameConfig() function --- frontend/src/lib/api.js | 10 ++++ frontend/src/pages/Play.svelte | 26 ++++++-- src/main/java/com/dostalgia/GameResource.java | 14 +++++ src/main/java/com/dostalgia/GameService.java | 59 +++++++++++++++++++ .../java/com/dostalgia/UploadResource.java | 4 +- 5 files changed, 107 insertions(+), 6 deletions(-) diff --git a/frontend/src/lib/api.js b/frontend/src/lib/api.js index 447b596..3e12176 100644 --- a/frontend/src/lib/api.js +++ b/frontend/src/lib/api.js @@ -111,6 +111,16 @@ export function bundleUrl(game) { return `/games/${game.bundle_file}`; } +/** Get game config (dosbox.conf + jsdos.json) */ +export async function getGameConfig(id) { + const res = await fetch(`${BASE}/api/games/${id}/config`); + if (!res.ok) { + const err = await res.json().catch(() => ({ error: res.statusText })); + throw new Error(err.error || `HTTP ${res.status}`); + } + return res.json(); +} + /** Get game bundle URL for setup mode (runs SETUP.EXE instead) */ export function setupBundleUrl(game) { if (!game) return null; diff --git a/frontend/src/pages/Play.svelte b/frontend/src/pages/Play.svelte index 5604b66..549bd0a 100644 --- a/frontend/src/pages/Play.svelte +++ b/frontend/src/pages/Play.svelte @@ -1,5 +1,5 @@