| … | … | @@ -44,6 +44,8 @@ A single always-on peer: |
| 44 | 44 | them), verified and resumable — the same engine Mirall uses |
| 45 | 45 | - discoverable **by [hyperident](https://github.com/holepunchto) identity** — reach a peer by |
| 46 | 46 | a stable pubkey/petname (`dial --name`) instead of pasting a 256-bit invite |
| 47 | - optionally drives **Mirall's real React UI in a local browser** (`--web PORT`) — the same |
| 48 | renderer the desktop app uses, served on `127.0.0.1` only (see [Web-UI](#web-ui-optional)) |
| 47 | 49 | |
| 48 | 50 | ## Install (via pgh) |
| 49 | 51 | |
| … | … | @@ -52,6 +54,10 @@ pgh app install mirall # (once published to the registry) |
| 52 | 54 | pgh app start mirall # boots the daemon under the pgh supervisor |
| 53 | 55 | ``` |
| 54 | 56 | |
| 57 | The pgh-managed daemon starts with `daemon --web 4188` by default (`pgh.defaults.args` in |
| 58 | `package.json`), so once it's up the browser UI is at **http://127.0.0.1:4188** — no extra |
| 59 | step. See [Web-UI](#web-ui-optional). |
| 60 | |
| 55 | 61 | Or adopt a working tree directly: |
| 56 | 62 | |
| 57 | 63 | ```sh |
| … | … | @@ -77,6 +83,27 @@ mirall dial --name alice # fetch its invite + join |
| 77 | 83 | mirall mirror --space <id> --owner <key> --share <id> --path /srv/mirror |
| 78 | 84 | ``` |
| 79 | 85 | |
| 86 | ## Web-UI (optional) |
| 87 | |
| 88 | The daemon can serve **Mirall's real React UI** in a local browser — the same renderer the |
| 89 | desktop app ships, driving the same vendored engine. It is **not** a reimplementation; the |
| 90 | bundle under `web/dist/` is Mirall's, and `web/bridge-shim.js` recreates the `window.bridge` |
| 91 | API the renderer expects (standing in for Electron's preload bridge). |
| 92 | |
| 93 | ```sh |
| 94 | mirall daemon --web 4188 # serve the UI on http://127.0.0.1:4188 |
| 95 | ``` |
| 96 | |
| 97 | - **Localhost only.** The server binds `127.0.0.1` exclusively — the daemon holds the |
| 98 | identity, so the UI is never exposed on the network. There is no auth beyond that. |
| 99 | - **How it bridges to the engine:** the browser talks to the Bare worker over HTTP — |
| 100 | Server-Sent Events on `/worker/events` (worker → browser, base64 NDJSON frames) and |
| 101 | `POST /worker/write` (browser → worker). A local folder-picker (`/fs/list`) lets you |
| 102 | choose directories to share from the browser (it lists *your own* filesystem only). |
| 103 | - **On by default under pgh.** `pgh.defaults.args` is `["daemon", "--web", "4188"]`, so a |
| 104 | pgh-installed node comes up with the UI at http://127.0.0.1:4188. Run the daemon without |
| 105 | `--web` for a headless, CLI-only node. |
| 106 | |
| 80 | 107 | ## Layout |
| 81 | 108 | |
| 82 | 109 | | Path | What | |
| … | … | @@ -85,6 +112,7 @@ mirall mirror --space <id> --owner <key> --share <id> --path /srv/mirror |
| 85 | 112 | | `bin/mirall.js` | the CLI + daemon (our headless host) | |
| 86 | 113 | | `cli/host.js` | spawns the worker via `bare-sidecar` + drives its NDJSON IPC | |
| 87 | 114 | | `cli/e2e-mirror.js`, `cli/capstone-*.js` | two-node / cross-machine test harnesses | |
| 115 | | `web/` | **Mirall's React bundle** (`dist/`) + `bridge-shim.js` — served by `--web` (see [Web-UI](#web-ui-optional)) | |
| 88 | 116 | | `node_modules/` | **committed** — see below | |
| 89 | 117 | |
| 90 | 118 | ## ⚠️ Dependencies are vendored — do not `npm install` |