home-hosted 0.11.0 → 0.12.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 +273 -628
- package/dist/chunks/archive-DpCwA8Nf.js +339 -0
- package/dist/chunks/archive-DpCwA8Nf.js.map +1 -0
- package/dist/chunks/atomic-CEfCUfkQ.js +25 -0
- package/dist/chunks/atomic-CEfCUfkQ.js.map +1 -0
- package/dist/chunks/backup-CPrJVPJI.js +797 -0
- package/dist/chunks/backup-CPrJVPJI.js.map +1 -0
- package/dist/chunks/backups-Bd2SF2qd.js +4346 -0
- package/dist/chunks/backups-Bd2SF2qd.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-ku5ypHXJ.js +2256 -0
- package/dist/chunks/contracts-ku5ypHXJ.js.map +1 -0
- package/dist/chunks/daemon-TwXk5vb8.js +215 -0
- package/dist/chunks/daemon-TwXk5vb8.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/docker-CGv4Uv7w.js +436 -0
- package/dist/chunks/docker-CGv4Uv7w.js.map +1 -0
- package/dist/chunks/down-BlX5X3bm.js +378 -0
- package/dist/chunks/down-BlX5X3bm.js.map +1 -0
- package/dist/chunks/init-DdmqHVra.js +263 -0
- package/dist/chunks/init-DdmqHVra.js.map +1 -0
- package/dist/chunks/last-stop-BZ08Z89-.js +52 -0
- package/dist/chunks/last-stop-BZ08Z89-.js.map +1 -0
- package/dist/chunks/layout-D74TGUnr.js +24 -0
- package/dist/chunks/layout-D74TGUnr.js.map +1 -0
- package/dist/chunks/log-buffer-HnP0jKhZ.js +350 -0
- package/dist/chunks/log-buffer-HnP0jKhZ.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-gI_69Q1P.js +265 -0
- package/dist/chunks/logs-gI_69Q1P.js.map +1 -0
- package/dist/chunks/migrate-BTlsibvF.js +155 -0
- package/dist/chunks/migrate-BTlsibvF.js.map +1 -0
- package/dist/chunks/nanny-20aBXL1o.js +1069 -0
- package/dist/chunks/nanny-20aBXL1o.js.map +1 -0
- package/dist/chunks/nanny-CjnnrIpm.js +132 -0
- package/dist/chunks/nanny-CjnnrIpm.js.map +1 -0
- package/dist/chunks/nanny-DUaAfCV-.js +39 -0
- package/dist/chunks/nanny-DUaAfCV-.js.map +1 -0
- package/dist/chunks/nanny-sweep-Ca9kPAVi.js +104 -0
- package/dist/chunks/nanny-sweep-Ca9kPAVi.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-B9owE47G.js +383 -0
- package/dist/chunks/parse-B9owE47G.js.map +1 -0
- package/dist/chunks/paths-BT94q6-w.js +172 -0
- package/dist/chunks/paths-BT94q6-w.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-UZgeDukG.js +126 -0
- package/dist/chunks/restart-UZgeDukG.js.map +1 -0
- package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/chunks/schema-o7Lgk0V1.js +102 -0
- package/dist/chunks/schema-o7Lgk0V1.js.map +1 -0
- package/dist/chunks/secrets-D7PdYh71.js +544 -0
- package/dist/chunks/secrets-D7PdYh71.js.map +1 -0
- package/dist/chunks/server-BuIeSsRu.js +169 -0
- package/dist/chunks/server-BuIeSsRu.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-DegMumPh.js +43 -0
- package/dist/chunks/set-password-DegMumPh.js.map +1 -0
- package/dist/chunks/set-token-21d1FTDC.js +78 -0
- package/dist/chunks/set-token-21d1FTDC.js.map +1 -0
- package/dist/chunks/settings-BVSBnIwJ.js +332 -0
- package/dist/chunks/settings-BVSBnIwJ.js.map +1 -0
- package/dist/chunks/setup-temp-XiuAtiW2.js +150 -0
- package/dist/chunks/setup-temp-XiuAtiW2.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-BL97vLVb.js +11153 -0
- package/dist/chunks/src-BL97vLVb.js.map +1 -0
- package/dist/chunks/status-EuWdRq8Q.js +119 -0
- package/dist/chunks/status-EuWdRq8Q.js.map +1 -0
- package/dist/chunks/ui-DbPuwddJ.js +323 -0
- package/dist/chunks/ui-DbPuwddJ.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-BhqOAhmM.js +27 -0
- package/dist/chunks/ui-revert-BhqOAhmM.js.map +1 -0
- package/dist/chunks/ui-switch-CMoslPO2.js +150 -0
- package/dist/chunks/ui-switch-CMoslPO2.js.map +1 -0
- package/dist/chunks/ui-update-TTBBoDik.js +272 -0
- package/dist/chunks/ui-update-TTBBoDik.js.map +1 -0
- package/dist/chunks/up-C4H13hBw.js +196 -0
- package/dist/chunks/up-C4H13hBw.js.map +1 -0
- package/dist/chunks/usage-CSBgLRN5.js +85 -0
- package/dist/chunks/usage-CSBgLRN5.js.map +1 -0
- package/dist/chunks/workspaces-CAln2sQ7.js +221 -0
- package/dist/chunks/workspaces-CAln2sQ7.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 +218 -25205
- package/dist/cli.js.map +1 -1
- package/dist/client.js +120 -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 +179 -0
- package/dist/types/api/control.d.ts +469 -0
- package/dist/types/api/ddns.d.ts +432 -0
- package/dist/types/api/events.d.ts +21 -0
- package/dist/types/api/health.d.ts +27 -0
- package/dist/types/api/logs.d.ts +95 -0
- package/dist/types/api/metrics.d.ts +19 -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 +492 -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 +6080 -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 +79 -0
- package/dist/types/cli/down.d.ts +75 -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 +64 -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 +42 -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 +90 -0
- package/dist/types/cli/usage.d.ts +23 -0
- package/dist/types/cli.d.ts +12 -0
- package/dist/types/client.d.ts +6284 -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 +206 -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 +74 -0
- package/dist/types/config/store.d.ts +132 -0
- package/dist/types/config/workspaces.d.ts +96 -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 +15 -0
- package/dist/types/helpers/daemon-log.d.ts +45 -0
- package/dist/types/helpers/daemon.d.ts +122 -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 +18 -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 +46 -0
- package/dist/types/helpers/paths.d.ts +94 -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/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 +37 -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 +29 -0
- package/dist/types/providers/nanny-sweep.d.ts +51 -0
- package/dist/types/providers/nanny.d.ts +94 -0
- package/dist/types/providers/port.d.ts +142 -0
- package/dist/types/providers/proc.d.ts +116 -0
- package/dist/types/providers/process.d.ts +61 -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 +32 -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 +69 -0
- package/dist/types/services/acme-challenge.d.ts +44 -0
- package/dist/types/services/auth.d.ts +145 -0
- package/dist/types/services/backups.d.ts +352 -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 +67 -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 +33 -0
- package/dist/types/services/history.d.ts +36 -0
- package/dist/types/services/host-monitor.d.ts +32 -0
- package/dist/types/services/init.d.ts +71 -0
- package/dist/types/services/log-buffer.d.ts +28 -0
- package/dist/types/services/log-files.d.ts +87 -0
- package/dist/types/services/log-relay.d.ts +36 -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 +194 -0
- package/dist/types/services/proxy-config.d.ts +83 -0
- package/dist/types/services/proxy.d.ts +454 -0
- package/dist/types/services/state.d.ts +41 -0
- package/dist/types/services/supervisor/compose.d.ts +17 -0
- package/dist/types/services/supervisor/entry.d.ts +139 -0
- package/dist/types/services/supervisor/health.d.ts +55 -0
- package/dist/types/services/supervisor/pending-load.d.ts +6 -0
- package/dist/types/services/supervisor/persistent.d.ts +55 -0
- package/dist/types/services/supervisor/port-preflight.d.ts +45 -0
- package/dist/types/services/supervisor/records.d.ts +38 -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 +113 -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/api-client.d.ts +137 -0
- package/dist/types/shared/backup-scope.d.ts +109 -0
- package/dist/types/shared/clone.d.ts +14 -0
- package/dist/types/shared/contracts.d.ts +4233 -0
- package/dist/types/shared/cpu-scale.d.ts +25 -0
- package/dist/types/shared/ddns-form.d.ts +62 -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/generated.d.ts +26 -0
- package/dist/types/shared/host-readings.d.ts +185 -0
- package/dist/types/shared/patch-diff.d.ts +94 -0
- package/dist/types/shared/probe-latency.d.ts +25 -0
- package/dist/types/shared/proxy-form.d.ts +182 -0
- package/dist/types/shared/server-attention.d.ts +37 -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/ui-format.d.ts +89 -0
- package/docs/API.md +180 -0
- package/docs/BACKUPS.md +97 -0
- package/docs/CLI.md +122 -0
- package/docs/DDNS.md +9 -1
- package/docs/RESTORE_DEMO.md +1 -1
- package/docs/REVERSE_PROXY.md +2 -2
- package/docs/SECURITY.md +82 -0
- package/docs/SERVERS.md +41 -13
- package/docs/UI_CREATION.md +82 -291
- package/package.json +18 -8
- package/uis/stock/dist/assets/de-DyGrM1KK.js +1 -0
- package/uis/stock/dist/assets/es-BebHdc0E.js +1 -0
- package/uis/stock/dist/assets/fr-DsDTrxhI.js +1 -0
- package/uis/stock/dist/assets/index-6LANO2Ua.css +2 -0
- package/uis/stock/dist/assets/{index-KdyqrVv8.js → index-D06cUZbM.js} +15 -12
- package/uis/stock/dist/assets/ja-D3RARJjW.js +1 -0
- package/uis/stock/dist/assets/ko-CKI3dFoD.js +1 -0
- package/uis/stock/dist/assets/ru-DEU5ujXt.js +1 -0
- package/uis/stock/dist/assets/vi-ULKPnasj.js +1 -0
- package/uis/stock/dist/assets/zh-CN-tCvnOxWy.js +1 -0
- package/uis/stock/dist/index.html +2 -2
- package/uis/stock/dist/ui.json +3 -3
- 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/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
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SseMessage } from '../shared/contracts.js';
|
|
2
|
+
export type EventListener = (message: SseMessage) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Fan-out for SSE subscribers, optionally scoped to one server.
|
|
5
|
+
*
|
|
6
|
+
* The scope is `workspaceId/serverId`, never the bare id: server ids are only
|
|
7
|
+
* unique *within* a workspace, so keying on the id alone would deliver one
|
|
8
|
+
* workspace's log lines to a subscriber watching another workspace's server of
|
|
9
|
+
* the same name.
|
|
10
|
+
*/
|
|
11
|
+
export { serverKey } from '../shared/server-key.js';
|
|
12
|
+
export declare class EventHub {
|
|
13
|
+
private readonly listeners;
|
|
14
|
+
subscribe(key: string | null, listener: EventListener): () => void;
|
|
15
|
+
publish(message: SseMessage): void;
|
|
16
|
+
private dispatch;
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ControlConfig, ProxyConfig } from '../shared/contracts.js';
|
|
2
|
+
export interface ExposureState {
|
|
3
|
+
/** The control panel listens beyond loopback. */
|
|
4
|
+
exposed: boolean;
|
|
5
|
+
/** Non-null when that exposure is not backed by a password. */
|
|
6
|
+
blockedReason: string | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Exposing the panel beyond loopback is only allowed with authentication fully
|
|
10
|
+
* configured — this is checked at startup, on every settings write, and shown in
|
|
11
|
+
* the UI, so the three can never disagree.
|
|
12
|
+
*/
|
|
13
|
+
export declare function checkExposure(control: ControlConfig, passwordSet: boolean, usingDefaultPassword?: boolean): ExposureState;
|
|
14
|
+
/**
|
|
15
|
+
* A route pointing at the panel puts it on the internet, which is the same
|
|
16
|
+
* exposure the listener rule guards — so it answers to the same bar. Said here
|
|
17
|
+
* rather than in the proxy service because that rule must not have two homes.
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkProxyExposure(proxy: ProxyConfig, authEnabled: boolean, passwordSet: boolean, usingDefaultPassword?: boolean): string | null;
|
|
20
|
+
/**
|
|
21
|
+
* A warning for the combination that makes the login lockout advisory.
|
|
22
|
+
*
|
|
23
|
+
* `trustProxy: true` tells srvx to trust `x-forwarded-*` from **any** peer, and it resolves the client
|
|
24
|
+
* address from the leftmost entry of `x-forwarded-for` — a value the caller controls. Login failures are
|
|
25
|
+
* keyed on that address, so a client that rotates the header never accumulates them: measured, 30 wrong
|
|
26
|
+
* passwords from 30 forged addresses produced **zero** 429s, against 27 from a fixed address.
|
|
27
|
+
*
|
|
28
|
+
* This is a warning rather than a refusal because `true` has legitimate uses — a proxy on another host —
|
|
29
|
+
* and, once the header is trusted, the real peer is not reachable through srvx (`#remoteAddress` is
|
|
30
|
+
* private), so the panel cannot re-key the lockout on it. Prefer `host: local` with the proxy on this
|
|
31
|
+
* machine, or leave `trustProxy` off and reach the panel directly.
|
|
32
|
+
*/
|
|
33
|
+
export declare function proxyTrustWarning(control: ControlConfig): string | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { HistoryEvent, ServerHistory } from '../shared/contracts.js';
|
|
2
|
+
/**
|
|
3
|
+
* Bounded event log per server, persisted as JSON so uptime and crash counts
|
|
4
|
+
* survive a restart of the control plane.
|
|
5
|
+
*
|
|
6
|
+
* Uptime is derived from recorded runtimes (each exit stores how long the process
|
|
7
|
+
* was up) rather than from sampling, so it stays accurate without a background
|
|
8
|
+
* poller.
|
|
9
|
+
*/
|
|
10
|
+
export declare class HistoryStore {
|
|
11
|
+
private readonly file;
|
|
12
|
+
private events;
|
|
13
|
+
private saveTimer;
|
|
14
|
+
private loaded;
|
|
15
|
+
/** Bumped on every record, so readers can cache their summaries. */
|
|
16
|
+
private version;
|
|
17
|
+
constructor(file: string);
|
|
18
|
+
get revision(): number;
|
|
19
|
+
load(): void;
|
|
20
|
+
record(serverId: string, event: Omit<HistoryEvent, 'serverId' | 'ts'>, ts?: number): void;
|
|
21
|
+
all(): HistoryEvent[];
|
|
22
|
+
/**
|
|
23
|
+
* Drops every event for a server that no longer exists.
|
|
24
|
+
*
|
|
25
|
+
* An id is only unique *while* it exists. Nothing pruned on removal, so re-adding an id — a
|
|
26
|
+
* rename-back, a restore, a config edit — inherited the old entry's crash time and event list, and
|
|
27
|
+
* the card showed "Last crash" for a server that had never been started. Bounded (5000 events) so it
|
|
28
|
+
* was never a leak, but wrong in the same way the log files were.
|
|
29
|
+
*/
|
|
30
|
+
forget(serverId: string): void;
|
|
31
|
+
/** `runningSince` adds the in-flight up-interval so a long-running server shows its real ratio. */
|
|
32
|
+
summarize(serverId: string, windowMs: number, now?: number, runningSince?: number | null): ServerHistory;
|
|
33
|
+
dispose(): void;
|
|
34
|
+
private scheduleSave;
|
|
35
|
+
private save;
|
|
36
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { NotificationEvent } from './notifications.js';
|
|
2
|
+
import type { HostConfig, HostView } from '../shared/contracts.js';
|
|
3
|
+
/** Anything that can receive a host-vitals notification; `NotificationService` qualifies. */
|
|
4
|
+
export interface HostNotifier {
|
|
5
|
+
notify: (event: NotificationEvent) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Samples host vitals on their own (slower) interval and turns threshold
|
|
9
|
+
* breaches into one notification per transition, not one per sample.
|
|
10
|
+
*/
|
|
11
|
+
export declare class HostMonitor {
|
|
12
|
+
private readonly getConfig;
|
|
13
|
+
private readonly resolvePath;
|
|
14
|
+
/**
|
|
15
|
+
* Every workspace's notification service: host vitals are panel-wide, so a
|
|
16
|
+
* breach reaches each workspace that asked for host alerts.
|
|
17
|
+
*/
|
|
18
|
+
private readonly notifications;
|
|
19
|
+
private current;
|
|
20
|
+
private lastSampleAt;
|
|
21
|
+
private alerting;
|
|
22
|
+
constructor(getConfig: () => HostConfig, resolvePath: (target: string) => string,
|
|
23
|
+
/**
|
|
24
|
+
* Every workspace's notification service: host vitals are panel-wide, so a
|
|
25
|
+
* breach reaches each workspace that asked for host alerts.
|
|
26
|
+
*/
|
|
27
|
+
notifications: HostNotifier | HostNotifier[]);
|
|
28
|
+
get view(): HostView;
|
|
29
|
+
private notify;
|
|
30
|
+
/** Cheap when the interval has not elapsed; safe to call every tick. */
|
|
31
|
+
tick(now?: number): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export type PackageManager = 'pnpm' | 'npm' | 'yarn' | 'bun';
|
|
2
|
+
export interface InitOptions {
|
|
3
|
+
dir: string;
|
|
4
|
+
name: string;
|
|
5
|
+
pm: PackageManager;
|
|
6
|
+
install: boolean;
|
|
7
|
+
git: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface InitResult {
|
|
10
|
+
dir: string;
|
|
11
|
+
created: boolean;
|
|
12
|
+
files: string[];
|
|
13
|
+
installed: boolean;
|
|
14
|
+
git: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** The scripts every scaffolded project gets; all of them keep state inside the project. */
|
|
17
|
+
export declare function projectScripts(): Record<string, string>;
|
|
18
|
+
/** `home-hosted` is pinned to the version that wrote the project, and open to newer ones. */
|
|
19
|
+
export declare function projectManifest(name: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* State is generated, so it stays out. The workspace definitions worth committing
|
|
22
|
+
* (`.hh/settings.json`, `.hh/workspaces.json`, and each workspace's
|
|
23
|
+
* `settings.json` + `servers.config.json`) are un-ignored explicitly.
|
|
24
|
+
*/
|
|
25
|
+
export declare function projectGitignore(): string;
|
|
26
|
+
export declare function isEmptyDir(dir: string): boolean;
|
|
27
|
+
/** Writes the project skeleton. Nothing is installed or initialized here. */
|
|
28
|
+
export declare function scaffold(options: InitOptions): InitResult;
|
|
29
|
+
export declare const PACKAGE_MANAGERS: PackageManager[];
|
|
30
|
+
/** The package manager this machine actually has, preferring pnpm. */
|
|
31
|
+
export declare function detectPackageManager(exists: (command: string) => boolean): PackageManager;
|
|
32
|
+
/** How to run one of the project's scripts with a given package manager. */
|
|
33
|
+
export declare function runCommand(pm: PackageManager, script: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* One line of `init`'s "Next:" block. A step is either a command to type or a prose line beneath
|
|
36
|
+
* the one above it, and the two are kept apart so the block can be asserted without a terminal.
|
|
37
|
+
*/
|
|
38
|
+
export interface NextStep {
|
|
39
|
+
/** The command, already `cd`-prefixed; `null` when the line is prose about the step above. */
|
|
40
|
+
command: string | null;
|
|
41
|
+
/** What the command does, or the prose itself. */
|
|
42
|
+
text: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* What `init` hands the person once the project is written.
|
|
46
|
+
*
|
|
47
|
+
* Built here rather than printed inline for two reasons, both measured. The install step was
|
|
48
|
+
* missing under `--no-install`, so the scripts it went on to name answered `home-hosted: command
|
|
49
|
+
* not found` (npm exits 127) — the one sequence the scaffold exists to hand over, broken at step
|
|
50
|
+
* one. And the password hint named a page the UI does not have: the sidebar entry is **Global
|
|
51
|
+
* settings**, and "Settings → Authentication" names nothing a person can click.
|
|
52
|
+
*/
|
|
53
|
+
export declare function nextSteps(pm: PackageManager, install: boolean, cd: string): NextStep[];
|
|
54
|
+
/**
|
|
55
|
+
* The `cd` that reaches a scaffolded project, quoted for the shell it will be pasted into.
|
|
56
|
+
*
|
|
57
|
+
* The quoting rule is `shellQuote` (`helpers/shell.ts`), shared with every other string this
|
|
58
|
+
* package prints for a person to copy: `init` printed `cd my servers && npm run up` for a directory
|
|
59
|
+
* with a space, which the shell answers `cd: too many arguments` — an error naming a command the
|
|
60
|
+
* person did not compose, on the one line the scaffold exists to hand them over.
|
|
61
|
+
*/
|
|
62
|
+
export declare function cdCommand(where: string): string;
|
|
63
|
+
/** Install arguments for a scaffolded project (the manifest already lists the dependency). */
|
|
64
|
+
export declare function installArgs(pm: PackageManager): string[];
|
|
65
|
+
/**
|
|
66
|
+
* The install command as a person types it — `pnpm install`, `yarn` with no argument.
|
|
67
|
+
*
|
|
68
|
+
* Distinct from `runCommand`, which runs one of the project's **scripts**: `npm run install` is not
|
|
69
|
+
* an install, it is a script named `install` that this manifest does not declare.
|
|
70
|
+
*/
|
|
71
|
+
export declare function installCommand(pm: PackageManager): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Buffer } from 'node:buffer';
|
|
2
|
+
import type { LogLine, LogStream } from '../shared/contracts.js';
|
|
3
|
+
/** Fixed-capacity line buffer; oldest lines are dropped first. */
|
|
4
|
+
export declare class LogBuffer {
|
|
5
|
+
private capacity;
|
|
6
|
+
private lines;
|
|
7
|
+
/** Characters held, so the byte ceiling never needs a rescan. */
|
|
8
|
+
private chars;
|
|
9
|
+
constructor(capacity: number);
|
|
10
|
+
push(line: LogLine): void;
|
|
11
|
+
/** Removes the oldest `count` lines and keeps `chars` in step with them. */
|
|
12
|
+
private dropOldest;
|
|
13
|
+
extend(lines: LogLine[]): void;
|
|
14
|
+
list(limit?: number): LogLine[];
|
|
15
|
+
clear(): void;
|
|
16
|
+
get size(): number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Splits a chunk into complete lines, keeping a trailing partial line buffered:
|
|
20
|
+
* a child writing "hel" then "lo\n" must surface one line, not two.
|
|
21
|
+
*/
|
|
22
|
+
export declare class LineSplitter {
|
|
23
|
+
private readonly emit;
|
|
24
|
+
private pending;
|
|
25
|
+
constructor(emit: (stream: LogStream, text: string) => void);
|
|
26
|
+
push(stream: LogStream, chunk: string | Buffer): void;
|
|
27
|
+
flush(stream: LogStream): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { LogLine, LogsConfig } from '../shared/contracts.js';
|
|
2
|
+
export interface LogFileInfo {
|
|
3
|
+
name: string;
|
|
4
|
+
sizeBytes: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class LogFiles {
|
|
7
|
+
private readonly dir;
|
|
8
|
+
private readonly getConfig;
|
|
9
|
+
private readonly pending;
|
|
10
|
+
private timer;
|
|
11
|
+
private closed;
|
|
12
|
+
constructor(dir: string, getConfig: () => LogsConfig);
|
|
13
|
+
get directory(): string;
|
|
14
|
+
/** The retention a nanny has to apply itself, on the same files. */
|
|
15
|
+
get config(): LogsConfig;
|
|
16
|
+
append(serverId: string, line: LogLine): void;
|
|
17
|
+
flush(): void;
|
|
18
|
+
info(serverId: string): {
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
sizeBytes: number;
|
|
21
|
+
files: LogFileInfo[];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Reads the last `tail` lines, newest file first, padding from the rotations behind it.
|
|
25
|
+
*
|
|
26
|
+
* With `persist` off there is nothing this panel is willing to serve, even though a
|
|
27
|
+
* persistent entry's nanny still writes its file: that file is the log's transport —
|
|
28
|
+
* there is no pipe to carry it — and `persist` decides what counts as history.
|
|
29
|
+
*
|
|
30
|
+
* Every *retained* file is a source, not just `.1`: `keep` is the number of rotations the
|
|
31
|
+
* person asked to keep, so a 5000-line window over a 10 MB rotation could not be filled by
|
|
32
|
+
* the current file and `.1` alone. It read two of eleven files and returned "no matches" for
|
|
33
|
+
* a line that was on disk — a search that answers "nothing found" while the log holds the
|
|
34
|
+
* match is worse than a shorter window.
|
|
35
|
+
*/
|
|
36
|
+
readTail(serverId: string, tail: number): LogLine[];
|
|
37
|
+
clear(serverId: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Drops rotations above the current `keep`, for every server, now.
|
|
40
|
+
*
|
|
41
|
+
* `rotate` prunes too, but it only runs when a file fills — which on a quiet entry can be days
|
|
42
|
+
* after the person lowered the ceiling. A retention setting that takes effect "eventually, once
|
|
43
|
+
* the server is chatty enough" is not the promise the page makes, so the settings save calls
|
|
44
|
+
* this directly.
|
|
45
|
+
*/
|
|
46
|
+
prune(): void;
|
|
47
|
+
dispose(): void;
|
|
48
|
+
private write;
|
|
49
|
+
/**
|
|
50
|
+
* Drops this id's rotations numbered above `keep`.
|
|
51
|
+
*
|
|
52
|
+
* They are left over from a higher ceiling (or an older release). Renaming up only ever shifts
|
|
53
|
+
* them further out of reach, so they have to be removed outright: a retention setting is a
|
|
54
|
+
* promise about the directory, not about a rename loop.
|
|
55
|
+
*/
|
|
56
|
+
private pruneServer;
|
|
57
|
+
private rotate;
|
|
58
|
+
/**
|
|
59
|
+
* The last `tail` parseable lines of one file.
|
|
60
|
+
*
|
|
61
|
+
* Reads backwards, growing the window until it has enough lines. It used to read exactly one
|
|
62
|
+
* fixed chunk, which silently truncated: a JSONL line here is a couple of hundred bytes, so
|
|
63
|
+
* one 256 KB chunk holds roughly 1500 of them, while the route accepts `tail=5000`. Asking
|
|
64
|
+
* for 5000 returned 1464 and dropped 3536 lines with no error — the oldest line handed back
|
|
65
|
+
* was not the oldest asked for.
|
|
66
|
+
*/
|
|
67
|
+
private readTailChunk;
|
|
68
|
+
private currentPath;
|
|
69
|
+
private rotatedPath;
|
|
70
|
+
/**
|
|
71
|
+
* Every file this id owns on disk, newest first, found by reading the directory.
|
|
72
|
+
*
|
|
73
|
+
* The count comes from the directory rather than from `keep` because the two disagree the
|
|
74
|
+
* moment a person lowers it: `rotate` only renames *up* to the new ceiling, so it never removes
|
|
75
|
+
* the rotations numbered above it. Those files stayed, were invisible to `info()`, were served
|
|
76
|
+
* by no reader, and survived a `clear` — growth the retention setting promised to bound, in
|
|
77
|
+
* files nothing would ever show. Reading the directory is also what makes them prunable.
|
|
78
|
+
*/
|
|
79
|
+
private ownedFiles;
|
|
80
|
+
/**
|
|
81
|
+
* The files `keep` still covers, newest first — what `info` lists and what a tail may read.
|
|
82
|
+
*
|
|
83
|
+
* The current file is always first and never counted against `keep`, which is what the UI
|
|
84
|
+
* promises ("before rolling to .1, .2, …").
|
|
85
|
+
*/
|
|
86
|
+
private retained;
|
|
87
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { LogLine } from '../shared/contracts.js';
|
|
2
|
+
export interface LogRelayOptions {
|
|
3
|
+
onLines: (serverId: string, lines: LogLine[]) => void;
|
|
4
|
+
intervalMs?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class LogRelay {
|
|
7
|
+
private readonly options;
|
|
8
|
+
private readonly followed;
|
|
9
|
+
private timer;
|
|
10
|
+
private closed;
|
|
11
|
+
constructor(options: LogRelayOptions);
|
|
12
|
+
/**
|
|
13
|
+
* Idempotent: following the same file again keeps the position already read.
|
|
14
|
+
*
|
|
15
|
+
* With `backfill`, the last lines already on disk are returned *and* the live position
|
|
16
|
+
* is set past them by the same tailer, so the caller can fill a buffer without a line
|
|
17
|
+
* being both history and news. Without it, the live stream simply starts at the end.
|
|
18
|
+
*/
|
|
19
|
+
follow(serverId: string, file: string, options?: {
|
|
20
|
+
backfill?: number;
|
|
21
|
+
}): LogLine[];
|
|
22
|
+
/**
|
|
23
|
+
* Stops following and hands back whatever the file still held unread.
|
|
24
|
+
*
|
|
25
|
+
* A nanny writes its last lines and exits in the same breath, so the tailer can be
|
|
26
|
+
* dropped between two polls with its final lines — the child's crash output — still
|
|
27
|
+
* on disk. Losing them here is what made a persistent entry's crash silent in the
|
|
28
|
+
* panel, so the caller gets them to ingest rather than an empty hand.
|
|
29
|
+
*/
|
|
30
|
+
unfollow(serverId: string): LogLine[];
|
|
31
|
+
followedIds(): string[];
|
|
32
|
+
dispose(): void;
|
|
33
|
+
private start;
|
|
34
|
+
private stopTimer;
|
|
35
|
+
private poll;
|
|
36
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NannySpec } from '../shared/contracts.js';
|
|
2
|
+
/**
|
|
3
|
+
* The nanny of one persistent entry: it spawns the child, owns its pipes, writes its
|
|
4
|
+
* output to the entry's JSONL log and mirrors the child's exit.
|
|
5
|
+
*
|
|
6
|
+
* This is the whole reason a persistent entry survives the panel. The pipes belong to
|
|
7
|
+
* a process that is not the panel, so a panel stop, restart or SIGKILL cannot break
|
|
8
|
+
* them; the log keeps being written; and the exit code the panel would have collected
|
|
9
|
+
* as a parent is left in the state file for whoever comes back.
|
|
10
|
+
*
|
|
11
|
+
* It deliberately does *not* restart anything: retries, backoff and health stay the
|
|
12
|
+
* panel's business, so there is only ever one supervisor making that decision.
|
|
13
|
+
*/
|
|
14
|
+
export declare function runNanny(spec: NannySpec, statePath: string): Promise<void>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { SecretsStore } from '../config/secrets.js';
|
|
2
|
+
import type { DestinationStatusView, NotificationDefaults, NotificationsConfig, NotificationTarget, WebhookTarget } from '../shared/contracts.js';
|
|
3
|
+
export type NotificationReason = 'crash' | 'unhealthy' | 'forced-restart' | 'recovered' | 'restart-ok' | 'rss' | 'host' | 'host-recovered' | 'ddns' | 'ddns-error';
|
|
4
|
+
export interface NotificationEvent {
|
|
5
|
+
serverId: string;
|
|
6
|
+
label: string;
|
|
7
|
+
reason: NotificationReason;
|
|
8
|
+
detail: string;
|
|
9
|
+
}
|
|
10
|
+
/** The event toggles and the throttle: what a destination may inherit, and what it may override. */
|
|
11
|
+
type NotificationPolicy = NotificationDefaults;
|
|
12
|
+
/**
|
|
13
|
+
* Fans supervision events out to the configured destinations.
|
|
14
|
+
*
|
|
15
|
+
* **One list, two kinds.** A destination is a Telegram chat or a webhook; both carry an `enabled`
|
|
16
|
+
* switch, an optional policy of their own, and one row on the page. A workspace may point at
|
|
17
|
+
* several Telegram chats, which is why the bot token is a per-destination secret rather than the
|
|
18
|
+
* singleton it used to be.
|
|
19
|
+
*
|
|
20
|
+
* **Inheritance is the default.** A destination with `useOwnSettings: false` follows
|
|
21
|
+
* `notifications.defaults`, so the common case is configured once instead of per destination. A
|
|
22
|
+
* destination that sets its own opts out entirely — no field is merged, because a half-inherited
|
|
23
|
+
* policy is one nobody can reason about.
|
|
24
|
+
*
|
|
25
|
+
* The throttle is per destination *and* server *and* reason: a flapping server must not flood one
|
|
26
|
+
* destination, and one destination going quiet must not silence another.
|
|
27
|
+
*/
|
|
28
|
+
export declare class NotificationService {
|
|
29
|
+
private readonly secrets;
|
|
30
|
+
private readonly getConfig;
|
|
31
|
+
private readonly cooldowns;
|
|
32
|
+
private readonly results;
|
|
33
|
+
constructor(secrets: SecretsStore, getConfig: () => NotificationsConfig);
|
|
34
|
+
/** The general block, as the page edits it. */
|
|
35
|
+
defaults(): NotificationDefaults;
|
|
36
|
+
/**
|
|
37
|
+
* Every destination as a row: its own fields, the policy it will actually use, and its last result.
|
|
38
|
+
*
|
|
39
|
+
* The page shows this rather than the raw config, so an inheriting destination displays the
|
|
40
|
+
* inherited toggles — the values a send will use, not the stale ones on disk.
|
|
41
|
+
*/
|
|
42
|
+
destinations(): DestinationStatusView[];
|
|
43
|
+
/** The policy a destination actually uses: its own, or the general block's. */
|
|
44
|
+
effectivePolicy(target: NotificationTarget): NotificationPolicy;
|
|
45
|
+
/**
|
|
46
|
+
* The destinations that would deliver this event right now.
|
|
47
|
+
*
|
|
48
|
+
* Per destination rather than one boolean for the service: a single answer would either send a
|
|
49
|
+
* host warning somewhere switched off for it, or silence a crash because another destination's
|
|
50
|
+
* cooldown was still running.
|
|
51
|
+
*/
|
|
52
|
+
targetsFor(event: NotificationEvent, now?: number): NotificationTarget[];
|
|
53
|
+
/** Whether *any* destination would deliver this event. */
|
|
54
|
+
shouldNotify(event: NotificationEvent, now?: number): boolean;
|
|
55
|
+
/** Starts the cooldown window for every destination about to be asked to send. */
|
|
56
|
+
markSent(event: NotificationEvent, now?: number): void;
|
|
57
|
+
/** One destination's window, returning the deadline it set so a failed send can undo it. */
|
|
58
|
+
private armCooldown;
|
|
59
|
+
/**
|
|
60
|
+
* Gives back the window a **failed** send took.
|
|
61
|
+
*
|
|
62
|
+
* The window exists to collapse a flapping server into one message, so it is armed before the
|
|
63
|
+
* send rather than after: two events already in flight must not both go out. But a send that
|
|
64
|
+
* never arrived has told nobody anything — measured on the built panel, a crash alert sent while
|
|
65
|
+
* the receiver was down recorded `fetch failed`, and the next two crashes inside the 5-minute
|
|
66
|
+
* window were silenced by it, so the one alert that would have reached a working receiver was
|
|
67
|
+
* the one the outage took. Undo only the deadline this send set: a concurrent dispatch may have
|
|
68
|
+
* armed a later one, and clearing that would reopen the flood the window is for.
|
|
69
|
+
*/
|
|
70
|
+
private releaseCooldown;
|
|
71
|
+
/** Fire-and-forget by design: supervision must never wait on a chat or webhook API. */
|
|
72
|
+
notify(event: NotificationEvent): void;
|
|
73
|
+
dispatch(event: NotificationEvent): Promise<boolean>;
|
|
74
|
+
/** One destination, one event. A throw is recorded against it and nothing else. */
|
|
75
|
+
private deliver;
|
|
76
|
+
/** A probe for one destination. */
|
|
77
|
+
sendTest(id: string, overrides?: {
|
|
78
|
+
chatId?: string;
|
|
79
|
+
botToken?: string;
|
|
80
|
+
}): Promise<{
|
|
81
|
+
ok: boolean;
|
|
82
|
+
error?: string;
|
|
83
|
+
}>;
|
|
84
|
+
/**
|
|
85
|
+
* A Telegram destination's own token, with the chat id and the token both overridable.
|
|
86
|
+
*
|
|
87
|
+
* The override is what lets a token be tried before it is saved — the route advertises it and
|
|
88
|
+
* `detect-chats` honours it, so ignoring it here made "send a test" fail on a token the page was
|
|
89
|
+
* still holding.
|
|
90
|
+
*/
|
|
91
|
+
private testTelegram;
|
|
92
|
+
/**
|
|
93
|
+
* A webhook probe, for a saved destination or for a draft the page has not saved.
|
|
94
|
+
*
|
|
95
|
+
* A draft is passed whole, so a URL and its headers can be tried before they are stored — and so
|
|
96
|
+
* a destination's own "test" tests *that* destination, not whichever one comes first.
|
|
97
|
+
*/
|
|
98
|
+
testWebhook(target: Pick<WebhookTarget, 'url' | 'method' | 'format' | 'headers'>, id?: string): Promise<{
|
|
99
|
+
ok: boolean;
|
|
100
|
+
error?: string;
|
|
101
|
+
}>;
|
|
102
|
+
/** Lists the chats a destination's bot can see, so its chat id can be picked. */
|
|
103
|
+
detectChats(id: string, overrides?: {
|
|
104
|
+
botToken?: string;
|
|
105
|
+
}): Promise<{
|
|
106
|
+
ok: boolean;
|
|
107
|
+
chats: Array<{
|
|
108
|
+
id: number | string;
|
|
109
|
+
title: string;
|
|
110
|
+
}>;
|
|
111
|
+
error?: string;
|
|
112
|
+
}>;
|
|
113
|
+
/** Verifies a token without storing or sending anything. */
|
|
114
|
+
verifyToken(token: string): Promise<{
|
|
115
|
+
ok: boolean;
|
|
116
|
+
username?: string;
|
|
117
|
+
error?: string;
|
|
118
|
+
}>;
|
|
119
|
+
private cooldownKey;
|
|
120
|
+
private sendTelegram;
|
|
121
|
+
/** Records one destination's outcome, keyed by its id. */
|
|
122
|
+
private remember;
|
|
123
|
+
}
|
|
124
|
+
export {};
|