whiskers.git / web / worker / README.md
1# worker
2
3The Cloudflare Worker, `whiskers-web`. It serves one page and the few things the page asks for,
4keeps nothing and asks nobody anything.
5
6| Route | What |
7| --- | --- |
8| `GET /` | The page. `?mascot=ginger\|grey\|bunny` pre-selects who is on stage; a value that is not a mascot is Ginger. |
9| `GET /cat.css`, `/favicon.svg`, `/robots.txt` | Its files. The stylesheet is the cat's keyframes, named by content and cached for good. |
10| `GET /ui.css`, `/ui.js`, `/datastar.js`, `/fonts/*` | The shared look's files, from `jev-ui`'s embedded bytes (`jev_ui::asset`); a request carrying the right `?v=` is cached for good. |
11| `POST /mood`, `/mascot`, `/tick`, `/tour` | The demo: Datastar posts the page's signals; the answer is the cat, its caption, the stages it is busy with, the mood pills (the one the tour is on carries an hourglass and a countdown bar) and the tour button, as HTML to morph in, and new signals. On load the page posts `/tour` once (unless the visitor asked for less motion) so the server starts the tour. |
12| `/preview/card.png` | A static asset built by `../tools/preview`, served by Cloudflare before this code runs. |
13| `/preview/loop.mp4` | The link preview's video, built the same way but run through the Worker first (`run_worker_first`) so it answers byte ranges (`Accept-Ranges`, `206`, `416`), which Discord, Twitter and iOS rely on and static assets do not give. It is read through the `ASSETS` binding and sliced in `src/media.rs`; which bytes is `site::range`. |
14
15Every response carries a strict Content-Security-Policy (nothing from elsewhere), and HTML says
16`no-transform` so Cloudflare does not add its analytics script. Invocation logs are off.
17
18Run it as described in [`../README.md`](../README.md). `wrangler.toml` holds the route
19`whiskers.lmjtfy.fun` as a Workers custom domain (workers.dev stays on too); it is inert until someone deploys.
20
21| Path | What |
22| --- | --- |
23| [src/](src/) | The code. |
24| [wrangler.toml](wrangler.toml) | The Worker's configuration, route and asset directory. |
25| `public/preview/` | Generated, gitignored: the preview files. |