From bb2d7acfd9de5a93ce8852ef17b538483b848bd7 Mon Sep 17 00:00:00 2001 From: SITO Date: Sat, 2 May 2026 21:22:03 +0200 Subject: [PATCH] fix: add game-assets, maptiles, mapcache static mounts + frame-src CSP Without /game-assets mount the game iframes loaded 404. Without /maptiles mount the map tiles didn't render. frame-src 'self' CSP directive needed for iframe sandboxing. Co-Authored-By: Claude Sonnet 4.6 --- .../nodejs-project/src/client/middleware.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/nodejs-project/nodejs-project/src/client/middleware.js b/nodejs-project/nodejs-project/src/client/middleware.js index 46b8d45c..03d9d1d7 100644 --- a/nodejs-project/nodejs-project/src/client/middleware.js +++ b/nodejs-project/nodejs-project/src/client/middleware.js @@ -50,7 +50,19 @@ module.exports = ({ host, port, middleware, allowHost }) => { }); app.use(mount("/assets", assets)); - + + const maptiles = new Koa(); + maptiles.use(koaStatic(join(__dirname, "..", "maps", "tiles"))); + app.use(mount("/maptiles", maptiles)); + + const mapcache = new Koa(); + mapcache.use(koaStatic(join(__dirname, "..", "maps", "cache"))); + app.use(mount("/mapcache", mapcache)); + + const gamesStatic = new Koa(); + gamesStatic.use(koaStatic(join(__dirname, "..", "games"))); + app.use(mount("/game-assets", gamesStatic)); + // pdf viewer app.use(mount("/js", koaStatic(path.join(__dirname, 'public/js')))); app.use(koaStatic(path.join(__dirname, 'public'))); @@ -66,6 +78,7 @@ module.exports = ({ host, port, middleware, allowHost }) => { "img-src 'self'", "media-src 'self' blob:", "worker-src 'self' blob:", + "frame-src 'self'", "form-action 'self'", "object-src 'none'", "base-uri 'none'",