Skip to main content

Module app_files

Module app_files 

Source
Expand description

The Chess lab training app (web/chess, built with its wasm engine), served as static files under /app/ from CHESS_APP_DIR.

Serving it from this server puts the app and the API on one origin, so signing in, photo reading and the position dictionary need no cross-origin calls. The app caches itself for offline use with a service worker; the page and the service worker are always revalidated so a new release reaches phones on their next visit.

Functions§

bare
GET /app: on to /app/, so relative links resolve inside it.
file
GET /app/{*path}.
index
GET /app/.
resolve
The file for a URL path inside the app, or None if the path tries to leave the app directory or names something hidden.
theme
GET /app/theme.css: the deployment’s look (CHESS_APP_THEME: a bundled theme’s name, CSS, or a file of it), empty when there is none.
wants_html
Whether a request for / came from a browser (rather than an API client), so it can be sent to the app.