Sync works on the deployed site; add reproducible build and deploy script

The Pages deployment is now the primary copy, so two things had to change:

- Hosted pages fall back to steam-sync.py on 127.0.0.1:8765 instead of
  refusing to sync. steam-sync.py now answers Chrome's Private Network
  Access preflight (Access-Control-Allow-Private-Network), which is what a
  public https page needs before it may call into localhost.
- The build sources lived in /tmp and would have been lost. They now live in
  build/, and build.py outputs to the repo root. deploy.sh rebuilds,
  commits and pushes in one step.

Editing index.html directly is no longer the workflow - edit build/ and run
./deploy.sh.
This commit is contained in:
Rain 2026-09-15 17:40:06 -04:00
parent 4d5545e6c5
commit a63606b5c8
17 changed files with 6120 additions and 18 deletions

View file

@ -11,11 +11,35 @@ A single-file, offline-friendly companion page for 100%-ing **Metal Gear Solid 2
| `index.html` | The whole guide. Self-contained — data, styles, logic and your progress all live in this one file. |
| `steam-sync.py` | Optional local helper. Serves this folder **and** proxies Steam achievement lookups so the page can auto-tick what you already own. |
| `steam-proxy-worker.js` | Optional Cloudflare Worker. Same job as the Python helper, but for when the page is **hosted** somewhere instead of run locally. |
| `build/` | The sources. `index.html` is generated from these, so edit here rather than in the built file. |
| `deploy.sh` | Rebuilds and pushes to `pages` in one step. |
## Hosting it (GitHub Pages, Netlify, Cloudflare Pages, Neocities…)
**This copy is deployed at <https://rain.pages.melonbread.xyz/la-li-lu-le-lo/>**, served from the `pages` branch of <https://git.melonbread.xyz/rain/la-li-lu-le-lo>.
### Updating the live site
```bash
./deploy.sh "what you changed"
```
That rebuilds `index.html` from `build/`, commits, and pushes to `pages`. The Pages site redeploys itself in about 15 seconds — no separate publish step.
**Edit the sources in `build/`, not the built `index.html`.** The built file is generated: `build/template.html` holds the page, `build/*_src.py` the written content, and `build/*.json` the extracted data (achievements, dog tags, maps, photo pins). `build/build.py` stitches them together.
### Steam sync on the deployed site
A hosted page cannot read Steam directly — the achievement page sends no CORS headers. So the deployed page talks to **`steam-sync.py` running on your own machine**:
```bash
nohup python3 ~/Desktop/la-li-lu-le-lo/steam-sync.py > /tmp/steam-sync.log 2>&1 &
```
Then sync just works on the Pages site. `steam-sync.py` answers the Private Network Access preflight that Chrome requires when a public page calls into `127.0.0.1`; without that header the request is blocked before it is sent. If the helper is not running you get a message saying so, and everything except sync still works.
If you would rather not keep the helper running, deploy `steam-proxy-worker.js` to Cloudflare and put its URL in `STEAM_PROXY` at the top of the page's script — `ALLOW_ORIGIN` in the Worker is already pinned to the Pages origin.
**The page itself hosts fine as-is.** It is one static HTML file with all the guide data, the 10 area maps and the colour coding baked in, and it stores progress in the browser's `localStorage`. Drop it in a repo, enable Pages, done. No build step, no dependencies.
Two things behave differently on a static host:
@ -71,7 +95,7 @@ Double-click `index.html`. Everything works except live Steam sync. Note that op
- It re-syncs automatically every time the page loads.
- Achievements you already own get a `STEAM ✓` badge and a blue edge, and are counted as done.
- Use the **⬇ Missing on Steam** filter on the Achievements tab to see only what is left.
- No profile is pre-filled in the public repo — type yours on the Steam Sync tab once and it is remembered in this browser.
- No profile is pre-filled in the public repo — type yours on the Steam Sync tab once and it is remembered in this browser (per origin, so the Pages site and a local copy keep separate memories).
**If it fails,** the page tells you why. The usual cause is a private profile:
Steam → your profile → **Edit Profile → Privacy Settings → Game details → Public**.