home-hosted 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/UI_CREATION.md CHANGED
@@ -66,7 +66,7 @@ cannot drift:
66
66
  | --- | --- |
67
67
  | **OpenAPI** | `GET /openapi/spec.json` (no session needed); browse it at `/openapi/ui` |
68
68
  | **Typed RPC** | inside this repo: `import type { AppType } from '@server/app'` + `hc<AppType>()`, as `uis/stock/src/lib/rpc.ts` does |
69
- | **Generated types** | `npx openapi-typescript http://127.0.0.1:3999/openapi/spec.json -o src/api.d.ts` |
69
+ | **Generated types** | `pnpm dlx openapi-typescript http://127.0.0.1:3999/openapi/spec.json -o src/api.d.ts` |
70
70
 
71
71
  `uis/stock/src/lib/api.ts` is the reference client: plain `fetch`, with ArkType validating the
72
72
  responses at runtime. Either style is fine.
@@ -79,6 +79,7 @@ responses at runtime. Either style is fine.
79
79
  | `GET /api/events` | **the live feed**: `hello` carries the full state, then `state`, `server`, `log` |
80
80
  | `GET /api/servers/:id/stream` | one server's `server` + `log` frames |
81
81
  | `POST /api/servers/:id/{start,stop,restart}`, `/api/servers/{start-all,stop-all}` | lifecycle |
82
+ | `POST /api/servers/:id/free-port` | ask whatever holds that server's port to stop (`403`-safe: supervised listeners are refused) |
82
83
  | `GET` / `POST /api/servers`, `PATCH` / `DELETE /api/servers/:id` | the entries themselves |
83
84
  | `GET /api/logs`, `/api/logs/:id?tail=&search=`, `/api/logs/:id/download?file=` | persisted logs |
84
85
  | `GET` / `PATCH /api/settings` | the panel's own config (`control.label`, host thresholds, backups, …) |
@@ -93,6 +94,11 @@ responses at runtime. Either style is fine.
93
94
  `GET /healthz` and `GET /openapi/*` are the only unauthenticated reads; the SPA shell itself is
94
95
  public, so your app can load before a session exists.
95
96
 
97
+ Anything calling the API from outside a browser — a script, a test, an agent, a native shell — can
98
+ skip the login dance with an API token: `home-hosted set-token --generate` prints one once, and
99
+ `Authorization: Bearer <token>` authenticates every `/api` request with the same authority as a
100
+ signed-in session. The browser app you ship should still use the cookie.
101
+
96
102
  Two settings worth reflecting: `control.label` is the panel's own name (the stock shell shows it),
97
103
  and `GET /api/settings` includes `ui` — which UI is being served, and its metadata.
98
104
 
@@ -143,8 +149,8 @@ Only `stock` ships inside the npm package; the rest are release assets you insta
143
149
  ```bash
144
150
  # 1. any static framework; the only requirement is a static output
145
151
  npm create vite@latest my-panel -- --template vue-ts
146
- cd my-panel && npm install
147
- npm run build # → dist/
152
+ cd my-panel && pnpm install
153
+ pnpm run build # → dist/
148
154
 
149
155
  # 2. keep the API base relative, then zip the build
150
156
  cd dist && zip -r ../my-panel.zip . && cd ..
@@ -153,8 +159,9 @@ cd dist && zip -r ../my-panel.zip . && cd ..
153
159
  ```
154
160
 
155
161
  Your client needs the session cookie, which the browser sends automatically once you log in on that
156
- origin. For local development `pnpm dev` runs the panel on 3999 and a Vite dev server on 3998 with
157
- `/api` proxied — point your own dev server at `http://127.0.0.1:3999` the same way.
162
+ origin (a non-browser client uses an API token instead, above). For local development `pnpm dev` runs
163
+ the panel on 3999 and a Vite dev server on 3998 with `/api` proxied — point your own dev server at
164
+ `http://127.0.0.1:3999` the same way.
158
165
 
159
166
  ## Checklist
160
167