Files

75 lines
2.5 KiB
Markdown

# FuelBoard Copy Editor
A tiny, self-contained web editor for FuelBoard's `Localizable.strings`,
running on the Mac Mini. Edit copy from the iPhone (Safari), save it straight
into the FuelBoard repo, or save **and** kick off an immediate Release build +
IPA.
## Why
All FuelBoard copy lives in `FuelBoard/en.lproj/Localizable.strings` (the
`Localizable.strings` refactor). This editor lets you tweak wording from the
phone without touching git, the Mac, or the build pipeline by hand — while the
Mac Mini repo stays the canonical source of truth and Gitea stays a backup.
## Run
```bash
./scripts/run.sh # port 8790 (or EDITOR_PORT)
```
Then on the phone (same Wi-Fi, or anywhere via Tailscale):
```
http://192.168.1.131:8790/
http://100.120.217.98:8790/
```
Enter the token once (kept in the browser's localStorage afterwards):
```bash
cat /Users/apt/workspace/fuelboard-editor/.token
```
Set `TOKEN=...` in the environment to pin your own.
## Endpoints
| Route | What it does |
|-------------|-----------------------------------------------------------|
| `GET /` | The editor page (no auth) |
| `GET /file` | Current strings file + git dirty/clean banner + section list |
| `POST /save`| Write the file, then `plutil -lint` it |
| `POST /save-build` | Write the file and start a background build job |
| `GET /job/<id>` | Job progress (polled by the page, 2 s) |
Auth: `X-Key: <token>` on every route except the HTML page.
## What a "Save & Build" does
1. writes `FuelBoard/en.lproj/Localizable.strings`
2. `plutil -lint` — aborts if the file is invalid
3. `xcodebuild` Release, unsigned (same command as the manual pipeline)
4. packages a fresh IPA to `/tmp/ipa-serve/FuelBoard.ipa`
5. serves it at `http://192.168.1.131:8765/FuelBoard.ipa`
The page polls the job and shows the build log live.
## Safety
- Only ever writes the one strings file — no arbitrary paths.
- It never commits or pushes: Gitea stays a backup, and commits happen
afterwards via the normal workflow once the copy is approved.
- One build at a time; the page shows the git dirty/clean state so you never
save over in-flight work.
- Token required for every write/build call.
## Layout
```
editor.py single-file server (stdlib only: http.server, subprocess)
index.html the editor page (mobile-first, dark)
scripts/run.sh launcher
.token auto-generated shared token (gitignored)
```