diff --git a/tdkpin-rs/CHANGELOG.md b/tdkpin-rs/CHANGELOG.md index 1b4066f..88533a8 100644 --- a/tdkpin-rs/CHANGELOG.md +++ b/tdkpin-rs/CHANGELOG.md @@ -10,6 +10,8 @@ and this project adheres to ### Fixed +- Bundle the official Macroquad browser loader and WASM bootstrap locally so a + CSP does not require inline JavaScript or code from `not-fl3.github.io`. - Add the optional same-origin Axum/SQLite high-score service, browser fetch/submit integration, and an nginx reverse-proxy example. Browser settings retain their local-storage fallback, while the shared table is diff --git a/tdkpin-rs/web/README.md b/tdkpin-rs/web/README.md index 7e50cdc..710bfe4 100644 --- a/tdkpin-rs/web/README.md +++ b/tdkpin-rs/web/README.md @@ -11,9 +11,14 @@ The game is compiled for `wasm32-unknown-unknown` and loaded into a fixed a fallback copy of the high-score table are saved in `localStorage`; native builds continue to use their normal per-user save file. -The page uses Macroquad's official browser loader from the miniquad samples -site. The web page must be served over HTTP rather than opened directly from a -`file:` URL. +The page includes the official Macroquad browser loader locally. The WASM +bootstrap is local as well, so the page does not require inline or third-party +JavaScript. The web page must be served over HTTP rather than opened directly +from a `file:` URL. + +For a strict Content Security Policy, allow `script-src 'self' +'wasm-unsafe-eval'` for the browser's WebAssembly compilation and +`connect-src 'self'` for the local WASM and optional high-score API requests. When the same-origin `/api/highscores` endpoint is available, the browser loads and submits the shared top-ten table there. The small Axum service and an nginx diff --git a/tdkpin-rs/web/bootstrap.js b/tdkpin-rs/web/bootstrap.js new file mode 100644 index 0000000..504f00f --- /dev/null +++ b/tdkpin-rs/web/bootstrap.js @@ -0,0 +1,3 @@ +"use strict"; + +load("tdkpin-rs.wasm"); diff --git a/tdkpin-rs/web/index.html b/tdkpin-rs/web/index.html index 56965b4..3979ea2 100644 --- a/tdkpin-rs/web/index.html +++ b/tdkpin-rs/web/index.html @@ -46,10 +46,8 @@
- + - +