Enhance postcard puzzles and narration
This commit is contained in:
@@ -17,6 +17,12 @@ friends its HTTPS URL. The directory must contain `index.html`, `main.dart.js`,
|
||||
`index.html` directly from the filesystem. No application backend, database,
|
||||
Node.js server or Apple account is needed.
|
||||
|
||||
Do not serve the repository's `web/` directory with an IDE live server. Its
|
||||
`flutter_bootstrap.js` is a Flutter build template, not executable output;
|
||||
serving it directly produces `flutter_js is not defined`. Build the app first
|
||||
and serve `build/web/`, or use `flutter run -d chrome`. Deploy all files from
|
||||
the same build together and reload if an old bootstrap is cached.
|
||||
|
||||
The default build is for the root of a website, for example
|
||||
`https://play.example.com/`. If you want a subdirectory such as
|
||||
`https://example.com/lumen/`, rebuild with:
|
||||
@@ -39,8 +45,33 @@ fallback page. Keep the directory
|
||||
layout intact. Everything needed at runtime, including Flutter’s renderer,
|
||||
fonts and recordings, is included; there is no dependency on a font/renderer CDN.
|
||||
|
||||
### Content Security Policy
|
||||
|
||||
The Flutter build compiles WebAssembly for its renderer. If the host sends a
|
||||
Content Security Policy, its `script-src` must permit WebAssembly compilation;
|
||||
in current browsers, `'wasm-unsafe-eval'` grants that permission without also
|
||||
allowing JavaScript string evaluation through `eval()` or `new Function()`.
|
||||
For example, this is a starting policy for the standalone, same-origin build:
|
||||
|
||||
```text
|
||||
Content-Security-Policy: default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; font-src 'self' data:; connect-src 'self'; media-src 'self' blob:; worker-src 'self' blob:
|
||||
```
|
||||
|
||||
Configure the policy on the hosting server; this project does not set a CSP
|
||||
itself. Adapt and test it for the actual host and embedding environment. Multiple
|
||||
policies are enforced together, so adding a permissive policy in `index.html`
|
||||
cannot override a stricter server header. Older browsers may not support
|
||||
`'wasm-unsafe-eval'`; check the browsers you intend to support. Avoid adding the
|
||||
broader `'unsafe-eval'` unless it is required and its security tradeoff is
|
||||
acceptable.
|
||||
|
||||
If DevTools reports a warning from `contentscript.js`, inspect its full URL:
|
||||
an extension URL (such as `chrome-extension://...`) identifies browser extension
|
||||
code, not code in the game. Recheck in a clean browser profile with extensions
|
||||
disabled before attributing an extension's deprecation or CSP warning to Lumen.
|
||||
|
||||
For updates, replace the whole build together. Serve `index.html`,
|
||||
`flutter_bootstrap.js`, `flutter.js`, and `main.dart.js` with
|
||||
`flutter_bootstrap.js`, `flutter.js`, `narration.js`, and `main.dart.js` with
|
||||
`Cache-Control: no-cache`. Use revalidation for assets too unless you version
|
||||
their URLs. This build does not install an offline service worker. Testers need
|
||||
a connection to load new pages, pictures and recordings.
|
||||
@@ -48,9 +79,11 @@ a connection to load new pages, pictures and recordings.
|
||||
## Tell your testers
|
||||
|
||||
- Open the link in Safari on iPhone/iPad or Chrome on Android/computer.
|
||||
- Choose a book from the shelf. Tap **Play this reading** on a narrated page to
|
||||
hear the recorded voices if your browser blocks the automatic three-second
|
||||
start. Pause, replay and speed controls remain available. Atmosphere depends on the browser permitting audio.
|
||||
- Choose a book from the shelf. Your first tap prepares the narrator for the
|
||||
automatic three-second start on story pages and postcards. Some browsers or
|
||||
embedded WebViews may still require you to tap **Play this reading**. Pause,
|
||||
replay and speed controls remain available. Atmosphere depends on the browser
|
||||
permitting audio.
|
||||
- Tap puzzle cells to cycle empty → light → crossed out. **Hint** offers a
|
||||
confirmed, explained deduction without an advertisement.
|
||||
- Bookmarks, puzzle marks, reading position and settings stay in that browser.
|
||||
@@ -99,3 +132,17 @@ For the Astro-hosted game, pass its `/lumen/play/` URL instead. Override
|
||||
`CHROME_DEBUG_URL` if the debugger uses another port. The test creates its own
|
||||
fresh browser context and checks the actual playing media URL after Next,
|
||||
Previous and rapid page turns, without touching existing tabs or saved games.
|
||||
|
||||
## Checking browser narration
|
||||
|
||||
`node scripts/test_web_narration.mjs` checks the audio bridge in headless
|
||||
Chromium with autoplay blocked until a real user gesture. It requires a built
|
||||
web bundle and uses the locally cached Chromium by default; set `CHROME_BIN` to
|
||||
use another binary. For the full Flutter path, serve `build/web` on
|
||||
`127.0.0.1:18765`, then run `node scripts/test_web_app_autoplay.mjs` and
|
||||
`LUMEN_POSTCARD=1 node scripts/test_web_app_autoplay.mjs`, and
|
||||
`LUMEN_MIDNIGHT=1 node scripts/test_web_app_autoplay.mjs`. These exercise the
|
||||
lighthouse notebook and a leaf turn, a collected postcard in an isolated browser
|
||||
profile, and the Midnight Invitation opening. Each checks that the correct
|
||||
recording actually starts. These Chromium checks do not replace testing on iOS Safari or
|
||||
an embedding app's WebView.
|
||||
|
||||
Reference in New Issue
Block a user