home-hosted 0.11.0 → 0.13.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/README.md +319 -628
- package/dist/chunks/archive-DP-XQR8X.js +352 -0
- package/dist/chunks/archive-DP-XQR8X.js.map +1 -0
- package/dist/chunks/atomic-C1PfJpE7.js +26 -0
- package/dist/chunks/atomic-C1PfJpE7.js.map +1 -0
- package/dist/chunks/backup-CZcVca2a.js +822 -0
- package/dist/chunks/backup-CZcVca2a.js.map +1 -0
- package/dist/chunks/backups-CFRaWe_m.js +4691 -0
- package/dist/chunks/backups-CFRaWe_m.js.map +1 -0
- package/dist/chunks/config-text-DifCHhnz.js +50 -0
- package/dist/chunks/config-text-DifCHhnz.js.map +1 -0
- package/dist/chunks/contracts-CMBD1TF9.js +2230 -0
- package/dist/chunks/contracts-CMBD1TF9.js.map +1 -0
- package/dist/chunks/daemon-log-BVj8cDEo.js +241 -0
- package/dist/chunks/daemon-log-BVj8cDEo.js.map +1 -0
- package/dist/chunks/daemon-qKVECISl.js +247 -0
- package/dist/chunks/daemon-qKVECISl.js.map +1 -0
- package/dist/chunks/docker-Cy9Lyvda.js +437 -0
- package/dist/chunks/docker-Cy9Lyvda.js.map +1 -0
- package/dist/chunks/down-pKbGCW9d.js +383 -0
- package/dist/chunks/down-pKbGCW9d.js.map +1 -0
- package/dist/chunks/init-BZ7hK9Vf.js +276 -0
- package/dist/chunks/init-BZ7hK9Vf.js.map +1 -0
- package/dist/chunks/last-stop-C-BXz_XI.js +53 -0
- package/dist/chunks/last-stop-C-BXz_XI.js.map +1 -0
- package/dist/chunks/layout-DwTtmund.js +24 -0
- package/dist/chunks/layout-DwTtmund.js.map +1 -0
- package/dist/chunks/lazy-Ce5zEAq1.js +66 -0
- package/dist/chunks/lazy-Ce5zEAq1.js.map +1 -0
- package/dist/chunks/log-buffer-Dy9HHDMD.js +414 -0
- package/dist/chunks/log-buffer-Dy9HHDMD.js.map +1 -0
- package/dist/chunks/logger-B5U4GD3j.js +13 -0
- package/dist/chunks/logger-B5U4GD3j.js.map +1 -0
- package/dist/chunks/logs---TI_bxM.js +267 -0
- package/dist/chunks/logs---TI_bxM.js.map +1 -0
- package/dist/chunks/migrate-Cfoq-Vgh.js +155 -0
- package/dist/chunks/migrate-Cfoq-Vgh.js.map +1 -0
- package/dist/chunks/nanny-B-Eu0sFW.js +132 -0
- package/dist/chunks/nanny-B-Eu0sFW.js.map +1 -0
- package/dist/chunks/nanny-BtWfy0QH.js +1167 -0
- package/dist/chunks/nanny-BtWfy0QH.js.map +1 -0
- package/dist/chunks/nanny-ChMtq1Zl.js +39 -0
- package/dist/chunks/nanny-ChMtq1Zl.js.map +1 -0
- package/dist/chunks/nanny-sweep-DErnlPY1.js +105 -0
- package/dist/chunks/nanny-sweep-DErnlPY1.js.map +1 -0
- package/dist/chunks/nearest-6KgQEDUe.js +41 -0
- package/dist/chunks/nearest-6KgQEDUe.js.map +1 -0
- package/dist/chunks/parse-DhmG26fI.js +383 -0
- package/dist/chunks/parse-DhmG26fI.js.map +1 -0
- package/dist/chunks/paths-CGlGDrOU.js +206 -0
- package/dist/chunks/paths-CGlGDrOU.js.map +1 -0
- package/dist/chunks/port-B8WBTRMk.js +333 -0
- package/dist/chunks/port-B8WBTRMk.js.map +1 -0
- package/dist/chunks/restart-Des4DrAN.js +92 -0
- package/dist/chunks/restart-Des4DrAN.js.map +1 -0
- package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/chunks/schema-B240VXcV.js +103 -0
- package/dist/chunks/schema-B240VXcV.js.map +1 -0
- package/dist/chunks/secrets-BieELnZh.js +562 -0
- package/dist/chunks/secrets-BieELnZh.js.map +1 -0
- package/dist/chunks/server-Bge2r2qQ.js +169 -0
- package/dist/chunks/server-Bge2r2qQ.js.map +1 -0
- package/dist/chunks/server-ids-DRuNLVCV.js +32 -0
- package/dist/chunks/server-ids-DRuNLVCV.js.map +1 -0
- package/dist/chunks/set-password-D5vZqqSX.js +43 -0
- package/dist/chunks/set-password-D5vZqqSX.js.map +1 -0
- package/dist/chunks/set-token-obPiEJYk.js +78 -0
- package/dist/chunks/set-token-obPiEJYk.js.map +1 -0
- package/dist/chunks/settings-xu-XTfWg.js +423 -0
- package/dist/chunks/settings-xu-XTfWg.js.map +1 -0
- package/dist/chunks/setup-temp-CAN4_bA-.js +150 -0
- package/dist/chunks/setup-temp-CAN4_bA-.js.map +1 -0
- package/dist/chunks/shape-DnTKzjQ2.js +24 -0
- package/dist/chunks/shape-DnTKzjQ2.js.map +1 -0
- package/dist/chunks/src-BtWMFmzZ.js +12338 -0
- package/dist/chunks/src-BtWMFmzZ.js.map +1 -0
- package/dist/chunks/status-DT1EsA-B.js +123 -0
- package/dist/chunks/status-DT1EsA-B.js.map +1 -0
- package/dist/chunks/ui-D562aqw5.js +325 -0
- package/dist/chunks/ui-D562aqw5.js.map +1 -0
- package/dist/chunks/ui-dir-CsU3uLNV.js +39 -0
- package/dist/chunks/ui-dir-CsU3uLNV.js.map +1 -0
- package/dist/chunks/ui-release-DKzVvlLd.js +312 -0
- package/dist/chunks/ui-release-DKzVvlLd.js.map +1 -0
- package/dist/chunks/ui-revert-EkBBwRTt.js +27 -0
- package/dist/chunks/ui-revert-EkBBwRTt.js.map +1 -0
- package/dist/chunks/ui-switch-BnZTdMDd.js +150 -0
- package/dist/chunks/ui-switch-BnZTdMDd.js.map +1 -0
- package/dist/chunks/ui-update-_xryLYxw.js +272 -0
- package/dist/chunks/ui-update-_xryLYxw.js.map +1 -0
- package/dist/chunks/up-Pdz-l6IH.js +210 -0
- package/dist/chunks/up-Pdz-l6IH.js.map +1 -0
- package/dist/chunks/usage-DFrCVXpT.js +111 -0
- package/dist/chunks/usage-DFrCVXpT.js.map +1 -0
- package/dist/chunks/workspaces-DYcfvKV_.js +229 -0
- package/dist/chunks/workspaces-DYcfvKV_.js.map +1 -0
- package/dist/chunks/wsl-temperature-BiCI4iK6.js +322 -0
- package/dist/chunks/wsl-temperature-BiCI4iK6.js.map +1 -0
- package/dist/cli.js +441 -25418
- package/dist/cli.js.map +1 -1
- package/dist/client.js +144 -0
- package/dist/client.js.map +1 -0
- package/dist/types/api/acme.d.ts +24 -0
- package/dist/types/api/auth/$.routes.d.ts +103 -0
- package/dist/types/api/backups.d.ts +184 -0
- package/dist/types/api/control.d.ts +470 -0
- package/dist/types/api/ddns.d.ts +432 -0
- package/dist/types/api/events.d.ts +22 -0
- package/dist/types/api/health.d.ts +28 -0
- package/dist/types/api/logs.d.ts +95 -0
- package/dist/types/api/metrics.d.ts +21 -0
- package/dist/types/api/notifications.d.ts +141 -0
- package/dist/types/api/proxy.d.ts +1128 -0
- package/dist/types/api/servers/$.routes.d.ts +1318 -0
- package/dist/types/api/settings.d.ts +642 -0
- package/dist/types/api/state.d.ts +498 -0
- package/dist/types/api/static.d.ts +11 -0
- package/dist/types/api/tls.d.ts +112 -0
- package/dist/types/api/workspaces/$.routes.d.ts +797 -0
- package/dist/types/api/wsl-temperature.d.ts +113 -0
- package/dist/types/app.d.ts +6095 -0
- package/dist/types/cli/args.d.ts +75 -0
- package/dist/types/cli/backup-offline.d.ts +23 -0
- package/dist/types/cli/backup.d.ts +86 -0
- package/dist/types/cli/down.d.ts +80 -0
- package/dist/types/cli/init.d.ts +60 -0
- package/dist/types/cli/io.d.ts +65 -0
- package/dist/types/cli/logs.d.ts +76 -0
- package/dist/types/cli/migrate.d.ts +33 -0
- package/dist/types/cli/nanny.d.ts +19 -0
- package/dist/types/cli/nearest.d.ts +10 -0
- package/dist/types/cli/restart.d.ts +41 -0
- package/dist/types/cli/server.d.ts +68 -0
- package/dist/types/cli/set-password.d.ts +14 -0
- package/dist/types/cli/set-token.d.ts +21 -0
- package/dist/types/cli/setup-temp.d.ts +65 -0
- package/dist/types/cli/status.d.ts +14 -0
- package/dist/types/cli/ui-revert.d.ts +3 -0
- package/dist/types/cli/ui-switch.d.ts +27 -0
- package/dist/types/cli/ui-update.d.ts +72 -0
- package/dist/types/cli/up.d.ts +96 -0
- package/dist/types/cli/usage.d.ts +23 -0
- package/dist/types/cli.d.ts +12 -0
- package/dist/types/client.d.ts +11891 -0
- package/dist/types/config/layout.d.ts +11 -0
- package/dist/types/config/migrations.d.ts +69 -0
- package/dist/types/config/parse.d.ts +54 -0
- package/dist/types/config/patch.d.ts +20 -0
- package/dist/types/config/schema.d.ts +318 -0
- package/dist/types/config/secret-parts.d.ts +48 -0
- package/dist/types/config/secrets.d.ts +208 -0
- package/dist/types/config/seed.d.ts +30 -0
- package/dist/types/config/server-ids.d.ts +14 -0
- package/dist/types/config/settings.d.ts +120 -0
- package/dist/types/config/store.d.ts +145 -0
- package/dist/types/config/workspaces.d.ts +99 -0
- package/dist/types/helpers/action-result.d.ts +46 -0
- package/dist/types/helpers/atomic.d.ts +9 -0
- package/dist/types/helpers/backoff.d.ts +7 -0
- package/dist/types/helpers/bind.d.ts +16 -0
- package/dist/types/helpers/config-text.d.ts +23 -0
- package/dist/types/helpers/cookies.d.ts +19 -0
- package/dist/types/helpers/copy-tree.d.ts +20 -0
- package/dist/types/helpers/daemon-log.d.ts +45 -0
- package/dist/types/helpers/daemon.d.ts +135 -0
- package/dist/types/helpers/deferred.d.ts +7 -0
- package/dist/types/helpers/env-file.d.ts +20 -0
- package/dist/types/helpers/error.d.ts +26 -0
- package/dist/types/helpers/event-stream.d.ts +21 -0
- package/dist/types/helpers/factory.d.ts +6 -0
- package/dist/types/helpers/last-stop.d.ts +20 -0
- package/dist/types/helpers/logger.d.ts +7 -0
- package/dist/types/helpers/open.d.ts +2 -0
- package/dist/types/helpers/openapi.d.ts +34 -0
- package/dist/types/helpers/paths.d.ts +112 -0
- package/dist/types/helpers/restore-lock.d.ts +32 -0
- package/dist/types/helpers/runtime.d.ts +18 -0
- package/dist/types/helpers/secret-compare.d.ts +13 -0
- package/dist/types/helpers/shell.d.ts +19 -0
- package/dist/types/helpers/sse.d.ts +23 -0
- package/dist/types/helpers/template.d.ts +8 -0
- package/dist/types/helpers/ui-dir.d.ts +11 -0
- package/dist/types/helpers/utf8-chunks.d.ts +15 -0
- package/dist/types/helpers/validate.d.ts +7 -0
- package/dist/types/helpers/validator.d.ts +12 -0
- package/dist/types/helpers/version.d.ts +10 -0
- package/dist/types/helpers/workspace.d.ts +25 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/middleware/auth.d.ts +53 -0
- package/dist/types/middleware/host.d.ts +29 -0
- package/dist/types/middleware/loopback.d.ts +18 -0
- package/dist/types/openapi-reference.d.ts +22 -0
- package/dist/types/openapi.d.ts +34 -0
- package/dist/types/providers/archive.d.ts +54 -0
- package/dist/types/providers/backup-hook.d.ts +34 -0
- package/dist/types/providers/ddns/cloudflare.d.ts +2 -0
- package/dist/types/providers/ddns/desec.d.ts +2 -0
- package/dist/types/providers/ddns/digitalocean.d.ts +2 -0
- package/dist/types/providers/ddns/duckdns.d.ts +2 -0
- package/dist/types/providers/ddns/dyndns2.d.ts +15 -0
- package/dist/types/providers/ddns/dynu.d.ts +2 -0
- package/dist/types/providers/ddns/freedns.d.ts +2 -0
- package/dist/types/providers/ddns/gandi.d.ts +2 -0
- package/dist/types/providers/ddns/godaddy.d.ts +2 -0
- package/dist/types/providers/ddns/henet.d.ts +3 -0
- package/dist/types/providers/ddns/index.d.ts +12 -0
- package/dist/types/providers/ddns/ip.d.ts +27 -0
- package/dist/types/providers/ddns/namecheap-api.d.ts +13 -0
- package/dist/types/providers/ddns/namecheap.d.ts +6 -0
- package/dist/types/providers/ddns/noip.d.ts +2 -0
- package/dist/types/providers/ddns/porkbun.d.ts +2 -0
- package/dist/types/providers/ddns/spaceship.d.ts +7 -0
- package/dist/types/providers/ddns/types.d.ts +98 -0
- package/dist/types/providers/ddns/zone.d.ts +11 -0
- package/dist/types/providers/docker.d.ts +117 -0
- package/dist/types/providers/entry-state.d.ts +15 -0
- package/dist/types/providers/health-check.d.ts +27 -0
- package/dist/types/providers/host.d.ts +147 -0
- package/dist/types/providers/identity.d.ts +54 -0
- package/dist/types/providers/log-tail.d.ts +56 -0
- package/dist/types/providers/nanny-sweep.d.ts +54 -0
- package/dist/types/providers/nanny.d.ts +104 -0
- package/dist/types/providers/port.d.ts +142 -0
- package/dist/types/providers/proc.d.ts +125 -0
- package/dist/types/providers/process.d.ts +78 -0
- package/dist/types/providers/proxy/caddy.d.ts +2 -0
- package/dist/types/providers/proxy/index.d.ts +7 -0
- package/dist/types/providers/proxy/types.d.ts +54 -0
- package/dist/types/providers/server-vars.d.ts +4 -0
- package/dist/types/providers/telegram.d.ts +74 -0
- package/dist/types/providers/ui-release.d.ts +113 -0
- package/dist/types/providers/webhook.d.ts +64 -0
- package/dist/types/providers/wsl-temperature.d.ts +65 -0
- package/dist/types/services/acme-challenge.d.ts +44 -0
- package/dist/types/services/auth.d.ts +177 -0
- package/dist/types/services/backups.d.ts +476 -0
- package/dist/types/services/config-watch.d.ts +40 -0
- package/dist/types/services/control-server.d.ts +58 -0
- package/dist/types/services/ddns.d.ts +72 -0
- package/dist/types/services/dependencies.d.ts +21 -0
- package/dist/types/services/events.d.ts +17 -0
- package/dist/types/services/exposure.d.ts +86 -0
- package/dist/types/services/history.d.ts +37 -0
- package/dist/types/services/host-monitor.d.ts +33 -0
- package/dist/types/services/init.d.ts +71 -0
- package/dist/types/services/log-buffer.d.ts +39 -0
- package/dist/types/services/log-files.d.ts +77 -0
- package/dist/types/services/log-relay.d.ts +35 -0
- package/dist/types/services/nanny.d.ts +14 -0
- package/dist/types/services/notifications.d.ts +124 -0
- package/dist/types/services/panel.d.ts +213 -0
- package/dist/types/services/proxy-certificates/certificates.d.ts +116 -0
- package/dist/types/services/proxy-config.d.ts +83 -0
- package/dist/types/services/proxy.d.ts +431 -0
- package/dist/types/services/state.d.ts +38 -0
- package/dist/types/services/supervisor/compose.d.ts +17 -0
- package/dist/types/services/supervisor/entry.d.ts +149 -0
- package/dist/types/services/supervisor/health.d.ts +56 -0
- package/dist/types/services/supervisor/output.d.ts +126 -0
- package/dist/types/services/supervisor/pending-load.d.ts +6 -0
- package/dist/types/services/supervisor/persistent.d.ts +58 -0
- package/dist/types/services/supervisor/port-preflight.d.ts +45 -0
- package/dist/types/services/supervisor/records.d.ts +118 -0
- package/dist/types/services/supervisor/spawn.d.ts +15 -0
- package/dist/types/services/supervisor/view.d.ts +4 -0
- package/dist/types/services/supervisor.d.ts +145 -0
- package/dist/types/services/tls.d.ts +48 -0
- package/dist/types/services/ui-update.d.ts +44 -0
- package/dist/types/services/ui.d.ts +50 -0
- package/dist/types/shared/action-outcome.d.ts +25 -0
- package/dist/types/shared/api-client.d.ts +351 -0
- package/dist/types/shared/backup-scope.d.ts +167 -0
- package/dist/types/shared/clone.d.ts +14 -0
- package/dist/types/shared/contracts.d.ts +4175 -0
- package/dist/types/shared/cpu-scale.d.ts +25 -0
- package/dist/types/shared/ddns-form.d.ts +75 -0
- package/dist/types/shared/endpoint.d.ts +8 -0
- package/dist/types/shared/error-message.d.ts +8 -0
- package/dist/types/shared/fields.d.ts +21 -0
- package/dist/types/shared/form-repair.d.ts +6 -0
- package/dist/types/shared/generated.d.ts +26 -0
- package/dist/types/shared/host-readings.d.ts +185 -0
- package/dist/types/shared/lazy.d.ts +4 -0
- package/dist/types/shared/live-frames.d.ts +22 -0
- package/dist/types/shared/live-series.d.ts +21 -0
- package/dist/types/shared/live-store.d.ts +72 -0
- package/dist/types/shared/patch-diff.d.ts +105 -0
- package/dist/types/shared/probe-latency.d.ts +25 -0
- package/dist/types/shared/proxy-form.d.ts +184 -0
- package/dist/types/shared/server-attention.d.ts +37 -0
- package/dist/types/shared/server-form.d.ts +121 -0
- package/dist/types/shared/server-key.d.ts +13 -0
- package/dist/types/shared/server-readings.d.ts +55 -0
- package/dist/types/shared/server-url.d.ts +43 -0
- package/dist/types/shared/shape.d.ts +17 -0
- package/dist/types/shared/stream-access.d.ts +20 -0
- package/dist/types/shared/ui-format.d.ts +89 -0
- package/docs/API.md +209 -0
- package/docs/BACKUPS.md +117 -0
- package/docs/CLI.md +95 -0
- package/docs/DDNS.md +11 -1
- package/docs/NOTIFICATIONS.md +7 -1
- package/docs/REVERSE_PROXY.md +9 -3
- package/docs/SECURITY.md +93 -0
- package/docs/SERVERS.md +141 -34
- package/docs/UI_CREATION.md +91 -291
- package/docs/demo/blank-host-restore.sh +4 -3
- package/package.json +22 -14
- package/uis/stock/dist/assets/CopyButton-BUBKRJyY.js +1 -0
- package/uis/stock/dist/assets/GlobalSettingsView-yYMcRWvt.js +1 -0
- package/uis/stock/dist/assets/LogViewer-DIliXy62.js +1 -0
- package/uis/stock/dist/assets/LogsView-B7Z-7RNg.js +1 -0
- package/uis/stock/dist/assets/Modal-DmKa5Qpp.js +39 -0
- package/uis/stock/dist/assets/ProxyView-DvZiNkwb.js +1 -0
- package/uis/stock/dist/assets/ServerDetailView-6idGT_EX.js +2 -0
- package/uis/stock/dist/assets/SettingsShell-CeGtleYI.js +1 -0
- package/uis/stock/dist/assets/SettingsView-BrhJIrmk.js +2 -0
- package/uis/stock/dist/assets/de-BRITeb0H.js +1 -0
- package/uis/stock/dist/assets/es-B2zIEssV.js +1 -0
- package/uis/stock/dist/assets/fr-s0ZOBEqh.js +1 -0
- package/uis/stock/dist/assets/index-C1MehbKy.css +2 -0
- package/uis/stock/dist/assets/index-CnBN54wF.js +15 -0
- package/uis/stock/dist/assets/ja-CU7MR85V.js +1 -0
- package/uis/stock/dist/assets/ko-tL5Me6d-.js +1 -0
- package/uis/stock/dist/assets/ru-92yrvkNJ.js +1 -0
- package/uis/stock/dist/assets/vi-CzvY16k2.js +1 -0
- package/uis/stock/dist/assets/zh-CN-DDwFW_uW.js +1 -0
- package/uis/stock/dist/index.html +3 -2
- package/uis/stock/dist/ui.json +3 -3
- package/docs/RESTORE_DEMO.md +0 -306
- package/uis/stock/dist/assets/de-0YLueNal.js +0 -1
- package/uis/stock/dist/assets/es-FCHhRmn2.js +0 -1
- package/uis/stock/dist/assets/fr-C69Z8o0z.js +0 -1
- package/uis/stock/dist/assets/index-Cok5msAO.css +0 -2
- package/uis/stock/dist/assets/index-KdyqrVv8.js +0 -53
- package/uis/stock/dist/assets/ja-Chz9YOqR.js +0 -1
- package/uis/stock/dist/assets/ko-CtXZ2x1l.js +0 -1
- package/uis/stock/dist/assets/ru-D_jE64xN.js +0 -1
- package/uis/stock/dist/assets/vi-sxSffss7.js +0 -1
- package/uis/stock/dist/assets/zh-CN-ChTpf29X.js +0 -1
package/docs/API.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# The API
|
|
2
|
+
|
|
3
|
+
Everything the panel does goes through one HTTP API, so anything you build — a custom UI, a TUI, a
|
|
4
|
+
desktop app, a script, an AI agent — can do it too. The stock UI is just one client of it.
|
|
5
|
+
|
|
6
|
+
- **Spec:** `GET /openapi/spec.json` (OpenAPI 3, no session needed), browsable at `/openapi/ui`.
|
|
7
|
+
It is generated from the same schemas the server validates with, so it cannot drift.
|
|
8
|
+
- **Live data:** server-sent events on `GET /api/events`.
|
|
9
|
+
- **Base URL:** wherever the panel listens — `http://127.0.0.1:3999` by default.
|
|
10
|
+
|
|
11
|
+
## Authenticating
|
|
12
|
+
|
|
13
|
+
| Client | Credential |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| A browser UI served by the panel | the `hh_session` cookie from `POST /api/auth/login` |
|
|
16
|
+
| Anything else | `Authorization: Bearer <token>` from `home-hosted set-token --generate` |
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
home-hosted set-token --generate # printed once; only its hash is stored
|
|
20
|
+
curl -H "Authorization: Bearer hh_…" http://127.0.0.1:3999/api/state
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or, signed in from anywhere: **Global settings → Authentication → Generate token**, which is
|
|
24
|
+
`POST /api/auth/token` (a session is required — a token cannot mint its successor) and returns the
|
|
25
|
+
token once; `DELETE /api/auth/token` revokes it. A `401` with `code: "AUTH_REQUIRED"` means "show
|
|
26
|
+
your login screen". The token never expires.
|
|
27
|
+
|
|
28
|
+
While no password is in force (authentication off, or on with none set yet), `/api` answers only
|
|
29
|
+
this machine — a loopback request with no forwarding header — or the token. Anything else, including
|
|
30
|
+
a request relayed by a proxy on the same host, is `401 AUTH_DISABLED_REMOTE` (auth off) or
|
|
31
|
+
`401 AUTH_UNARMED` (auth on, no password): set a password first. `POST /api/auth/logout` needs no
|
|
32
|
+
credential, so a browser whose session already expired can still clear its cookie.
|
|
33
|
+
|
|
34
|
+
> [!WARNING]
|
|
35
|
+
> **A token is full admin.** It can create and start a server entry, and an entry runs any command
|
|
36
|
+
> as the user running the panel. Treat it like that user's password. A few operations are still
|
|
37
|
+
> refused to a token (`403 SESSION_REQUIRED`) — clearing the password, switching authentication off,
|
|
38
|
+
> minting or revoking an API token, setting the *first* password (only this machine may), installing
|
|
39
|
+
> a custom UI, and restoring an archive that carries the panel's own credentials — so a script
|
|
40
|
+
> cannot do those *by accident*, but they are not a security boundary against someone holding the
|
|
41
|
+
> token.
|
|
42
|
+
|
|
43
|
+
### Hosts and origins
|
|
44
|
+
|
|
45
|
+
- **`Host` must name this panel.** An IP address, `localhost`, a single-label name (`homeserver`)
|
|
46
|
+
or a local suffix (`.local`, `.lan`, `.home.arpa`, `.internal`, …) is always accepted. A public
|
|
47
|
+
name is accepted only when a reverse-proxy route serves the panel on it, or it is listed in
|
|
48
|
+
`control.allowedHosts` (`"*.example.com"` matches subdomains). Anything else is `421
|
|
49
|
+
HOST_NOT_ALLOWED`. This is what stops a malicious web page from reaching the panel through DNS
|
|
50
|
+
rebinding.
|
|
51
|
+
- **A cookie-authenticated write must be same-origin.** A non-GET request carrying a different
|
|
52
|
+
`Origin` is `403 CROSS_ORIGIN`. A request authenticated with a **bearer token** is exempt — a
|
|
53
|
+
browser never attaches one by itself, so it cannot be a forged request. That is what lets a
|
|
54
|
+
desktop app, whose requests carry their own `Origin`, use the API.
|
|
55
|
+
- **No CORS headers are sent.** A web page on another origin cannot read the API; a desktop shell
|
|
56
|
+
(Tauri, Electron) should call it from its native/main process with a token.
|
|
57
|
+
|
|
58
|
+
## Workspaces
|
|
59
|
+
|
|
60
|
+
Workspace-scoped routes take `?workspace=<id>`. Omitting it means the panel's default workspace; an
|
|
61
|
+
unknown id is `404 UNKNOWN_WORKSPACE`, never a fallback. **Query keys a route does not declare are
|
|
62
|
+
refused** (`400 INVALID_INPUT`, naming the key) — a typo like `?worspace=staging` must not act on
|
|
63
|
+
the default workspace. That includes cache-busters.
|
|
64
|
+
|
|
65
|
+
A server id is unique only inside its workspace: key anything you store by `(workspaceId, serverId)`.
|
|
66
|
+
|
|
67
|
+
## Errors
|
|
68
|
+
|
|
69
|
+
Every failure is one JSON envelope with a stable `code` to branch on:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{ "message": "unknown server \"web\"", "code": "UNKNOWN_SERVER", "detail": {} }
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`detail` is present only when there is structure to report (validation issues, conflicting routes).
|
|
76
|
+
A refused lifecycle action (`start`, `stop`, `restart`) also carries `ok: false` and `error` (the same
|
|
77
|
+
text as `message`) for older clients. Status codes: `400` bad input, `401` no credential, `403`
|
|
78
|
+
forbidden for this credential or origin, `404` unknown id, `409` the entry cannot do that now (or
|
|
79
|
+
`CONFIG_CHANGED_ON_DISK`: the config file was edited since the panel read it — it reloads, so retry),
|
|
80
|
+
`413` too large, `421` unknown host, `502` the reverse-proxy engine or its download failed.
|
|
81
|
+
A body that is not valid JSON is `400 INVALID_INPUT`, like any other rejected input. A path under
|
|
82
|
+
`/api`, `/_hh` or `/openapi` that matches no route — or any non-`GET` request that matches none — is
|
|
83
|
+
`404 NOT_FOUND` in the same envelope, never the UI's `index.html`.
|
|
84
|
+
|
|
85
|
+
## Endpoints
|
|
86
|
+
|
|
87
|
+
✅ takes `?workspace=<id>`; everything else is panel-wide. The spec documents every `/api`, `/_hh`
|
|
88
|
+
and `/healthz` operation with its body and responses — the two documents that describe it
|
|
89
|
+
(`/openapi/spec.json` and `/openapi/ui`) are served but not listed in it.
|
|
90
|
+
|
|
91
|
+
| Endpoint | What it is | |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| `GET /api/state` | the whole snapshot: settings, every workspace and server, host vitals | |
|
|
94
|
+
| `GET /api/events` | the live feed (below) | ✅ optional |
|
|
95
|
+
| `GET`/`POST /api/workspaces`, `PATCH`/`DELETE /api/workspaces/:id` | the workspace registry | |
|
|
96
|
+
| `GET`/`POST /api/servers` | one workspace's entries | ✅ |
|
|
97
|
+
| `GET`/`PUT`/`PATCH`/`DELETE /api/servers/:id` | one entry. `PUT` is create-or-replace (201, then 200): the idempotent form for config management. It writes config only — restart to apply | ✅ |
|
|
98
|
+
| `POST /api/servers/:id/{start,stop,restart,free-port,clear-logs}` | lifecycle; `free-port` asks whatever holds the port to stop (a supervised holder is refused) | ✅ |
|
|
99
|
+
| `POST /api/servers/{start-all,stop-all}` | the whole workspace (`?withPersistent=true` includes persistent entries) | ✅ |
|
|
100
|
+
| `GET /api/servers/:id/logs`, `GET /api/servers/:id/stream` | buffered lines; one server's SSE (replays its last 200 lines first) | ✅ |
|
|
101
|
+
| `GET /api/logs`, `/api/logs/:id?tail=&search=`, `/api/logs/:id/download` | log files on disk | ✅ |
|
|
102
|
+
| `GET`/`PATCH /api/settings` | panel-wide settings: listener, auth, TLS, host vitals, backups, UI | |
|
|
103
|
+
| `GET`/`PATCH /api/settings/workspace` | server defaults, log retention, notifications | ✅ |
|
|
104
|
+
| `GET`/`PUT /api/ddns`, `PUT`/`DELETE /api/ddns/credentials/:id`, `POST /api/ddns/check` | dynamic DNS | ✅ |
|
|
105
|
+
| `PUT`/`DELETE /api/notifications/destinations/:id/token`, `POST …/{test,detect-chats}`, `POST /api/notifications/test-webhook` | notification credentials and test sends | ✅ |
|
|
106
|
+
| `GET`/`PATCH /api/proxy`, `POST /api/proxy/{engine,start,stop,apply,revert}`, `PUT`/`DELETE /api/proxy/certificates/:id` | the reverse proxy | |
|
|
107
|
+
| `GET`/`POST /api/backups`, `POST /api/backups/restore`, `GET /api/backups/:name/download` | archives; `GET` is the selection model, fetch it when a dialog opens. `POST /api/backups` creates at once; a restore only plans unless `?confirm=true` | |
|
|
108
|
+
| `POST`/`DELETE /api/settings/ui`, `POST`/`DELETE /api/settings/tls` | install a UI zip / a PEM pair | |
|
|
109
|
+
| `POST /api/auth/login`, `GET /api/auth/session`, `POST /api/auth/logout`, `POST`/`DELETE /api/auth/password` | the session and the password | |
|
|
110
|
+
| `POST`/`DELETE /api/auth/token` | generate (session only, shown once) or revoke the API token | |
|
|
111
|
+
| `GET`/`POST`/`DELETE /api/host/temperature` | the WSL2 temperature bridge: whether a helper is installed, install one, remove it (`supported: false` off WSL — hide the control) | |
|
|
112
|
+
| `GET /api/metrics` | Prometheus text | |
|
|
113
|
+
| `GET /healthz` | **no credential**: `200`/`503` and uptime; per-server counts with a session, the API token, or the local `run.json` token from this machine; to a caller on this machine, `home` — a fingerprint of the state directory, so the CLI can tell this home's panel from another one sharing the port | |
|
|
114
|
+
|
|
115
|
+
An entry body is **partial**: send only the fields the person chose, and the workspace's server
|
|
116
|
+
defaults fill the rest. Sending a default explicitly freezes it against later default changes.
|
|
117
|
+
|
|
118
|
+
## Live events
|
|
119
|
+
|
|
120
|
+
`GET /api/events` is a standard SSE stream. Browsers use `EventSource` (cookie auth); anything else
|
|
121
|
+
reads it with a streaming `fetch` and the bearer header.
|
|
122
|
+
|
|
123
|
+
| `event:` | `data:` |
|
|
124
|
+
| --- | --- |
|
|
125
|
+
| `hello` | `{ ts, state }` — always first: the complete snapshot |
|
|
126
|
+
| `state` | `{ ts, state }` — something changed |
|
|
127
|
+
| `server` | `{ ts, workspaceId, serverId, server }` — one entry |
|
|
128
|
+
| `log` | `{ ts, workspaceId, serverId, lines }` — new output |
|
|
129
|
+
| `ping` | the time, every 15 s |
|
|
130
|
+
|
|
131
|
+
A stream is authorised when it opens **and** re-checked on every ping and whenever credentials
|
|
132
|
+
change (sign-out, a password set, changed or cleared, the token rotated, auth settings saved): once
|
|
133
|
+
the caller would no longer be let in, the panel ends the stream, and the reconnect meets the usual
|
|
134
|
+
`401`. The re-check does not count as activity, so an open stream does not keep an idle session
|
|
135
|
+
alive.
|
|
136
|
+
|
|
137
|
+
`state.settingsError` is `{ message, path }` while the panel-wide `settings.json` cannot be applied
|
|
138
|
+
(the running settings are kept), `null` when it is fine, and absent on an older panel. A workspace's
|
|
139
|
+
own config problem is `configError` on that workspace.
|
|
140
|
+
|
|
141
|
+
Query: `?workspace=<id>` narrows `server`/`log` frames to one workspace, `&serverId=<id>` to one
|
|
142
|
+
server of it — of the **default** workspace when `workspace` is omitted, since ids repeat across
|
|
143
|
+
workspaces (an unknown workspace is `404`) — and `?logs=0` drops log frames. A slow client never makes the panel buffer without bound: queued
|
|
144
|
+
`state` and `server` frames are replaced by newer ones, and log frames are dropped once too many are
|
|
145
|
+
waiting — so treat every snapshot as complete, and logs as best-effort (the log routes have the
|
|
146
|
+
full history).
|
|
147
|
+
|
|
148
|
+
## Metrics
|
|
149
|
+
|
|
150
|
+
`GET /api/metrics` is Prometheus text behind the same credential as every `/api` route — scrape it
|
|
151
|
+
with a bearer token. Every series is a gauge; none ends in `_total`. A series with no reading is
|
|
152
|
+
**absent**, never `0`, so do not let a dashboard fill gaps with zero. `hh_host_cpu_used_percent`
|
|
153
|
+
(0–100) is the CPU figure to alert on; `hh_host_load1_per_cpu` is runnable tasks per core.
|
|
154
|
+
`hh_server_restarts` is the current crash streak (reset by a manual start), so compare it directly
|
|
155
|
+
rather than through `rate()`. `hh_server_uptime_ratio_24h` is the share of the last 24 hours a server
|
|
156
|
+
was up **measured over the time the panel observed it**, so a server added ten minutes ago and up
|
|
157
|
+
throughout reads `1`, not `0.0069`.
|
|
158
|
+
|
|
159
|
+
## Compatibility
|
|
160
|
+
|
|
161
|
+
- Fields are only ever **added** to responses and frames, and a new field is optional — read
|
|
162
|
+
defensively, ignore what you do not know. Event names do not change.
|
|
163
|
+
- Request bodies are strict: an undeclared key is a `400`, so a typo is never silently ignored.
|
|
164
|
+
- `GET /api/state` → `version` is the panel's release.
|
|
165
|
+
|
|
166
|
+
## The TypeScript client
|
|
167
|
+
|
|
168
|
+
`home-hosted/client` ships in the package: a ~2 KB gzipped runtime over `hono/client`, typed from the
|
|
169
|
+
panel's own route table — every path, parameter, body and response — plus the event stream.
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
import { createClient, HomeHostedError } from 'home-hosted/client'
|
|
173
|
+
|
|
174
|
+
const hh = createClient({ baseUrl: 'http://127.0.0.1:3999', token: process.env.HH_TOKEN })
|
|
175
|
+
|
|
176
|
+
const { servers } = await hh.json(hh.api.servers.$get({ query: { workspace: 'default' } }))
|
|
177
|
+
await hh.json(hh.api.servers[':id'].restart.$post({ param: { id: 'web' }, query: {} }))
|
|
178
|
+
|
|
179
|
+
for await (const frame of hh.events({ workspace: 'default', logs: false })) {
|
|
180
|
+
if (frame.type === 'server')
|
|
181
|
+
console.log(frame.serverId, frame.server.status) // narrowed by `type`
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
`hh.json(...)` returns the body or throws a `HomeHostedError` (`status`, `code`, `detail`). `hh.api`
|
|
186
|
+
is the raw Hono client rooted at `/api`, for when you want the `Response`; `hh.rpc` is the same client
|
|
187
|
+
at the root (`hh.rpc.healthz.$get()`). Pass `fetch` to use your own (tests, custom TLS).
|
|
188
|
+
With a `token`, `createClient` refuses a `baseUrl` that is plain `http` to anything but this machine
|
|
189
|
+
(`localhost`, `127.x`, `::1`) — the token is full admin and would cross the network readable. Use
|
|
190
|
+
https, or pass `allowInsecureToken: true` for a network you trust end to end.
|
|
191
|
+
Types such as `AppState`, `ServerView` and `SseMessage` are exported too. The client and the panel
|
|
192
|
+
should come from the same release: the types describe the routes of the version they shipped with.
|
|
193
|
+
|
|
194
|
+
## Generating a client in another language
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
pnpm dlx openapi-typescript http://127.0.0.1:3999/openapi/spec.json -o src/home-hosted.d.ts
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Any OpenAPI generator works: the document declares `bearerAuth`, gives every error a body and every
|
|
201
|
+
2xx a schema. Inside this repository the UIs call the published client instead — `@shared/api-client`,
|
|
202
|
+
which both UIs import and which validates each response against the same ArkType schema the route
|
|
203
|
+
validates its request with.
|
|
204
|
+
|
|
205
|
+
## For an AI agent
|
|
206
|
+
|
|
207
|
+
Give it the token, `/openapi/spec.json`, `home-hosted status --json` (where everything lives) and
|
|
208
|
+
[SERVERS.md](./SERVERS.md) (how an entry is declared). That is enough to run a home server without
|
|
209
|
+
guessing.
|
package/docs/BACKUPS.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Backups
|
|
2
|
+
|
|
3
|
+
One `.zip` holds the panel and the workspaces you pick — settings, servers, secrets and the data
|
|
4
|
+
each entry declares — and puts it back, on this machine or a blank one. Plain, or AES-256 with a
|
|
5
|
+
password. **Global settings → Backups**, or the CLI:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
home-hosted backup list
|
|
9
|
+
home-hosted backup create --all --confirm
|
|
10
|
+
home-hosted backup create --all --exclude global:secrets --confirm
|
|
11
|
+
home-hosted backup restore <name> --all --confirm
|
|
12
|
+
home-hosted backup restore --from /media/usb/x.zip --all --confirm
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Both work with the panel **stopped**, which is when you usually need them. Without `--confirm` they
|
|
16
|
+
plan first: at a terminal they ask, and without one (cron, CI) they print the plan and exit 1, so an
|
|
17
|
+
unattended job never mistakes a plan for a backup. `--json` without `--confirm` is just the plan.
|
|
18
|
+
The local channel the CLI uses plans by default too (`POST /_hh/backups` and `/_hh/backups/restore`
|
|
19
|
+
answer a plan unless `confirm=true`); over `/api`, `POST /api/backups` creates at once, and a restore
|
|
20
|
+
plans unless `?confirm=true`.
|
|
21
|
+
|
|
22
|
+
## What an archive holds
|
|
23
|
+
|
|
24
|
+
Selection is two-level: whole workspaces, or single pieces of one.
|
|
25
|
+
|
|
26
|
+
| id | what |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| `global:settings`, `global:secrets`, `global:tls` | panel-wide settings, the password/token hashes, the TLS pair |
|
|
29
|
+
| `workspace:<id>:settings` · `:servers` · `:secrets` | a workspace's settings, its `servers.config.json`, its notification/DDNS credentials |
|
|
30
|
+
| `workspace:<id>:secrets:<name>` | one secret, restored on its own |
|
|
31
|
+
| `workspace:<id>:data:<path>` | one declared data directory |
|
|
32
|
+
|
|
33
|
+
A data directory is anything an entry declares in `dataEnvs` or `backupPaths`. Generated
|
|
34
|
+
directories inside them (`node_modules`, `dist`, `.next`, caches) are skipped unless the entry sets
|
|
35
|
+
`backupIgnoreGenerated: false`. A symlink that leads **outside** a declared path is not followed —
|
|
36
|
+
declare its target instead — and file permission bits travel (`0600` stays `0600`). A declared path
|
|
37
|
+
that is *itself* a symlink (`data -> /mnt/disk/data`) is the data: its target is captured, and a
|
|
38
|
+
restore writes back into that target. A declared path that ends up holding no files (a mount that
|
|
39
|
+
was not up) is still archived, with a warning in the create result and on the CLI's stderr. Each
|
|
40
|
+
declared path gets its own place in the archive, however alike two names read (`/srv/app-data`,
|
|
41
|
+
`/srv/app/data`); archives written before that still restore.
|
|
42
|
+
|
|
43
|
+
## Automatic backups
|
|
44
|
+
|
|
45
|
+
A schedule writes one archive every N hours, named `auto-…`, with its own retention. `Keep` bounds
|
|
46
|
+
the archives you take by hand; a scheduled pass never prunes those. Only archives the panel wrote
|
|
47
|
+
are ever pruned — another tool's zips in the same directory are left alone. A scheduled pass is
|
|
48
|
+
skipped while a restore is running. Age is read from the archive's name, not its file date, so
|
|
49
|
+
copying archives between disks does not change which are newest or which get pruned. The panel
|
|
50
|
+
remembers when the last scheduled archive was written; an `auto-…` file dropped into the directory
|
|
51
|
+
by hand is noticed after the next restart.
|
|
52
|
+
|
|
53
|
+
What a schedule captures:
|
|
54
|
+
|
|
55
|
+
| Mode | Carries | CLI spelling |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| **Everything** *(default)* | every workspace, plus `includePaths` — including workspaces added later | `--all` |
|
|
58
|
+
| **Only these** | only what you tick | `--include <ids>` |
|
|
59
|
+
| **Everything except** | everything but what you tick, including workspaces added later | `--all --exclude <ids>` |
|
|
60
|
+
|
|
61
|
+
## Restoring
|
|
62
|
+
|
|
63
|
+
Start a **blank** home-hosted anywhere, upload the archive, restore. Workspaces the target has never
|
|
64
|
+
seen are created, data lands where *this* machine's config says, and `autostart` entries come up.
|
|
65
|
+
|
|
66
|
+
- **Paths match by declaration**, not by the source machine's absolute path: `{projectDir}`,
|
|
67
|
+
`{dataRoot}` and `{home}` follow the restoring panel; a literal absolute path stays that path.
|
|
68
|
+
- **A restore never writes where no config declares**, and never across workspaces.
|
|
69
|
+
- **Older archives are lifted** through the same migrations `home-hosted migrate` runs; an archive
|
|
70
|
+
from a *newer* release is refused.
|
|
71
|
+
- **One secret merges by field** — restoring the Telegram token leaves DDNS credentials alone, and
|
|
72
|
+
excluding one secret keeps the local copy of it.
|
|
73
|
+
- **The password and token hashes are secrets too.** Restoring them reinstates the old machine's
|
|
74
|
+
credentials. Leave `global:secrets` unticked, or rotate afterwards (`set-token --generate`).
|
|
75
|
+
- **The plaintext first-run password is never archived** — only its hash, which is all a restore
|
|
76
|
+
needs.
|
|
77
|
+
- **DDNS credentials are sealed under `HHOSTED_DDNS_SECRET`**, which is not in the archive. Use the
|
|
78
|
+
same value on the new host, or re-enter them.
|
|
79
|
+
|
|
80
|
+
### What comes back
|
|
81
|
+
|
|
82
|
+
| | Restored | Still yours to do |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| Panel settings, workspaces, servers, defaults | ✅ | restart the panel if the listener or TLS changed (the plan says so) |
|
|
85
|
+
| Declared data directories | ✅ | see the database note below |
|
|
86
|
+
| Notification and DDNS config | ✅ | DDNS credentials need the same `HHOSTED_DDNS_SECRET` |
|
|
87
|
+
| Password and API token | per secret | leave unticked, or rotate |
|
|
88
|
+
| Reverse-proxy routes | ✅ | certificates are reissued; re-upload a `manual` pair |
|
|
89
|
+
| Reverse-proxy engine | ❌ | reinstall it from Global settings → Reverse proxy |
|
|
90
|
+
| Logs, crash history, nanny state | ❌ | they describe the old box |
|
|
91
|
+
| An entry's `envFile` | ❌ | machine-local by design — copy it, or declare its directory in `backupPaths` |
|
|
92
|
+
| The panel's own environment (`HHOSTED_*`, `${ENV}` values) | ❌ | set them on the new host |
|
|
93
|
+
|
|
94
|
+
## Worked example
|
|
95
|
+
|
|
96
|
+
[`demo/blank-host-restore.sh`](./demo/blank-host-restore.sh) runs the whole move against real
|
|
97
|
+
panels in throwaway directories (it needs Docker): host A gets one MongoDB-backed entry with data,
|
|
98
|
+
an archive is taken with `backup create --all --exclude global:secrets --confirm`, host B starts
|
|
99
|
+
blank, and `backup restore --from <archive> --all --confirm` brings the workspace, the entry and its
|
|
100
|
+
data back — the script then reads the database on host B to prove it.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
docs/demo/blank-host-restore.sh # cleans up after itself; touches nothing of yours
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Databases
|
|
107
|
+
|
|
108
|
+
Data directories are copied file by file while servers keep running. That is fine for files and
|
|
109
|
+
most app data, but **not a consistent snapshot of a live database** — SQLite mid-transaction or a
|
|
110
|
+
Postgres data directory can be captured torn and fail to open later.
|
|
111
|
+
|
|
112
|
+
For a real database, either stop that entry around the backup, or declare `dump`/`load` hooks so
|
|
113
|
+
the engine itself writes the backup ([SERVERS.md](./SERVERS.md#dumping-a-database-for-backups)).
|
|
114
|
+
|
|
115
|
+
Restoring has the mirror-image hazard: data copied under a **running** server is replaced beneath a
|
|
116
|
+
live process. The plan names those entries (`Data was replaced under a running server`); stop them
|
|
117
|
+
before applying, or restart them after.
|
package/docs/CLI.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# The CLI
|
|
2
|
+
|
|
3
|
+
`home-hosted <command>`, or `hh <command>` once installed. `home-hosted <command> --help` (or
|
|
4
|
+
`home-hosted help <command>`) prints what a command takes, and a misspelled command or flag suggests
|
|
5
|
+
the one you meant. Every command and flag on one screen: the README's
|
|
6
|
+
[CLI section](../README.md#-cli). This page is the depth behind it.
|
|
7
|
+
|
|
8
|
+
## Rules every command follows
|
|
9
|
+
|
|
10
|
+
- A numeric flag must be a whole number (`--port 8000x` is refused, not read as 8000; `--lines` takes
|
|
11
|
+
1 or more, or `all`), and a flag a command cannot honour is refused rather than ignored.
|
|
12
|
+
- Server commands act in the panel's default workspace; `-w/--workspace <id>` picks another.
|
|
13
|
+
- Hints name the command as you ran it, `--home` included, so they can be pasted.
|
|
14
|
+
- Commands that only look — `status`, `logs`, `usage`, `backup list`, a backup plan — never create
|
|
15
|
+
state files. Whatever creates `.hh` first creates it `0700`.
|
|
16
|
+
- `up --port`/`--host` are saved to `settings.json`, so the next plain `up` binds the same way.
|
|
17
|
+
`restart` checks every `up` flag before it stops anything, and stops if `down` fails.
|
|
18
|
+
|
|
19
|
+
## Scripting
|
|
20
|
+
|
|
21
|
+
- `--json` prints **one JSON document on stdout, or nothing**; every refusal goes to stderr. Branch
|
|
22
|
+
on the exit code first, then the document. The one exception is a stream, which has no single
|
|
23
|
+
document: `logs --follow --json` prints **one object per line** (NDJSON), each `{ path, line }`, so
|
|
24
|
+
a consumer needs no out-of-band knowledge of which file it is reading.
|
|
25
|
+
- Piping into `head` or `grep -q` exits 0, not with a broken-pipe error, so `set -o pipefail` is safe.
|
|
26
|
+
- `start` and `restart <id>` wait to confirm the process stayed up, so `start web && curl …` works.
|
|
27
|
+
- `backup create`/`restore` never write without consent: at a terminal they ask, and without one they
|
|
28
|
+
print the plan and **exit 1** unless `--confirm` is given — a cron job without it fails loudly
|
|
29
|
+
instead of silently taking no backup. `--json` without `--confirm` is the plan request and exits 0.
|
|
30
|
+
|
|
31
|
+
## What `status` tells you
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
home-hosted <version>
|
|
35
|
+
status running
|
|
36
|
+
servers 3 of 3 up
|
|
37
|
+
pid 4242 · up 2h 14m
|
|
38
|
+
url http://127.0.0.1:3999 (http)
|
|
39
|
+
… project, state, log and per-server log paths
|
|
40
|
+
password k7mq-x2pd-9fh (only while the first-run password is in use)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`status --json` always carries `running` and `liveness`:
|
|
44
|
+
|
|
45
|
+
| `liveness` | Means |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `live` | the recorded pid is this panel |
|
|
48
|
+
| `unknown` | the pid is alive but the platform will not report its start time — counted as running |
|
|
49
|
+
| `gone` | nothing is running |
|
|
50
|
+
| `recycled` | the OS gave the recorded pid to another process; nothing is signalled |
|
|
51
|
+
|
|
52
|
+
- `running: true` with `"answering": false` means the process exists but does not respond — anything
|
|
53
|
+
that waits for the panel to *serve* should read `answering`.
|
|
54
|
+
- `exitedCleanly: true` (with `lastStopAt`) means someone ran `down`; `false` means it died.
|
|
55
|
+
- If `run.json` is missing but **this home's** panel answers on the configured port (its `/healthz`
|
|
56
|
+
says which home it serves), `status` reports `answeringWithoutRecord` and `down` refuses rather
|
|
57
|
+
than guess which process to stop. Anything else on that port — another home's panel, another
|
|
58
|
+
program — is `portTakenByOther`: `down` has nothing of this home to stop and exits 0, and `up` will
|
|
59
|
+
need another `--port`.
|
|
60
|
+
|
|
61
|
+
## Logs and usage
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
home-hosted logs # the panel's console: what it did, and anything it could not finish
|
|
65
|
+
home-hosted logs --follow # like tail -f
|
|
66
|
+
home-hosted logs web # one server's log
|
|
67
|
+
home-hosted logs api -w staging # a server in another workspace
|
|
68
|
+
home-hosted usage # what is eating the machine
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`logs` reads files directly, so it works when the panel is wedged. An id the workspace does not
|
|
72
|
+
declare is refused with a suggestion rather than answered with an empty log. In `usage`, a stopped
|
|
73
|
+
server shows a dash, never `0`. `STARTS` and `CRASH` cover the history window: `STARTS` counts start
|
|
74
|
+
events, so a long-lived server shows the start it got (usually `1`) rather than `0`, and a flapping
|
|
75
|
+
one climbs — which is what makes it visible while its live CPU and memory still look idle. It is
|
|
76
|
+
**not** the retry budget the panel shows on a server's card: that is `server.restarts`, the crashes
|
|
77
|
+
spent out of `restart.maxRetries` on the current sequence, which a deliberate start resets. `--json`
|
|
78
|
+
names the count `starts` for the same reason (a panel predating the rename sends `restarts`, and this
|
|
79
|
+
command reads either).
|
|
80
|
+
|
|
81
|
+
## Upgrading
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
home-hosted migrate --dry-run # what would change, writes nothing
|
|
85
|
+
home-hosted migrate # asks before each schema step, keeps a .bak beside each file
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Each config records the release and schema that wrote it. A newer release always reads an older
|
|
89
|
+
config, and keys it does not know are kept and reported, never reset. A config it cannot read — a
|
|
90
|
+
wrong value, a duplicate id, a newer schema — stops `up` with the exact problem instead of starting
|
|
91
|
+
with defaults. Per-release notes live in the
|
|
92
|
+
[release notes](https://github.com/NamesMT/home-hosted/releases).
|
|
93
|
+
|
|
94
|
+
**Coming from 0.6.x:** install the latest 0.7.x and run it once — it moves the state into `.hh/` —
|
|
95
|
+
then upgrade.
|
package/docs/DDNS.md
CHANGED
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Keep a list of hostnames pointed at this machine's public IP. The panel checks the address on an
|
|
4
4
|
interval and calls a provider only when it actually changed — restart-safe, because the last
|
|
5
|
-
confirmed address per hostname is kept in the workspace's
|
|
5
|
+
confirmed address per hostname, account and provider is kept in the workspace's
|
|
6
|
+
`.hh/<workspace>/.state/ddns.cache.json`. Saving an account's credentials forgets what that account had
|
|
7
|
+
confirmed, so the next pass writes its hostnames again. Editing a hostname's `proxied`, `ttl` or
|
|
8
|
+
`zone` counts as a change too: the next pass sends it even though the address is the same. Each
|
|
9
|
+
provider call has its own 30 s deadline, so one slow hostname cannot time out the rest of a long list.
|
|
10
|
+
|
|
11
|
+
A refusal retrying cannot fix — bad credentials, a hostname the provider does not know, an abuse
|
|
12
|
+
block — **stops** that hostname instead of retrying it every interval: its row stays an error marked
|
|
13
|
+
*stopped* until its hostname, account or credentials change, the settings are saved, or you run a
|
|
14
|
+
check. Detection only accepts a public address: private, CGNAT, documentation, benchmarking and
|
|
15
|
+
multicast ranges are refused, and each detector gets 10 seconds.
|
|
6
16
|
|
|
7
17
|
**Workspace Settings → Dynamic DNS** is the whole setup: add an account, paste its credentials, add
|
|
8
18
|
hostnames. The block is saved by the page's own **Save settings**, like every other section on it; the
|
package/docs/NOTIFICATIONS.md
CHANGED
|
@@ -103,7 +103,13 @@ survives. `${ENV}` expands in the URL and in the values, the same rule the rest
|
|
|
103
103
|
```
|
|
104
104
|
|
|
105
105
|
A literal token in a header works too, but it then lives in the workspace's `settings.json` — a plain
|
|
106
|
-
config file
|
|
106
|
+
config file, shown back on the settings page and carried by every backup of that workspace's settings.
|
|
107
|
+
Prefer the placeholder above (the variable is read from the panel's environment, so set it where the
|
|
108
|
+
panel starts), and treat that file as sensitive if you do use a literal.
|
|
109
|
+
|
|
110
|
+
A redirect from the receiver is **not followed**: following one would hand the headers above to
|
|
111
|
+
whatever address the receiver names, and could drop https for http. The send fails with the
|
|
112
|
+
`Location` it was pointed at — set the URL to that final address.
|
|
107
113
|
|
|
108
114
|
Two destinations cannot share an `id`: it keys a destination's throttle, its last-result record **and
|
|
109
115
|
a Telegram destination's bot token**, so a duplicate would make two behave as one. The save is
|
package/docs/REVERSE_PROXY.md
CHANGED
|
@@ -73,9 +73,9 @@ reported without a pid.
|
|
|
73
73
|
| `host` | The public hostname. A local-only name (`gitea.lan`, `box`, an IP) gets the engine's own CA instead of a public certificate. |
|
|
74
74
|
| `enabled` | A disabled route stays configured but is not served. |
|
|
75
75
|
| `target` | `server` (a supervised entry), `panel` (this control panel), `external` (any `host:port`). |
|
|
76
|
-
| `workspace` + `server` | For `target: "server"` — an id is only unique inside its workspace. The upstream address is resolved live; a stopped entry leaves the hostname dark and the page says so. |
|
|
76
|
+
| `workspace` + `server` | For `target: "server"` — an id is only unique inside its workspace. The upstream address is resolved live; a stopped entry leaves the hostname dark and the page says so, and the engine is re-applied when the entry comes up or goes down. |
|
|
77
77
|
| `url` | For `target: "external"`, e.g. `http://10.0.0.5:8080`. The port is optional: without one the scheme's own default is used (`:80` for `http:`, `:443` for `https:`). An `https://` upstream is dialled with TLS, and **its certificate is not verified** — a homelab upstream behind a self-signed certificate works, and so does an impostor. |
|
|
78
|
-
| `path` | Optional prefix, so one hostname can serve several apps. |
|
|
78
|
+
| `path` | Optional prefix, so one hostname can serve several apps. The longest matching prefix wins, whatever order the routes are listed in; a route with no path takes what is left. |
|
|
79
79
|
| `tls` | `auto` (default), `off`, `manual`. |
|
|
80
80
|
| `dnsAccount` | Optional `workspace/account` for a DNS-01 challenge, referencing a DNS account from Settings. Empty picks the workspace's only account that can write TXT records, so a single-account setup needs nothing here. |
|
|
81
81
|
|
|
@@ -90,6 +90,12 @@ panel route to `127.0.0.1`, which the panel's own guard reads as a local request
|
|
|
90
90
|
plain-HTTP route with no password set would serve the panel to anyone who reached that
|
|
91
91
|
hostname.
|
|
92
92
|
|
|
93
|
+
An `external` route whose upstream is the panel's own listener (`http://127.0.0.1:<panel port>`,
|
|
94
|
+
`localhost`, `[::1]`, `0.0.0.0`) is a panel route by another name, and is held to the same rule.
|
|
95
|
+
A restore is held to it too. If a running engine's panel routes stop meeting it (say a restore
|
|
96
|
+
removed the password), the engine keeps serving every other route and drops those, with the
|
|
97
|
+
reason shown as the proxy's error, until the rule is met again.
|
|
98
|
+
|
|
93
99
|
## HTTPS
|
|
94
100
|
|
|
95
101
|
| `tls` | What it means |
|
|
@@ -245,7 +251,7 @@ rather than adding a 151st record to a zone already at the limit.
|
|
|
245
251
|
| Verified against | **Caddy 2.11.6.** That is the release this build was tested with; a newer one is installed anyway, and the panel reports the version that actually arrived. A release that changes the JSON schema may need a panel update first. |
|
|
246
252
|
| Carries | The `acmeproxy` DNS provider, compiled in for every install so the binary does not depend on a setting. `DNS-01` is offered because of it; an engine installed by an older release is refused with *update the engine* rather than failing inside Caddy. |
|
|
247
253
|
| Installed at | `.hh/.proxy/bin/hh-caddy` + `engine.json` (version, URL, size, when). |
|
|
248
|
-
| Replaceable | Drop any `hh-caddy` build at that path and the panel runs it: it reports *a path configured by hand* and probes no version. Installing or updating is refused while the engine is up — **Stop** it first, because the binary is replaced on disk. |
|
|
254
|
+
| Replaceable | Drop any `hh-caddy` build at that path and the panel runs it: it reports *a path configured by hand* and probes no version. Installing or updating is refused while the engine is up — **Stop** it first, because the binary is replaced on disk. A download that does not report a version is discarded and the installed binary kept. |
|
|
249
255
|
| Runs as | A child of the panel's own nanny, exactly like a `persistent: true` entry. |
|
|
250
256
|
| Supervised by | The panel. The admin API is opened on the panel side only: a unix socket in a `0700` directory (loopback TCP plus Caddy's origin check on Windows). |
|
|
251
257
|
| Reloaded by | `POST /load` — atomic, and the revision that applied is kept on disk so a change can be reverted in one click (the first one has nothing to go back to). A reload onto a port a stranger holds is refused before the engine is touched, naming the pid when the OS will tell it and saying so when it will not, and the panel keeps reporting the ports the engine is really on. |
|
package/docs/SECURITY.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
**Safe out of the box.** The panel listens on `127.0.0.1` only, behind a password, and refuses to
|
|
4
|
+
listen anywhere else — or to be served through its own reverse proxy — until you set your own
|
|
5
|
+
password. Nothing is exposed until you decide it should be.
|
|
6
|
+
|
|
7
|
+
## The three things you actually have to do
|
|
8
|
+
|
|
9
|
+
1. **Set your own password before exposing the panel.** The first `up` generates a random one and
|
|
10
|
+
prints it; `home-hosted status` shows it again on the machine until you change it (Global
|
|
11
|
+
settings → Authentication, or `home-hosted set-password`). Then bind to `lan` — in the UI, the
|
|
12
|
+
config, or `up --host lan`. All three go through the same check.
|
|
13
|
+
2. **Treat an API token as the account it runs as.** A token can create and start server entries,
|
|
14
|
+
which run any command as the panel's user. Changing the password does *not* revoke it; rotate or
|
|
15
|
+
revoke it under Global settings → Authentication, or with `set-token --generate` / `--clear`.
|
|
16
|
+
3. **Forgot the password?** Run `home-hosted set-password` on the machine: it writes a new one to
|
|
17
|
+
the secrets file directly — no login needed — and the panel picks it up at once.
|
|
18
|
+
(`set-password --clear` removes the password without setting another: authentication stays on and
|
|
19
|
+
nobody can sign in, so only this machine and an API token reach the panel until one is set.)
|
|
20
|
+
|
|
21
|
+
## How a request is trusted
|
|
22
|
+
|
|
23
|
+
| Check | Rule |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| **Host** | must be an IP, `localhost`, a single-label or local-suffix name (`.local`, `.lan`, `.home.arpa`, …), a reverse-proxy route that serves the panel, or listed in `control.allowedHosts`. Otherwise `421`. This blocks DNS-rebinding attacks from web pages you visit. |
|
|
26
|
+
| **Origin** | a cookie-authenticated write from another origin is refused (`403 CROSS_ORIGIN`); cookies are `HttpOnly` and `SameSite=Strict`. Bearer-token requests are exempt — browsers never attach a token on their own. |
|
|
27
|
+
| **Credential** | a session cookie, or `Authorization: Bearer <token>`. |
|
|
28
|
+
| **"This machine"** | a request from a loopback address that carries **no** forwarding header — `Forwarded`, `X-Forwarded-For`, `X-Real-IP`, or the `X-Forwarded-Proto`/`-Host`/`-Port`/`-Prefix` family. Only such a request may set the first password, use the local control channel, or use `/api` without a credential while no password is in force (authentication off, or on with none set; anything else gets `401 AUTH_DISABLED_REMOTE` / `AUTH_UNARMED`). **This is a heuristic, not a guarantee.** It answers correctly for the panel's own reverse proxy (a loopback peer that adds none of those headers — which is exactly why the rule exists) and for any proxy that adds at least one of them. A proxy that forwards the request while *stripping* every one of those headers is indistinguishable from a direct local client and would get local trust — unavoidable, since the panel's own engine is exactly such a peer. So set `control.auth.trustProxy` deliberately for the arrangement you actually have, and do not put the panel behind a proxy configured to remove them. |
|
|
29
|
+
|
|
30
|
+
Reaching the panel through an **external** proxy or tunnel on a public name? Add the name to
|
|
31
|
+
`control.allowedHosts` in `.hh/settings.json` (or under Global settings → Listener, reached by IP).
|
|
32
|
+
|
|
33
|
+
## Sessions, tokens and lockout
|
|
34
|
+
|
|
35
|
+
- **Sessions** live in memory only. The lifetime is an *idle* timeout: each request slides it.
|
|
36
|
+
Changing the password signs every session out.
|
|
37
|
+
- **Tokens** are stored as a SHA-256 hash; the value is shown once. **A token is full admin**: it can
|
|
38
|
+
create and start an entry, and an entry runs any command as the panel's user — so anyone holding
|
|
39
|
+
it can do anything that user can, on this machine, including what the panel refuses it.
|
|
40
|
+
- **A few actions are refused to a token** and need a signed-in session (or this machine):
|
|
41
|
+
clearing the password, switching authentication off, minting or revoking an API token, setting the
|
|
42
|
+
*first* password, installing a custom UI, and restoring an archive that carries `global:secrets`
|
|
43
|
+
(`403 SESSION_REQUIRED`). That keeps a script from doing them by accident, and keeps a leaked
|
|
44
|
+
token from locking you out of the panel itself. It is **not** a boundary against someone holding
|
|
45
|
+
the token: revoke a leaked one, and treat the machine as theirs until you have.
|
|
46
|
+
- **Repeated login failures lock out per client address**, escalating to 15 minutes. On top of that,
|
|
47
|
+
the whole panel accepts at most 100 failed sign-ins per 10 minutes, whatever address they claim;
|
|
48
|
+
past that every sign-in — a correct one too — is `429` until the window closes
|
|
49
|
+
(`home-hosted set-password` on the machine always works).
|
|
50
|
+
|
|
51
|
+
## Behind a proxy
|
|
52
|
+
|
|
53
|
+
`control.auth.trustProxy` decides whose `X-Forwarded-For` names the client:
|
|
54
|
+
|
|
55
|
+
| Value | Trusts it from | Use when |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| `loopback` *(default)* | a proxy on this machine | the panel's own reverse proxy, or nginx/Caddy on the same host. Remote clients get their real address (lockout, logs) and cannot forge one |
|
|
58
|
+
| `true` | any peer | the proxy runs on another machine and is the only way in. The client address is then whatever the header says, so the per-IP lockout can be dodged (the panel-wide cap above still holds); the panel warns at startup |
|
|
59
|
+
| `false` | nobody | nothing in front of the panel |
|
|
60
|
+
|
|
61
|
+
`cookieSecure: auto` adds `Secure` when the request arrived over https. To terminate TLS in the panel
|
|
62
|
+
itself, upload a PEM pair under Global settings → TLS.
|
|
63
|
+
|
|
64
|
+
## Secrets on disk
|
|
65
|
+
|
|
66
|
+
Never in a config file. The state directory (`.hh`) is created `0700` by whichever command creates
|
|
67
|
+
it first, `up` tightens an older one to `0700`, and each of these is `0600`:
|
|
68
|
+
|
|
69
|
+
| What | Where |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| password hash (and the first-run password, until it is changed), token hash | `.hh/.control-secrets.json` |
|
|
72
|
+
| notification tokens, DDNS credentials | `.hh/<workspace>/.secrets.json` |
|
|
73
|
+
| the panel's TLS pair | `.hh/.tls/` |
|
|
74
|
+
| the running panel's local-channel token | `.hh/run.json` |
|
|
75
|
+
|
|
76
|
+
DDNS credentials are additionally sealed with AES-256-GCM under `HHOSTED_DDNS_SECRET`, because they
|
|
77
|
+
are replayed to a third party. Its default is a fixed value, which protects nothing if the state
|
|
78
|
+
directory is copied — **set your own** if you commit or share `.hh/`.
|
|
79
|
+
|
|
80
|
+
## Plain http on a LAN
|
|
81
|
+
|
|
82
|
+
`http://192.168.x.x` is not a secure context, so browsers withhold some APIs there. The stock UI
|
|
83
|
+
works around the one it uses (copy-to-clipboard), and says so when even the fallback is refused.
|
|
84
|
+
|
|
85
|
+
## Port conflicts
|
|
86
|
+
|
|
87
|
+
A busy port is named with its holder, and **Free port** looks the holder up again at that moment —
|
|
88
|
+
never from a pid quoted in a message — and refuses anything this panel supervises.
|
|
89
|
+
|
|
90
|
+
## Reporting a vulnerability
|
|
91
|
+
|
|
92
|
+
Open a private security advisory on
|
|
93
|
+
[GitHub](https://github.com/NamesMT/home-hosted/security/advisories/new) rather than a public issue.
|