@camstack/server 1.2.928 → 1.2.929
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/CHANGELOG.md +6 -0
- package/package.json +10 -8
- package/system/dist/addon-id-CVg1_r5E.mjs +39 -0
- package/system/dist/addon-id-Di0lNJ89.js +50 -0
- package/system/dist/addon-pages.cap-Df9FQwN1.js +49 -0
- package/system/dist/addon-pages.cap-DksUlE8j.mjs +44 -0
- package/system/dist/addon-settings.cap-3-TIIMq_.mjs +592 -0
- package/system/dist/addon-settings.cap-DAiE0Nb0.js +651 -0
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/addon-widgets.cap-C4jxflbF.js +200 -0
- package/system/dist/addon-widgets.cap-D9m48X78.mjs +183 -0
- package/system/dist/base-addon-DD5dIfcZ.js +4624 -0
- package/system/dist/base-addon-Md14i7pe.mjs +4505 -0
- package/system/dist/base-device-2sL1DMm1.js +1103 -0
- package/system/dist/base-device-IuM1AwXZ.mjs +1098 -0
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +8 -6
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +6 -4
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +8 -6
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +7 -5
- package/system/dist/builtins/alerts/alerts.addon.js +113 -56
- package/system/dist/builtins/alerts/alerts.addon.mjs +60 -3
- package/system/dist/builtins/autotrack/index.js +21 -17
- package/system/dist/builtins/autotrack/index.mjs +5 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +14 -11
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +8 -5
- package/system/dist/builtins/calendars/calendars.addon.js +8 -6
- package/system/dist/builtins/calendars/calendars.addon.mjs +3 -1
- package/system/dist/builtins/camera-grid/index.js +615 -58
- package/system/dist/builtins/camera-grid/index.mjs +558 -1
- package/system/dist/builtins/composer/composer.addon.js +788 -209
- package/system/dist/builtins/composer/composer.addon.mjs +583 -4
- package/system/dist/builtins/console-logging/index.js +4 -3
- package/system/dist/builtins/console-logging/index.mjs +2 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +7887 -381
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +7511 -5
- package/system/dist/builtins/core-notifier/core-notifier.addon.js +731 -21
- package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +711 -1
- package/system/dist/builtins/device-history/device-history.addon.js +110 -31
- package/system/dist/builtins/device-history/device-history.addon.mjs +81 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +12806 -227
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +12583 -5
- package/system/dist/builtins/hub-forwarder/index.js +4 -3
- package/system/dist/builtins/hub-forwarder/index.mjs +2 -1
- package/system/dist/builtins/keychain/index.js +31 -28
- package/system/dist/builtins/keychain/index.mjs +7 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +15 -12
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +4 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +140 -39
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +106 -6
- package/system/dist/builtins/local-network/local-network.addon.js +43 -39
- package/system/dist/builtins/local-network/local-network.addon.mjs +7 -3
- package/system/dist/builtins/loki-logging/index.js +23 -17
- package/system/dist/builtins/loki-logging/index.mjs +7 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +156 -15
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +151 -10
- package/system/dist/builtins/platform-probe/index.js +25 -23
- package/system/dist/builtins/platform-probe/index.mjs +12 -10
- package/system/dist/builtins/record-entries/index.js +9 -7
- package/system/dist/builtins/record-entries/index.mjs +3 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +97 -44
- package/system/dist/builtins/snapshot/index.mjs +54 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +5 -4
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +21 -20
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +87 -61
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +29 -3
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +81 -72
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +10 -1
- package/system/dist/builtins/system-config/system-config.addon.js +17 -14
- package/system/dist/builtins/system-config/system-config.addon.mjs +118 -115
- package/system/dist/builtins/winston-logging/index.js +7 -5
- package/system/dist/builtins/winston-logging/index.mjs +3 -1
- package/system/dist/calendars.cap-CaFlShS9.js +155 -0
- package/system/dist/calendars.cap-_C4eD4fi.mjs +138 -0
- package/system/dist/camstack-error-DJ-TUAi1.js +23 -0
- package/system/dist/camstack-error-viZYfcj9.mjs +18 -0
- package/system/dist/cap-call-context-Bd76CbOW.js +95 -0
- package/system/dist/cap-call-context-DNwdgGSQ.mjs +78 -0
- package/system/dist/capability-definition-C2rJdVeX.mjs +177 -0
- package/system/dist/capability-definition-HCmTem8c.js +242 -0
- package/system/dist/{capture-engine-BcuwOSXv.js → capture-engine-DZ0LIUqA.js} +5 -4
- package/system/dist/{capture-engine-Bz7eXFjT.mjs → capture-engine-DiwbjoWp.mjs} +2 -1
- package/system/dist/command-origin-claim-Cief660O.js +35 -0
- package/system/dist/command-origin-claim-D1Wy7Qld.mjs +24 -0
- package/system/dist/composition-sources-Caqv7O7z.mjs +391 -0
- package/system/dist/composition-sources-CgnHjm8Q.js +408 -0
- package/system/dist/{constants-D2etJ02O.js → constants-Ba3FTIHl.js} +1 -1
- package/system/dist/constants-C860Y6U4.js +26 -0
- package/system/dist/{constants-BcUTQd1M.mjs → constants-DB4piTD5.mjs} +1 -1
- package/system/dist/constants-DCLpoF4L.mjs +21 -0
- package/system/dist/coral-accelerators-7o8hqvcN.js +564 -0
- package/system/dist/coral-accelerators-BKcXP59c.mjs +521 -0
- package/system/dist/core-blocks.cap-C6iKAZ-x.mjs +17986 -0
- package/system/dist/core-blocks.cap-LEMqVwxO.js +18705 -0
- package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
- package/system/dist/custom-actions-BFUSalC9.mjs +25 -0
- package/system/dist/custom-actions-D92NRi2c.js +36 -0
- package/system/dist/database-snapshot.cap-DF38e-0P.js +162 -0
- package/system/dist/database-snapshot.cap-dhrc9xnY.mjs +133 -0
- package/system/dist/declared-device-BWphj9WE.js +303 -0
- package/system/dist/declared-device-CKERA1Hi.mjs +286 -0
- package/system/dist/{device-ca-ExMN3xW3.mjs → device-ca-BLM6fccc.mjs} +2 -1
- package/system/dist/{device-ca-CU8zh9Pi.js → device-ca-C5kJE6mL.js} +7 -6
- package/system/dist/device-certificate-Cddm4Idn.mjs +91 -0
- package/system/dist/device-certificate-CguVACQO.js +162 -0
- package/system/dist/device-identifiers-BQg9EQi1.js +600 -0
- package/system/dist/device-identifiers-iSuQCKmK.mjs +529 -0
- package/system/dist/device-kind-BJ2pfsjw.mjs +78 -0
- package/system/dist/device-kind-CsSiv_YF.js +101 -0
- package/system/dist/device-manager.cap-2abwVLCM.js +2874 -0
- package/system/dist/device-manager.cap-CFZSPfUh.mjs +2749 -0
- package/system/dist/device-provider.cap-3Uvk6f5-.mjs +331 -0
- package/system/dist/device-provider.cap-D7TV2kVH.js +366 -0
- package/system/dist/{device-row-store-CeW_GWh9.mjs → device-row-store-YF3jtmkk.mjs} +4 -1
- package/system/dist/{device-row-store-BMIR-n3m.js → device-row-store-doTfMOqn.js} +12 -9
- package/system/dist/device-transitions.cap-B5w5PYU_.js +860 -0
- package/system/dist/device-transitions.cap-DojcwEuX.mjs +819 -0
- package/system/dist/device-type-CbQsnFdC.js +477 -0
- package/system/dist/device-type-DgEvK3ch.mjs +454 -0
- package/system/dist/entry-kind-D9MuVJCK.mjs +44 -0
- package/system/dist/entry-kind-cq90c--V.js +55 -0
- package/system/dist/error.cap-CSM_SRfR.mjs +3423 -0
- package/system/dist/error.cap-DBhgPeWK.js +3848 -0
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/history-catalog-BKRarIL_.js +831 -0
- package/system/dist/history-catalog-BwTeQ4Mr.mjs +802 -0
- package/system/dist/{hub-identity-Csxx2Q8k.js → hub-identity-BMdR3Mw9.js} +2 -2
- package/system/dist/{hub-identity-CYC1820R.mjs → hub-identity-DjMN9Ac2.mjs} +10 -10
- package/system/dist/{hub-mdns-ciao-By5577HM.js → hub-mdns-ciao--0v1TKME.js} +5 -5
- package/system/dist/{hub-mdns-ciao-CCDxM5qz.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +2 -2
- package/system/dist/index.js +763 -151
- package/system/dist/index.mjs +832 -220
- package/system/dist/integration-instances.cap-Cl9O-k4h.mjs +538 -0
- package/system/dist/integration-instances.cap-dJIxg2_s.js +549 -0
- package/system/dist/keychain-admin.cap-Db_oFX4H.js +425 -0
- package/system/dist/keychain-admin.cap-GtM7gVGG.mjs +396 -0
- package/system/dist/l10n-Bu6aUvSY.mjs +10 -0
- package/system/dist/l10n-CGMvp7NF.js +15 -0
- package/system/dist/labels-DX5S8deC.js +81 -0
- package/system/dist/labels-DsBcU7md.mjs +64 -0
- package/system/dist/{legacy-integration-rows-door-CVwOo5aq.js → legacy-integration-rows-door-B1nzxxr5.js} +2 -2
- package/system/dist/{legacy-integration-rows-door-D9tQOUzh.mjs → legacy-integration-rows-door-nTvo_6jQ.mjs} +1 -1
- package/system/dist/log-destination.cap-CxZzAVaR.mjs +143 -0
- package/system/dist/log-destination.cap-DELPJkZ0.js +148 -0
- package/system/dist/low-power-sleep.cap-7lfVU41N.js +103 -0
- package/system/dist/low-power-sleep.cap-tGPmaZ_V.mjs +92 -0
- package/system/dist/mask-shape-Ci8Co9w0.mjs +57 -0
- package/system/dist/mask-shape-CmPA2fst.js +92 -0
- package/system/dist/metrics-provider.cap-BNmcHDkQ.mjs +405 -0
- package/system/dist/metrics-provider.cap-BcmQUt6l.js +410 -0
- package/system/dist/migration-BMjgkyG2.js +380 -0
- package/system/dist/migration-DRJAtdy7.mjs +321 -0
- package/system/dist/network-access.cap-B5TWLDCC.js +1099 -0
- package/system/dist/network-access.cap-BJnGbE6n.mjs +1004 -0
- package/system/dist/notification-rules.cap-B__YBgnG.js +3422 -0
- package/system/dist/notification-rules.cap-D9ArZlwx.mjs +3357 -0
- package/system/dist/ops-log-CB4pIdqi.mjs +64 -0
- package/system/dist/ops-log-pxt9176Z.js +81 -0
- package/system/dist/pinned-binary-BOhOSNff.js +28 -0
- package/system/dist/pinned-binary-CrIRAi4G.mjs +23 -0
- package/system/dist/platform-probe.cap-1WrMhWHx.js +250 -0
- package/system/dist/platform-probe.cap-BFeqFLtQ.mjs +233 -0
- package/system/dist/prefix-walk-B4b2-9aK.mjs +790 -0
- package/system/dist/prefix-walk-DC0ljmbB.js +843 -0
- package/system/dist/ptz-autotrack.cap-BW7w0zHD.js +229 -0
- package/system/dist/ptz-autotrack.cap-DT2GypXw.mjs +224 -0
- package/system/dist/quantity-D3g5SxsZ.mjs +114 -0
- package/system/dist/quantity-lY1KiTSZ.js +143 -0
- package/system/dist/raw-secret-migration-DxuBFtvi.js +50 -0
- package/system/dist/raw-secret-migration-iv88mLoc.mjs +39 -0
- package/system/dist/record-entries.cap-sMUhTvTU.mjs +75 -0
- package/system/dist/record-entries.cap-ti1C046R.js +80 -0
- package/system/dist/record-kind-DoBfYHCs.js +203 -0
- package/system/dist/record-kind-ub6NXqfh.mjs +162 -0
- package/system/dist/recording-archive.cap-7OrIn9e5.mjs +1299 -0
- package/system/dist/recording-archive.cap-D7bo-QSM.js +1328 -0
- package/system/dist/records.cap-ClcWV64i.js +329 -0
- package/system/dist/records.cap-CwLT2ByG.mjs +294 -0
- package/system/dist/relocate-CdVQAk-w.js +804 -0
- package/system/dist/relocate-CoZZTui1.mjs +661 -0
- package/system/dist/rename-composition-block-7WIICIDq.mjs +33525 -0
- package/system/dist/rename-composition-block-CcWLwVhG.js +34692 -0
- package/system/dist/{restore-archive-BJfyu0sG.mjs → restore-archive-CjAyKpgX.mjs} +96 -94
- package/system/dist/{restore-archive-CIFvqOze.js → restore-archive-CkTkv3Ss.js} +6 -4
- package/system/dist/scoped-settings-CylSSq_8.js +955 -0
- package/system/dist/scoped-settings-DVWUIP7Z.mjs +650 -0
- package/system/dist/server-name-BIhLuHvX.mjs +35 -0
- package/system/dist/server-name-OALNvpqC.js +52 -0
- package/system/dist/settings-store.cap-Ci4F2zul.mjs +569 -0
- package/system/dist/settings-store.cap-wlJhCspr.js +640 -0
- package/system/dist/snapshot.cap-3suPdBHV.js +250 -0
- package/system/dist/snapshot.cap-Bs8Oyaqh.mjs +245 -0
- package/system/dist/source-info-DGB7SdB_.mjs +190 -0
- package/system/dist/source-info-DtWf4k2j.js +225 -0
- package/system/dist/storage-admin.cap-BSv1NjKJ.mjs +883 -0
- package/system/dist/storage-admin.cap-he0OqvVM.js +906 -0
- package/system/dist/storage-location-CBT8GCD6.mjs +163 -0
- package/system/dist/storage-location-CTweDMZf.js +198 -0
- package/system/dist/storage-location-mode-B21UVRRX.mjs +167 -0
- package/system/dist/storage-location-mode-CS4sMzo-.js +232 -0
- package/system/dist/storage-migration.cap-CyyATY_p.js +330 -0
- package/system/dist/storage-migration.cap-D7QqGobp.mjs +313 -0
- package/system/dist/storage-occupancy.cap-2rmnS58Z.js +622 -0
- package/system/dist/storage-occupancy.cap-CqBztTl9.mjs +611 -0
- package/system/dist/storage-provider.cap-Bw0CfxVc.js +213 -0
- package/system/dist/storage-provider.cap-CMeck2w4.mjs +202 -0
- package/system/dist/stream-catalog.cap-Bp7SkgIf.mjs +6560 -0
- package/system/dist/stream-catalog.cap-D3uwePiA.js +6763 -0
- package/system/dist/streaming-shared-B8cXatuU.mjs +431 -0
- package/system/dist/streaming-shared-DQwFZOSi.js +526 -0
- package/system/dist/system-reasons-Be_k1W8g.js +25 -0
- package/system/dist/system-reasons-CYj4qwyS.mjs +20 -0
- package/system/dist/tag-BxLazvVb.js +2138 -0
- package/system/dist/tag-uZBAq6ox.mjs +2073 -0
- package/system/dist/user-management.cap-B9QDu8NE.js +825 -0
- package/system/dist/user-management.cap-DBIi77sB.mjs +766 -0
- package/system/dist/vector-store.cap-DnyfrYDn.js +330 -0
- package/system/dist/vector-store.cap-h2GHWQ1t.mjs +319 -0
- package/system/dist/{wal-maintenance-CTrCPzds.mjs → wal-maintenance-BG01rOn9.mjs} +0 -0
- package/system/dist/{wal-maintenance-dq7T3quB.js → wal-maintenance-DyrebYKF.js} +0 -0
- package/system/dist/zod-secret-DS7mj1bk.js +78 -0
- package/system/dist/zod-secret-zY4nM61M.mjs +73 -0
- package/system/package.json +1 -1
- package/system/dist/composition-sources-BI614LJx.mjs +0 -141
- package/system/dist/composition-sources-v_kkb8A9.js +0 -152
- package/system/dist/coral-accelerators-BSVsBVzt.js +0 -250
- package/system/dist/coral-accelerators-BW3OcrLD.mjs +0 -231
- package/system/dist/dist-BCHMSqzc.mjs +0 -143467
- package/system/dist/dist-BZfvhfS1.js +0 -146970
- package/system/dist/prefix-walk-DAOBSyH1.mjs +0 -88
- package/system/dist/prefix-walk-Dv6MLZlM.js +0 -99
- package/system/dist/rename-composition-block-C9HuBrKS.js +0 -112
- package/system/dist/rename-composition-block-DtaYmYAR.mjs +0 -101
|
@@ -0,0 +1,1099 @@
|
|
|
1
|
+
const require_capability_definition = require("./capability-definition-HCmTem8c.js");
|
|
2
|
+
const require_system_reasons = require("./system-reasons-Be_k1W8g.js");
|
|
3
|
+
const require_device_provider_cap = require("./device-provider.cap-D7TV2kVH.js");
|
|
4
|
+
let zod = require("zod");
|
|
5
|
+
//#region ../types/dist/esm/capabilities/viewer-link-url.mjs
|
|
6
|
+
/** The central link domain the viewer app claims (Universal Links / App Links). */
|
|
7
|
+
var CAMSTACK_APP_LINK_ORIGIN = "https://camstack.zentik.app";
|
|
8
|
+
/** True when `baseUrl` names the CamStack app link rather than a hub address. */
|
|
9
|
+
function isAppLinkBase(baseUrl) {
|
|
10
|
+
if (baseUrl === null || baseUrl === void 0 || baseUrl === "") return false;
|
|
11
|
+
try {
|
|
12
|
+
return new URL(baseUrl).origin === CAMSTACK_APP_LINK_ORIGIN;
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Reduce a base URL to the bare origin the central page accepts as `hub=`,
|
|
19
|
+
* or `null` when it cannot be one: not http(s), carries credentials, or does
|
|
20
|
+
* not parse. A path/query/fragment is dropped — the central page mounts the
|
|
21
|
+
* viewer under the origin itself.
|
|
22
|
+
*/
|
|
23
|
+
function toAppLinkHubOrigin(baseUrl) {
|
|
24
|
+
let parsed;
|
|
25
|
+
try {
|
|
26
|
+
parsed = new URL(baseUrl);
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return null;
|
|
31
|
+
if (parsed.username !== "" || parsed.password !== "") return null;
|
|
32
|
+
if (parsed.hostname === "") return null;
|
|
33
|
+
return parsed.origin;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The hub address an app link carries as `hub=`, chosen from the hub's OWN
|
|
37
|
+
* advertised palette so it always agrees with what the Network page lists:
|
|
38
|
+
* the public tunnel first, then the mesh (Tailscale MagicDNS) — HTTPS only,
|
|
39
|
+
* because the app and the hosted viewer reach it from off the LAN. `null`
|
|
40
|
+
* when the hub advertises neither.
|
|
41
|
+
*/
|
|
42
|
+
function pickAppLinkHub(endpoints) {
|
|
43
|
+
const rank = (e) => {
|
|
44
|
+
if (e.kind !== "public" || !e.baseUrl.startsWith("https://")) return null;
|
|
45
|
+
if (e.interfaceKind === "public") return 0;
|
|
46
|
+
if (e.interfaceKind === "vpn") return 1;
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
return endpoints.flatMap((e) => {
|
|
50
|
+
const r = rank(e);
|
|
51
|
+
const origin = toAppLinkHubOrigin(e.baseUrl);
|
|
52
|
+
return r === null || origin === null ? [] : [{
|
|
53
|
+
r,
|
|
54
|
+
p: e.priority,
|
|
55
|
+
origin
|
|
56
|
+
}];
|
|
57
|
+
}).toSorted((a, b) => a.r - b.r || a.p - b.p)[0]?.origin ?? null;
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region ../types/dist/esm/capabilities/hub-address.mjs
|
|
61
|
+
var HUB_ADDRESS_ROLES = [
|
|
62
|
+
"appConnections",
|
|
63
|
+
"notificationTaps",
|
|
64
|
+
"internal",
|
|
65
|
+
"publicEndpoint"
|
|
66
|
+
];
|
|
67
|
+
var IPV4_LITERAL = /^\d{1,3}(?:\.\d{1,3}){3}$/;
|
|
68
|
+
function hostnameOf(baseUrl) {
|
|
69
|
+
try {
|
|
70
|
+
const host = new URL(baseUrl).hostname;
|
|
71
|
+
return host.length > 0 ? host : null;
|
|
72
|
+
} catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function trimSlash(baseUrl) {
|
|
77
|
+
return baseUrl.replace(/\/+$/, "");
|
|
78
|
+
}
|
|
79
|
+
function isMesh(endpoint) {
|
|
80
|
+
return endpoint.kind === "public" && endpoint.interfaceKind === "vpn";
|
|
81
|
+
}
|
|
82
|
+
function isTunnel(endpoint) {
|
|
83
|
+
return endpoint.kind === "public" && endpoint.interfaceKind === "public";
|
|
84
|
+
}
|
|
85
|
+
function isPlausibleLan(endpoint) {
|
|
86
|
+
return (endpoint.kind === "lan-ipv4" || endpoint.kind === "lan-ipv6") && endpoint.plausible;
|
|
87
|
+
}
|
|
88
|
+
function isLanIpv4Literal(endpoint) {
|
|
89
|
+
if (endpoint.kind !== "lan-ipv4" || !endpoint.plausible) return false;
|
|
90
|
+
const host = hostnameOf(endpoint.baseUrl);
|
|
91
|
+
return host !== null && IPV4_LITERAL.test(host);
|
|
92
|
+
}
|
|
93
|
+
function isUnstable(endpoint) {
|
|
94
|
+
return endpoint.stable === false;
|
|
95
|
+
}
|
|
96
|
+
/** Lower = better; `null` = never this role's AUTOMATIC answer. */
|
|
97
|
+
function autoRankFor(role, endpoint) {
|
|
98
|
+
if (endpoint.kind === "loopback" || endpoint.kind === "app-link" || endpoint.kind === "custom") return null;
|
|
99
|
+
if (hostnameOf(endpoint.baseUrl) === null) return null;
|
|
100
|
+
if (isUnstable(endpoint)) return null;
|
|
101
|
+
if (role === "internal") {
|
|
102
|
+
if (isLanIpv4Literal(endpoint)) return 0;
|
|
103
|
+
if (isPlausibleLan(endpoint)) return 1;
|
|
104
|
+
if (isMesh(endpoint)) return 2;
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
if (isTunnel(endpoint)) return 0;
|
|
108
|
+
if (isMesh(endpoint)) return 1;
|
|
109
|
+
if (isLanIpv4Literal(endpoint)) return 2;
|
|
110
|
+
if (isPlausibleLan(endpoint)) return 3;
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set([
|
|
114
|
+
"localhost",
|
|
115
|
+
"0.0.0.0",
|
|
116
|
+
"::1",
|
|
117
|
+
"[::1]",
|
|
118
|
+
"::",
|
|
119
|
+
"[::]"
|
|
120
|
+
]);
|
|
121
|
+
function isLoopbackHost(hostname) {
|
|
122
|
+
const h = hostname.toLowerCase();
|
|
123
|
+
if (LOOPBACK_HOSTS.has(h) || h.endsWith(".localhost")) return true;
|
|
124
|
+
return /^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(h);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Validate an operator-typed address: an http(s) URL with a host, no
|
|
128
|
+
* credentials, no path, and never loopback (it would name whoever dials it).
|
|
129
|
+
* Answers the normalised origin (`scheme://host[:port]`).
|
|
130
|
+
*/
|
|
131
|
+
function validateCustomAddress(raw) {
|
|
132
|
+
const trimmed = raw.trim();
|
|
133
|
+
if (trimmed === "") return {
|
|
134
|
+
ok: false,
|
|
135
|
+
reason: "Enter an address, e.g. https://192.0.2.20:4443."
|
|
136
|
+
};
|
|
137
|
+
let parsed;
|
|
138
|
+
try {
|
|
139
|
+
parsed = new URL(trimmed);
|
|
140
|
+
} catch {
|
|
141
|
+
return {
|
|
142
|
+
ok: false,
|
|
143
|
+
reason: "Not a URL — include http:// or https://."
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (parsed.protocol !== "https:" && parsed.protocol !== "http:") return {
|
|
147
|
+
ok: false,
|
|
148
|
+
reason: "Use an http:// or https:// address."
|
|
149
|
+
};
|
|
150
|
+
if (parsed.username !== "" || parsed.password !== "") return {
|
|
151
|
+
ok: false,
|
|
152
|
+
reason: "The address must not carry a user name or password."
|
|
153
|
+
};
|
|
154
|
+
if (parsed.hostname === "") return {
|
|
155
|
+
ok: false,
|
|
156
|
+
reason: "The address has no host."
|
|
157
|
+
};
|
|
158
|
+
if (isLoopbackHost(parsed.hostname)) return {
|
|
159
|
+
ok: false,
|
|
160
|
+
reason: "A loopback address names whoever dials it, never this hub — use an address other machines reach."
|
|
161
|
+
};
|
|
162
|
+
if (parsed.pathname !== "/" || parsed.search !== "" || parsed.hash !== "") return {
|
|
163
|
+
ok: false,
|
|
164
|
+
reason: "Enter only the address (scheme, host and port), without a path."
|
|
165
|
+
};
|
|
166
|
+
return {
|
|
167
|
+
ok: true,
|
|
168
|
+
baseUrl: parsed.origin
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
/** The reason a plain-http public endpoint is refused unless accepted. */
|
|
172
|
+
var PUBLIC_ENDPOINT_HTTP_REASON = "The public endpoint needs an https:// address: passkeys and most identity providers refuse a plain-http origin. Accept http only when sign-in and notification links never leave your own network.";
|
|
173
|
+
/**
|
|
174
|
+
* May `baseUrl` carry `role`? The address check above, plus two role rules:
|
|
175
|
+
* the app link carries `notificationTaps` only (it is not a hub address), and
|
|
176
|
+
* a plain-http address carries `publicEndpoint` only when the operator
|
|
177
|
+
* explicitly accepted it (`acceptInsecureHttp`) — a LAN-only password
|
|
178
|
+
* sign-in works over http, a passkey or an OIDC callback does not.
|
|
179
|
+
*/
|
|
180
|
+
function checkRoleAddress(role, baseUrl, options = {}) {
|
|
181
|
+
if (isAppLinkBase(baseUrl)) return role === "notificationTaps" ? {
|
|
182
|
+
ok: true,
|
|
183
|
+
baseUrl: CAMSTACK_APP_LINK_ORIGIN
|
|
184
|
+
} : {
|
|
185
|
+
ok: false,
|
|
186
|
+
reason: "The CamStack app link is not a hub address — only notification taps can use it."
|
|
187
|
+
};
|
|
188
|
+
const check = validateCustomAddress(baseUrl);
|
|
189
|
+
if (!check.ok) return check;
|
|
190
|
+
if (role === "publicEndpoint" && check.baseUrl.startsWith("http:") && options.acceptInsecureHttp !== true) return {
|
|
191
|
+
ok: false,
|
|
192
|
+
reason: PUBLIC_ENDPOINT_HTTP_REASON
|
|
193
|
+
};
|
|
194
|
+
return check;
|
|
195
|
+
}
|
|
196
|
+
/** A stored flag that still validates (stored values are external data). */
|
|
197
|
+
function validFlag(role, flag) {
|
|
198
|
+
if (flag === null || flag === "") return null;
|
|
199
|
+
const check = checkRoleAddress(role, flag, { acceptInsecureHttp: true });
|
|
200
|
+
return check.ok ? check.baseUrl : null;
|
|
201
|
+
}
|
|
202
|
+
function pickAuto(endpoints, role) {
|
|
203
|
+
const best = endpoints.flatMap((endpoint) => {
|
|
204
|
+
const rank = autoRankFor(role, endpoint);
|
|
205
|
+
return rank === null ? [] : [{
|
|
206
|
+
rank,
|
|
207
|
+
priority: endpoint.priority,
|
|
208
|
+
endpoint
|
|
209
|
+
}];
|
|
210
|
+
}).toSorted((a, b) => a.rank - b.rank || a.priority - b.priority)[0];
|
|
211
|
+
return best === void 0 ? null : trimSlash(best.endpoint.baseUrl);
|
|
212
|
+
}
|
|
213
|
+
function resolveHubRole(endpoints, role, flag) {
|
|
214
|
+
const flagged = validFlag(role, flag);
|
|
215
|
+
if (flagged !== null) return {
|
|
216
|
+
flagged,
|
|
217
|
+
resolved: flagged,
|
|
218
|
+
source: "flagged"
|
|
219
|
+
};
|
|
220
|
+
const auto = pickAuto(endpoints, role);
|
|
221
|
+
return {
|
|
222
|
+
flagged: null,
|
|
223
|
+
resolved: auto,
|
|
224
|
+
source: auto === null ? "none" : "auto"
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/** `internal`: what agents and LAN devices download from. */
|
|
228
|
+
function resolveInternalAddress(endpoints, flags) {
|
|
229
|
+
return resolveHubRole(endpoints, "internal", flags.internal);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* `publicEndpoint`: every URL that must work off the LAN — sign-in links, OIDC
|
|
233
|
+
* / OAuth2 callbacks, the relying party, and notification buttons,
|
|
234
|
+
* attachments, media and admin links.
|
|
235
|
+
*/
|
|
236
|
+
function resolvePublicEndpoint(endpoints, flags) {
|
|
237
|
+
return resolveHubRole(endpoints, "publicEndpoint", flags.publicEndpoint);
|
|
238
|
+
}
|
|
239
|
+
/** `notificationTaps`: the flagged address, else the CamStack app link (D709). */
|
|
240
|
+
function resolveNotificationTapAddress(flags) {
|
|
241
|
+
const flagged = validFlag("notificationTaps", flags.notificationTaps);
|
|
242
|
+
if (flagged !== null && !isAppLinkBase(flagged)) return {
|
|
243
|
+
flagged,
|
|
244
|
+
resolved: flagged,
|
|
245
|
+
source: "flagged"
|
|
246
|
+
};
|
|
247
|
+
return {
|
|
248
|
+
flagged: null,
|
|
249
|
+
resolved: CAMSTACK_APP_LINK_ORIGIN,
|
|
250
|
+
source: "auto"
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
/** AUTO app connections: LAN IPv4 + the public tunnel. Never IPv6, mesh, loopback or custom. */
|
|
254
|
+
function isDefaultAppConnectionEndpoint(endpoint) {
|
|
255
|
+
if (isUnstable(endpoint)) return false;
|
|
256
|
+
if (endpoint.kind === "lan-ipv4") return true;
|
|
257
|
+
return endpoint.kind === "public" && endpoint.interfaceKind === "public";
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* The endpoints the apps race: the flagged ones that are in `endpoints`
|
|
261
|
+
* (which carries the custom addresses flagged `appConnections`), else AUTO. A flagged
|
|
262
|
+
* set none of which is currently up falls back to AUTO rather than racing
|
|
263
|
+
* nothing.
|
|
264
|
+
*/
|
|
265
|
+
function selectAppConnectionEndpoints(endpoints, flags) {
|
|
266
|
+
const auto = endpoints.filter(isDefaultAppConnectionEndpoint);
|
|
267
|
+
if (flags.appConnections.length === 0) return auto;
|
|
268
|
+
const wanted = new Set(flags.appConnections);
|
|
269
|
+
const explicit = endpoints.filter((e) => wanted.has(e.baseUrl));
|
|
270
|
+
return explicit.length > 0 ? explicit : auto;
|
|
271
|
+
}
|
|
272
|
+
/** `appConnections`: what the apps try when connecting. */
|
|
273
|
+
function resolveAppConnections(endpoints, flags) {
|
|
274
|
+
const wanted = new Set(flags.appConnections);
|
|
275
|
+
const selected = selectAppConnectionEndpoints(endpoints, flags);
|
|
276
|
+
const usedFlags = selected.some((e) => wanted.has(e.baseUrl));
|
|
277
|
+
return {
|
|
278
|
+
flagged: flags.appConnections,
|
|
279
|
+
resolved: selected.map((e) => e.baseUrl),
|
|
280
|
+
source: selected.length === 0 ? "none" : usedFlags ? "flagged" : "auto"
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Every role at once, each through its own resolver. `appPalette` is what
|
|
285
|
+
* the apps race (it carries the custom addresses flagged `appConnections`);
|
|
286
|
+
* `hubPalette` is the detected HTTPS palette `internal` and `publicEndpoint`
|
|
287
|
+
* resolve over.
|
|
288
|
+
*/
|
|
289
|
+
function resolveHubAddressRoles(appPalette, hubPalette, flags) {
|
|
290
|
+
return {
|
|
291
|
+
appConnections: resolveAppConnections(appPalette, flags),
|
|
292
|
+
notificationTaps: resolveNotificationTapAddress(flags),
|
|
293
|
+
internal: resolveInternalAddress(hubPalette, flags),
|
|
294
|
+
publicEndpoint: resolvePublicEndpoint(hubPalette, flags)
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* How a client finds a hub on the LAN (D838): the hub publishes ONE mDNS
|
|
299
|
+
* service for its HTTPS endpoint. `_camstack._tcp` carries the hub's `internal`
|
|
300
|
+
* address in `url`, and nothing secret — finding a hub grants nothing, every
|
|
301
|
+
* client still signs in. The mesh channel stays retired (D826).
|
|
302
|
+
*/
|
|
303
|
+
var HUB_MDNS_SERVICE_TYPE = "camstack";
|
|
304
|
+
/** The TXT keys of the advertisement. Every value is public. */
|
|
305
|
+
var HUB_MDNS_TXT_KEYS = {
|
|
306
|
+
nodeId: "nodeId",
|
|
307
|
+
version: "version",
|
|
308
|
+
role: "role",
|
|
309
|
+
url: "url",
|
|
310
|
+
/** The hub's announced identity (`hub-<16 hex>`), see {@link isHubId}. */
|
|
311
|
+
hubId: "hubId"
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* How a hub finds agents to pair (D857): every agent publishes ONE mDNS service for its API
|
|
315
|
+
* port, paired or not. The TXT record carries only public facts. Finding an agent grants
|
|
316
|
+
* nothing: pairing still needs the six-digit code confirmed on both screens.
|
|
317
|
+
*/
|
|
318
|
+
var AGENT_MDNS_SERVICE_TYPE = "camstack-agent";
|
|
319
|
+
/** The TXT keys of the agent advertisement. Every value is public. */
|
|
320
|
+
var AGENT_MDNS_TXT_KEYS = {
|
|
321
|
+
nodeId: "nodeId",
|
|
322
|
+
version: "version",
|
|
323
|
+
/** The agent's display name; absent on an older agent. */
|
|
324
|
+
name: "name",
|
|
325
|
+
/** `unpaired` | `pending` | `paired`. */
|
|
326
|
+
state: "state",
|
|
327
|
+
/** First 16 hex chars of the SHA-256 of the agent's mesh leaf; present once paired. */
|
|
328
|
+
keyFingerprint: "fp"
|
|
329
|
+
};
|
|
330
|
+
//#endregion
|
|
331
|
+
//#region ../types/dist/esm/capabilities/local-network.cap.mjs
|
|
332
|
+
/**
|
|
333
|
+
* local-network — hub-only singleton.
|
|
334
|
+
*
|
|
335
|
+
* Enumerates the host's network interfaces and ranks them so that:
|
|
336
|
+
*
|
|
337
|
+
* • Addons that need a "where do we listen / point a tunnel at" answer
|
|
338
|
+
* (cloudflare-tunnel, ngrok, RTSP restream, cluster join URL, TLS
|
|
339
|
+
* cert SAN) consume `getPreferred()` instead of hard-coding
|
|
340
|
+
* `localhost`. Critical for docker-sidecar setups where the addon
|
|
341
|
+
* process needs the container's eth0 (not 127.0.0.1).
|
|
342
|
+
*
|
|
343
|
+
* • The SDK (mobile / web client) consumes `getConnectionEndpoints()`
|
|
344
|
+
* to receive an ordered list of candidate base URLs it should race
|
|
345
|
+
* on connect — LAN IPv4 and stable LAN IPv6 first (lowest latency
|
|
346
|
+
* when on the same network), then public hostname (if a tunnel is
|
|
347
|
+
* up). The SDK can race them with short timeouts and stick with the
|
|
348
|
+
* winner for the session.
|
|
349
|
+
*
|
|
350
|
+
* Why hub-only: agents are not directly addressable by the operator's
|
|
351
|
+
* clients — they reverse-connect to the hub. Exposing their interfaces
|
|
352
|
+
* via the same surface would leak internal topology with no upside.
|
|
353
|
+
*
|
|
354
|
+
* Implementation in `@camstack/server/system/builtins/local-network/`.
|
|
355
|
+
*/
|
|
356
|
+
/** Coarse classification derived from the interface name + IP range. */
|
|
357
|
+
var InterfaceKindEnum = /* @__PURE__ */ zod.z.enum([
|
|
358
|
+
"lan",
|
|
359
|
+
"wifi",
|
|
360
|
+
"docker",
|
|
361
|
+
"vpn",
|
|
362
|
+
"loopback",
|
|
363
|
+
"other"
|
|
364
|
+
]);
|
|
365
|
+
var LocalInterfaceSchema = /* @__PURE__ */ zod.z.object({
|
|
366
|
+
/** Interface name as reported by the OS (e.g. `en0`, `eth0`, `lo0`). */
|
|
367
|
+
name: /* @__PURE__ */ zod.z.string(),
|
|
368
|
+
family: /* @__PURE__ */ zod.z.enum(["IPv4", "IPv6"]),
|
|
369
|
+
address: /* @__PURE__ */ zod.z.string(),
|
|
370
|
+
/** CIDR shorthand (e.g. `192.168.10.10/24`). Empty when OS doesn't expose. */
|
|
371
|
+
cidr: /* @__PURE__ */ zod.z.string(),
|
|
372
|
+
/** OS netmask. Stable across calls so the SDK can hash on it. */
|
|
373
|
+
netmask: /* @__PURE__ */ zod.z.string(),
|
|
374
|
+
/** True for `127.0.0.1`/`::1`. Returned for completeness but never preferred. */
|
|
375
|
+
internal: /* @__PURE__ */ zod.z.boolean(),
|
|
376
|
+
/** Hardware MAC (empty for loopback / virtual interfaces). */
|
|
377
|
+
mac: /* @__PURE__ */ zod.z.string(),
|
|
378
|
+
/** Derived classification — see `InterfaceKindEnum`. */
|
|
379
|
+
kind: InterfaceKindEnum,
|
|
380
|
+
/**
|
|
381
|
+
* `true` for the auto-selected outbound interface. Exactly zero or
|
|
382
|
+
* one entry has this set per call; the SDK picks this one for the
|
|
383
|
+
* first connection attempt.
|
|
384
|
+
*/
|
|
385
|
+
preferred: /* @__PURE__ */ zod.z.boolean(),
|
|
386
|
+
/**
|
|
387
|
+
* Heuristic flag: `true` when the address looks usable for clients
|
|
388
|
+
* (RFC 1918 / public IPv4, IPv6 ULA / GUA), `false` for link-local
|
|
389
|
+
* / loopback / multicast / docker / vpn / unknown ranges. Same
|
|
390
|
+
* heuristic that drives `autoSeedAllowlist`.
|
|
391
|
+
*/
|
|
392
|
+
plausible: /* @__PURE__ */ zod.z.boolean(),
|
|
393
|
+
/**
|
|
394
|
+
* Human-readable rationale for non-plausible entries (e.g. "IPv6
|
|
395
|
+
* link-local — only reachable on the same link"). Empty string for
|
|
396
|
+
* plausible entries. The UI surfaces this verbatim as the tooltip
|
|
397
|
+
* on the "Unlikely usable" badge so the backend stays the single
|
|
398
|
+
* source of truth — front-end consumers don't re-derive the reason.
|
|
399
|
+
*/
|
|
400
|
+
plausibleReason: /* @__PURE__ */ zod.z.string()
|
|
401
|
+
});
|
|
402
|
+
var ListResultSchema = /* @__PURE__ */ zod.z.object({
|
|
403
|
+
interfaces: /* @__PURE__ */ zod.z.array(LocalInterfaceSchema).readonly(),
|
|
404
|
+
/** Wall-clock timestamp at which the snapshot was probed. */
|
|
405
|
+
probedAt: /* @__PURE__ */ zod.z.number()
|
|
406
|
+
});
|
|
407
|
+
var PreferredSchema = /* @__PURE__ */ LocalInterfaceSchema.nullable();
|
|
408
|
+
/**
|
|
409
|
+
* Candidate base URL for the SDK to race on connect. Order matters —
|
|
410
|
+
* the SDK should attempt these top-to-bottom with a short per-candidate
|
|
411
|
+
* timeout (e.g. 1500ms) and cache the winner for the session.
|
|
412
|
+
*/
|
|
413
|
+
var ConnectionEndpointSchema = /* @__PURE__ */ zod.z.object({
|
|
414
|
+
/** Operator-facing label (e.g. "LAN — en0", "Public tunnel"). */
|
|
415
|
+
label: /* @__PURE__ */ zod.z.string(),
|
|
416
|
+
/** Fully-formed base URL with scheme + host + port. */
|
|
417
|
+
baseUrl: /* @__PURE__ */ zod.z.string(),
|
|
418
|
+
/** Network-level hint for the SDK — picks a small icon, sorts within
|
|
419
|
+
* a tier. Coarse categorisation (LAN vs public vs loopback). */
|
|
420
|
+
kind: /* @__PURE__ */ zod.z.enum([
|
|
421
|
+
"lan-ipv4",
|
|
422
|
+
"lan-ipv6",
|
|
423
|
+
"public",
|
|
424
|
+
"loopback",
|
|
425
|
+
"app-link",
|
|
426
|
+
"custom"
|
|
427
|
+
]),
|
|
428
|
+
/**
|
|
429
|
+
* Originating-interface kind — `lan`/`wifi`/`docker`/`vpn`/`other`/
|
|
430
|
+
* `loopback`/`public`. Lets the UI render an accurate badge (e.g. a
|
|
431
|
+
* VPN address gets a "VPN" tag instead of being lumped under
|
|
432
|
+
* "lan-ipv4"). `'public'` for the tunnel hostname.
|
|
433
|
+
*/
|
|
434
|
+
interfaceKind: /* @__PURE__ */ zod.z.enum([
|
|
435
|
+
"lan",
|
|
436
|
+
"wifi",
|
|
437
|
+
"docker",
|
|
438
|
+
"vpn",
|
|
439
|
+
"other",
|
|
440
|
+
"loopback",
|
|
441
|
+
"public"
|
|
442
|
+
]),
|
|
443
|
+
/**
|
|
444
|
+
* Mirrors `LocalInterface.plausible` — false for endpoints derived
|
|
445
|
+
* from non-plausible interfaces (VPN, docker, link-local, …). The
|
|
446
|
+
* UI uses it to mark "Unlikely usable" without re-deriving from
|
|
447
|
+
* the address shape.
|
|
448
|
+
*/
|
|
449
|
+
plausible: /* @__PURE__ */ zod.z.boolean(),
|
|
450
|
+
/** Same as `LocalInterface.plausibleReason` — empty when plausible. */
|
|
451
|
+
plausibleReason: /* @__PURE__ */ zod.z.string(),
|
|
452
|
+
/**
|
|
453
|
+
* Suggested priority for racing — lower = try first. Stable across
|
|
454
|
+
* calls so the client can sort even if the cap returns a new
|
|
455
|
+
* ordering between polls.
|
|
456
|
+
*/
|
|
457
|
+
priority: /* @__PURE__ */ zod.z.number(),
|
|
458
|
+
/**
|
|
459
|
+
* `false` = the address changes on its own (a Quick tunnel, re-issued on
|
|
460
|
+
* every respawn). Automatic role resolution skips it (D860); an explicit
|
|
461
|
+
* operator flag still honours it. Absent = stable.
|
|
462
|
+
*/
|
|
463
|
+
stable: /* @__PURE__ */ zod.z.boolean().optional()
|
|
464
|
+
});
|
|
465
|
+
/**
|
|
466
|
+
* Where the advertised local port came from. Ordered most → least
|
|
467
|
+
* authoritative, and the whole point of returning it: a client must be able to
|
|
468
|
+
* tell a FACT about the hub's socket from an echo of its own guess.
|
|
469
|
+
*/
|
|
470
|
+
var LocalPortSourceEnum = /* @__PURE__ */ zod.z.enum([
|
|
471
|
+
"server-config",
|
|
472
|
+
"server-env",
|
|
473
|
+
"caller-hint",
|
|
474
|
+
"default"
|
|
475
|
+
]);
|
|
476
|
+
/** The port every LAN/loopback `baseUrl` in the same result was built with. */
|
|
477
|
+
var AdvertisedLocalPortSchema = /* @__PURE__ */ zod.z.object({
|
|
478
|
+
port: /* @__PURE__ */ zod.z.number().int().min(1).max(65535),
|
|
479
|
+
source: LocalPortSourceEnum
|
|
480
|
+
});
|
|
481
|
+
var GetConnectionEndpointsResultSchema = /* @__PURE__ */ zod.z.object({
|
|
482
|
+
endpoints: /* @__PURE__ */ zod.z.array(ConnectionEndpointSchema).readonly(),
|
|
483
|
+
/**
|
|
484
|
+
* The port the hub built the LAN/loopback URLs with, and where that number
|
|
485
|
+
* came from.
|
|
486
|
+
*
|
|
487
|
+
* Returned rather than merely applied, because "the URL is right" and "the
|
|
488
|
+
* client can KNOW the URL is right" are different properties. A client that
|
|
489
|
+
* only sees a corrected URL cannot distinguish a hub that fixed the port from
|
|
490
|
+
* a hub that echoed the port the client sent, so it cannot decide whether to
|
|
491
|
+
* race the candidate or discard it. With `source` it can: anything but
|
|
492
|
+
* `caller-hint` is the hub's own socket.
|
|
493
|
+
*
|
|
494
|
+
* Absent on hubs predating this field — a client that finds it missing is
|
|
495
|
+
* talking to an echoing hub and must degrade exactly as it does for
|
|
496
|
+
* `caller-hint`.
|
|
497
|
+
*/
|
|
498
|
+
localPort: AdvertisedLocalPortSchema
|
|
499
|
+
});
|
|
500
|
+
/**
|
|
501
|
+
* The address flagged for notification taps (`notificationTaps`). `baseUrl: null` = AUTO, which
|
|
502
|
+
* since D709 is the CamStack app link; `resolved` reports the effective value,
|
|
503
|
+
* so the UI can show it either way.
|
|
504
|
+
*/
|
|
505
|
+
var NotificationEndpointSchema = /* @__PURE__ */ zod.z.object({
|
|
506
|
+
/** The operator's explicit choice, or null for AUTO. */
|
|
507
|
+
baseUrl: /* @__PURE__ */ zod.z.string().nullable(),
|
|
508
|
+
/**
|
|
509
|
+
* The effective flagged address: the explicit choice, else (AUTO) the
|
|
510
|
+
* CamStack app link `https://camstack.zentik.app` (D709). A pre-D709 hub
|
|
511
|
+
* answered the public tunnel / mesh here, or null.
|
|
512
|
+
*/
|
|
513
|
+
resolved: /* @__PURE__ */ zod.z.string().nullable(),
|
|
514
|
+
/**
|
|
515
|
+
* The hub origin an app link carries as `hub=` (D709): the hub's best
|
|
516
|
+
* public HTTPS address — the tunnel, then the mesh (Tailscale MagicDNS) —
|
|
517
|
+
* picked from this cap's own palette by `pickAppLinkHub`. `null` when the
|
|
518
|
+
* hub advertises neither; the app link is then minted without `hub=`.
|
|
519
|
+
* Absent on a pre-D709 hub.
|
|
520
|
+
*/
|
|
521
|
+
appLinkHub: /* @__PURE__ */ zod.z.string().nullable()
|
|
522
|
+
});
|
|
523
|
+
/**
|
|
524
|
+
* The URLs the SDK / viewer should race for API access. `baseUrls` empty =
|
|
525
|
+
* AUTO (every LAN IPv4 + the public tunnel). `resolved` is what that choice
|
|
526
|
+
* currently expands to, so the UI can show the effective set either way.
|
|
527
|
+
*/
|
|
528
|
+
var ViewerEndpointsSchema = /* @__PURE__ */ zod.z.object({
|
|
529
|
+
/** The operator's explicit race set, or empty for AUTO. */
|
|
530
|
+
baseUrls: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).readonly(),
|
|
531
|
+
/** What the ranking currently resolves to (may be empty if nothing is up). */
|
|
532
|
+
resolved: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).readonly()
|
|
533
|
+
});
|
|
534
|
+
/**
|
|
535
|
+
* DEPRECATED compatibility shape of `getHubAddresses` (D729 amendment, kept
|
|
536
|
+
* for addons built against it): `cluster` is the `internal` role, `browser`
|
|
537
|
+
* the `publicEndpoint` role; `override` is the flagged address.
|
|
538
|
+
*/
|
|
539
|
+
var HubAddressSnapshotSchema = /* @__PURE__ */ zod.z.object({
|
|
540
|
+
override: /* @__PURE__ */ zod.z.string().nullable(),
|
|
541
|
+
resolved: /* @__PURE__ */ zod.z.string().nullable(),
|
|
542
|
+
source: /* @__PURE__ */ zod.z.enum([
|
|
543
|
+
"override",
|
|
544
|
+
"auto",
|
|
545
|
+
"none"
|
|
546
|
+
])
|
|
547
|
+
});
|
|
548
|
+
var HubAddressesSchema = /* @__PURE__ */ zod.z.object({
|
|
549
|
+
cluster: HubAddressSnapshotSchema,
|
|
550
|
+
browser: HubAddressSnapshotSchema
|
|
551
|
+
});
|
|
552
|
+
/**
|
|
553
|
+
* What an address is used for (`hub-address.ts`, D734). `appConnections` is
|
|
554
|
+
* many-valued; `notificationTaps`, `publicEndpoint` and `internal` are carried
|
|
555
|
+
* by at most one address.
|
|
556
|
+
*/
|
|
557
|
+
var HubAddressRoleSchema = /* @__PURE__ */ zod.z.enum(HUB_ADDRESS_ROLES);
|
|
558
|
+
var RoleSourceSchema = /* @__PURE__ */ zod.z.enum([
|
|
559
|
+
"flagged",
|
|
560
|
+
"auto",
|
|
561
|
+
"none"
|
|
562
|
+
]);
|
|
563
|
+
/** One single-valued role: the flagged address, the one in use, and why. */
|
|
564
|
+
var HubAddressRoleResolutionSchema = /* @__PURE__ */ zod.z.object({
|
|
565
|
+
/** The address carrying the flag, or null = automatic. */
|
|
566
|
+
flagged: /* @__PURE__ */ zod.z.string().nullable(),
|
|
567
|
+
/** The address in use, or null when nothing qualifies (never loopback). */
|
|
568
|
+
resolved: /* @__PURE__ */ zod.z.string().nullable(),
|
|
569
|
+
source: RoleSourceSchema
|
|
570
|
+
});
|
|
571
|
+
var HubAppConnectionsResolutionSchema = /* @__PURE__ */ zod.z.object({
|
|
572
|
+
/** The addresses flagged `appConnections`, or empty = automatic. */
|
|
573
|
+
flagged: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).readonly(),
|
|
574
|
+
/** What the apps race right now. */
|
|
575
|
+
resolved: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).readonly(),
|
|
576
|
+
source: RoleSourceSchema
|
|
577
|
+
});
|
|
578
|
+
/**
|
|
579
|
+
* One row of the Network page's Addresses table: a detected endpoint, an
|
|
580
|
+
* operator-entered custom address, or the CamStack app link — flagged the
|
|
581
|
+
* same way. A URL that is both detected and entered is ONE row.
|
|
582
|
+
*/
|
|
583
|
+
var HubAddressRowSchema = /* @__PURE__ */ ConnectionEndpointSchema.extend({
|
|
584
|
+
/** In the hub's detected palette right now. */
|
|
585
|
+
detected: /* @__PURE__ */ zod.z.boolean(),
|
|
586
|
+
/** Entered by the operator (removable). */
|
|
587
|
+
custom: /* @__PURE__ */ zod.z.boolean(),
|
|
588
|
+
/** The roles explicitly flagged on this address. */
|
|
589
|
+
flags: /* @__PURE__ */ zod.z.array(HubAddressRoleSchema).readonly(),
|
|
590
|
+
/** The roles this address serves right now — flagged or automatic. */
|
|
591
|
+
inUse: /* @__PURE__ */ zod.z.array(HubAddressRoleSchema).readonly(),
|
|
592
|
+
/** The roles this address may be flagged with. */
|
|
593
|
+
eligible: /* @__PURE__ */ zod.z.array(HubAddressRoleSchema).readonly()
|
|
594
|
+
});
|
|
595
|
+
var HubAddressBookSchema = /* @__PURE__ */ zod.z.object({
|
|
596
|
+
rows: /* @__PURE__ */ zod.z.array(HubAddressRowSchema).readonly(),
|
|
597
|
+
roles: /* @__PURE__ */ zod.z.object({
|
|
598
|
+
appConnections: HubAppConnectionsResolutionSchema,
|
|
599
|
+
notificationTaps: HubAddressRoleResolutionSchema,
|
|
600
|
+
internal: HubAddressRoleResolutionSchema,
|
|
601
|
+
publicEndpoint: HubAddressRoleResolutionSchema
|
|
602
|
+
}),
|
|
603
|
+
/** The `hub=` an app link carries (D709), or null. */
|
|
604
|
+
appLinkHub: /* @__PURE__ */ zod.z.string().nullable(),
|
|
605
|
+
/**
|
|
606
|
+
* Every origin a browser can really reach this hub at, in the scheme each
|
|
607
|
+
* listener serves: `https://<lan>:<httpsPort>`, and `http://<lan>:<httpPort>`
|
|
608
|
+
* while LAN HTTP is on, plus the public and custom addresses. Distinct from
|
|
609
|
+
* `rows`, which show `http://` only while LAN HTTP is on. Never loopback,
|
|
610
|
+
* never the app link. Absent on a hub older than D794's amendment.
|
|
611
|
+
*/
|
|
612
|
+
listenerOrigins: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).readonly().optional()
|
|
613
|
+
});
|
|
614
|
+
var AllowedAddressesSchema = /* @__PURE__ */ zod.z.object({
|
|
615
|
+
/**
|
|
616
|
+
* Allowlist of interface addresses operators have explicitly opted
|
|
617
|
+
* into for the connection-endpoint race. Empty array = "auto" — every
|
|
618
|
+
* non-loopback / non-link-local interface participates. Set by the
|
|
619
|
+
* Network Addresses admin page and persisted by the addon.
|
|
620
|
+
*/
|
|
621
|
+
addresses: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).readonly() });
|
|
622
|
+
var TlsStatusSchema = /* @__PURE__ */ zod.z.object({
|
|
623
|
+
mode: /* @__PURE__ */ zod.z.enum([
|
|
624
|
+
"generated",
|
|
625
|
+
"uploaded",
|
|
626
|
+
"disabled"
|
|
627
|
+
]),
|
|
628
|
+
leafFingerprintSha256: /* @__PURE__ */ zod.z.string().nullable(),
|
|
629
|
+
caFingerprintSha256: /* @__PURE__ */ zod.z.string().nullable(),
|
|
630
|
+
validTo: /* @__PURE__ */ zod.z.string().nullable(),
|
|
631
|
+
sans: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()),
|
|
632
|
+
caCertPem: /* @__PURE__ */ zod.z.string().nullable(),
|
|
633
|
+
reissueError: /* @__PURE__ */ zod.z.string().nullable(),
|
|
634
|
+
restartRequired: /* @__PURE__ */ zod.z.boolean(),
|
|
635
|
+
/** An uploaded certificate is served but no CA is kept for it and it is not publicly signed (D873). */
|
|
636
|
+
caMissing: /* @__PURE__ */ zod.z.boolean(),
|
|
637
|
+
/** Does the hub's own generated CA carry a critical name constraint? `null` while it has none. */
|
|
638
|
+
localCaConstrained: /* @__PURE__ */ zod.z.boolean().nullable(),
|
|
639
|
+
/** ISO time the generated CA was replaced by a constrained one; devices must re-download it. */
|
|
640
|
+
caReplacedAt: /* @__PURE__ */ zod.z.string().nullable(),
|
|
641
|
+
/** The uploaded certificate kept on disk, selectable again after "Revert to generated". */
|
|
642
|
+
storedUpload: /* @__PURE__ */ zod.z.object({
|
|
643
|
+
leafFingerprintSha256: /* @__PURE__ */ zod.z.string(),
|
|
644
|
+
validTo: /* @__PURE__ */ zod.z.string(),
|
|
645
|
+
hasCa: /* @__PURE__ */ zod.z.boolean()
|
|
646
|
+
}).nullable()
|
|
647
|
+
});
|
|
648
|
+
/** One provider's ask of the scan engine: the modes it declared. */
|
|
649
|
+
var ScanRequestSchema = /* @__PURE__ */ zod.z.object({
|
|
650
|
+
providerId: /* @__PURE__ */ zod.z.string().min(1),
|
|
651
|
+
modes: /* @__PURE__ */ zod.z.array(require_device_provider_cap.DiscoveryModeSchema)
|
|
652
|
+
});
|
|
653
|
+
var ScanErrorSchema = /* @__PURE__ */ zod.z.object({
|
|
654
|
+
/** Absent for a failure that is the scan's own (a bad subnet, a socket that would not open). */
|
|
655
|
+
providerId: /* @__PURE__ */ zod.z.string().optional(),
|
|
656
|
+
/** The mode family that failed (`mdns`, `http-probe`, …). */
|
|
657
|
+
mode: /* @__PURE__ */ zod.z.string().optional(),
|
|
658
|
+
message: /* @__PURE__ */ zod.z.string()
|
|
659
|
+
});
|
|
660
|
+
/** What one scan did, per mode family; the engine logs the same numbers once. */
|
|
661
|
+
var ScanStatsSchema = /* @__PURE__ */ zod.z.object({
|
|
662
|
+
hostsProbed: /* @__PURE__ */ zod.z.number().int(),
|
|
663
|
+
hits: /* @__PURE__ */ zod.z.number().int(),
|
|
664
|
+
timeouts: /* @__PURE__ */ zod.z.number().int(),
|
|
665
|
+
byMode: /* @__PURE__ */ zod.z.record(/* @__PURE__ */ zod.z.string(), /* @__PURE__ */ zod.z.object({
|
|
666
|
+
probed: /* @__PURE__ */ zod.z.number().int(),
|
|
667
|
+
hits: /* @__PURE__ */ zod.z.number().int(),
|
|
668
|
+
timeouts: /* @__PURE__ */ zod.z.number().int()
|
|
669
|
+
}))
|
|
670
|
+
});
|
|
671
|
+
var ScanNetworkResultSchema = /* @__PURE__ */ zod.z.object({
|
|
672
|
+
hits: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.object({
|
|
673
|
+
providerId: /* @__PURE__ */ zod.z.string(),
|
|
674
|
+
hit: require_device_provider_cap.DiscoveryHitSchema
|
|
675
|
+
})),
|
|
676
|
+
/** CIDRs actually covered: the hub's own /24s, the saved list and the per-call list. */
|
|
677
|
+
subnetsScanned: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()),
|
|
678
|
+
errors: /* @__PURE__ */ zod.z.array(ScanErrorSchema),
|
|
679
|
+
stats: ScanStatsSchema
|
|
680
|
+
});
|
|
681
|
+
var localNetworkCapability = {
|
|
682
|
+
name: "local-network",
|
|
683
|
+
scope: "system",
|
|
684
|
+
mode: "singleton",
|
|
685
|
+
methods: {
|
|
686
|
+
/** Return the current interface snapshot. */
|
|
687
|
+
list: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), ListResultSchema),
|
|
688
|
+
/**
|
|
689
|
+
* Auto-selected outbound interface. Heuristic:
|
|
690
|
+
* 1. Skip internal / link-local / 169.254.*.
|
|
691
|
+
* 2. Prefer LAN/wifi (real Ethernet) over docker/vpn.
|
|
692
|
+
* 3. IPv4 wins over IPv6 (compat with legacy consumers).
|
|
693
|
+
* 4. Tie-break on lowest CIDR mask (most-specific subnet).
|
|
694
|
+
* Returns `null` only when the host has zero non-loopback addresses.
|
|
695
|
+
* Honours `getAllowedAddresses()` — if the operator pinned an
|
|
696
|
+
* allowlist, only those addresses are candidates.
|
|
697
|
+
*/
|
|
698
|
+
getPreferred: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), PreferredSchema),
|
|
699
|
+
/**
|
|
700
|
+
* Ordered candidate base URLs (the palette the Network tab shows).
|
|
701
|
+
* Includes LAN IPv4, stable LAN IPv6, the public tunnel, and mesh when
|
|
702
|
+
* joined. Loopback is off by default. The SDK races the subset from
|
|
703
|
+
* `getViewerEndpoints`, not this full list — IPv6 stays here because
|
|
704
|
+
* WebRTC ICE gathers dual-stack regardless of the HTTP race. Honours
|
|
705
|
+
* `getAllowedAddresses()` when set — addresses outside the allowlist
|
|
706
|
+
* are dropped (the public tunnel is still included as an escape hatch).
|
|
707
|
+
*
|
|
708
|
+
* **The port is the hub's, not the caller's** (D62 — a function's fact
|
|
709
|
+
* belongs to whoever already owns it). This method used to take a `port`
|
|
710
|
+
* and echo it onto every LAN and loopback URL it advertised, which made
|
|
711
|
+
* every client a second authority on a socket only the hub binds. A viewer
|
|
712
|
+
* configured with a port-less public URL (`https://camstack.example.top`)
|
|
713
|
+
* infers 443 from the scheme, asks with 443, and was handed
|
|
714
|
+
* `https://192.168.10.9:443` for a hub listening on 4443. That candidate
|
|
715
|
+
* cannot ever answer, and losing its race reads in the log exactly like
|
|
716
|
+
* "the LAN was tried and it was slower" — so an operator sitting on his own
|
|
717
|
+
* WiFi stayed on the public tunnel for weeks, with the LAN candidate born
|
|
718
|
+
* dead on every single connect.
|
|
719
|
+
*
|
|
720
|
+
* The hub now resolves its own listen port and reports it as `localPort`,
|
|
721
|
+
* with the SOURCE of the number, so a client can tell a fact from an echo.
|
|
722
|
+
*
|
|
723
|
+
* Out of scope on purpose: a LAN URL that is not the hub's own socket (a
|
|
724
|
+
* reverse proxy in front of it on another port) is not this method's to
|
|
725
|
+
* invent either — pin it with `setNotificationEndpoint` / a configured
|
|
726
|
+
* origin, which is an operator statement rather than a guess.
|
|
727
|
+
*/
|
|
728
|
+
getConnectionEndpoints: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
729
|
+
/**
|
|
730
|
+
* LEGACY HINT — do not send from new code. Kept optional so clients
|
|
731
|
+
* written against the echoing contract keep working; the hub uses it
|
|
732
|
+
* only when it cannot read its own port, and says so via
|
|
733
|
+
* `localPort.source === 'caller-hint'`.
|
|
734
|
+
*/
|
|
735
|
+
port: /* @__PURE__ */ zod.z.number().int().min(1).max(65535).optional(),
|
|
736
|
+
/** Include `http(s)://127.0.0.1:<port>` as the lowest-priority
|
|
737
|
+
* candidate. Default `false` — loopback is not a client route. */
|
|
738
|
+
includeLoopback: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
739
|
+
/** Skip IPv6 entries. Default `false` — the palette includes stable
|
|
740
|
+
* LAN IPv6 (ICE/WebRTC uses dual-stack regardless). Pass `true` to
|
|
741
|
+
* hide them. The viewer HTTP/WS race is `getViewerEndpoints`. */
|
|
742
|
+
ipv4Only: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
743
|
+
/** Scheme to emit for LAN/loopback URLs. Default `'http'`.
|
|
744
|
+
* Pass `'https'` when the caller is itself loaded over HTTPS
|
|
745
|
+
* to avoid mixed-content blocks in the browser. The public
|
|
746
|
+
* tunnel always emits `https://` regardless. */
|
|
747
|
+
scheme: /* @__PURE__ */ zod.z.enum(["http", "https"]).optional(),
|
|
748
|
+
/** Append the CamStack app link entry (`kind: 'app-link'`, D709) —
|
|
749
|
+
* an address notification taps can be flagged with, not a hub
|
|
750
|
+
* route. Default `false`: racers and rankers never see it. */
|
|
751
|
+
includeAppLink: /* @__PURE__ */ zod.z.boolean().optional()
|
|
752
|
+
}), GetConnectionEndpointsResultSchema),
|
|
753
|
+
/**
|
|
754
|
+
* The `notificationTaps` role (D734): where TAPPING a notification opens.
|
|
755
|
+
* `baseUrl: null` means AUTO, which is the CamStack app link (D709): taps
|
|
756
|
+
* go through `https://camstack.zentik.app/…?hub=<appLinkHub>` and open the
|
|
757
|
+
* app. Any hub address the palette lists can be flagged instead; then a
|
|
758
|
+
* tap opens that address. Only the tap: action buttons, attachment /
|
|
759
|
+
* media links and admin links follow the `publicEndpoint` role
|
|
760
|
+
* (`getAddresses().roles.publicEndpoint`), never this one.
|
|
761
|
+
*
|
|
762
|
+
* Why an explicit marker: the automatic ranking cannot know which of
|
|
763
|
+
* several reachable addresses the RECIPIENT can actually open. A link is
|
|
764
|
+
* consumed on someone's phone, off the LAN, possibly hours later — and a
|
|
765
|
+
* link nobody can open is worse than no link, because the notification
|
|
766
|
+
* arrives advertising media that 404s.
|
|
767
|
+
*/
|
|
768
|
+
getNotificationEndpoint: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), NotificationEndpointSchema),
|
|
769
|
+
/**
|
|
770
|
+
* @deprecated Use `setAddressRole({ role: 'notificationTaps', … })`. It
|
|
771
|
+
* writes the same `notificationTaps` flag, with the same validation. `baseUrl: null` restores automatic; an
|
|
772
|
+
* address that is not detected becomes a custom address.
|
|
773
|
+
*/
|
|
774
|
+
setNotificationEndpoint: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ baseUrl: /* @__PURE__ */ zod.z.string().nullable() }), NotificationEndpointSchema, { kind: "mutation" }),
|
|
775
|
+
/**
|
|
776
|
+
* The `appConnections` role as shipped apps read it: the flagged addresses
|
|
777
|
+
* (detected or custom), or empty for AUTO — every LAN IPv4 address plus
|
|
778
|
+
* the public tunnel, never IPv6, mesh, loopback or a custom address.
|
|
779
|
+
* `resolved` is the set as it stands right now; the custom ones in it are
|
|
780
|
+
* also in `getConnectionEndpoints`, which the apps filter by it.
|
|
781
|
+
*/
|
|
782
|
+
getViewerEndpoints: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), ViewerEndpointsSchema),
|
|
783
|
+
/**
|
|
784
|
+
* @deprecated Use `setAddressRole({ role: 'appConnections', … })`. It
|
|
785
|
+
* replaces the same `appConnections` flags.
|
|
786
|
+
* Empty `baseUrls` restores automatic.
|
|
787
|
+
*/
|
|
788
|
+
setViewerEndpoints: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ baseUrls: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).readonly() }), ViewerEndpointsSchema, { kind: "mutation" }),
|
|
789
|
+
/**
|
|
790
|
+
* The Network page's Addresses table and every role's answer — the ONE
|
|
791
|
+
* reading of "which address is this hub reached at, for what": detected
|
|
792
|
+
* endpoints and custom addresses with their role flags, and per role the
|
|
793
|
+
* flagged address, the one in use and whether it is automatic. Agent
|
|
794
|
+
* deliveries and LAN devices read `roles.internal`; sign-in, OAuth2 and
|
|
795
|
+
* the notification centre's buttons / media / admin links read
|
|
796
|
+
* `roles.publicEndpoint`; nothing ranks the palette itself. `scheme` is
|
|
797
|
+
* the one the caller shows LAN rows in (as `getConnectionEndpoints`);
|
|
798
|
+
* `internal` and `publicEndpoint` are always resolved over the HTTPS
|
|
799
|
+
* palette.
|
|
800
|
+
*/
|
|
801
|
+
getAddresses: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ scheme: /* @__PURE__ */ zod.z.enum(["http", "https"]).optional() }).optional(), HubAddressBookSchema),
|
|
802
|
+
/**
|
|
803
|
+
* Add a custom address. Validated: an http(s) origin with a host, no
|
|
804
|
+
* credentials, no path, never loopback — an invalid one is refused with
|
|
805
|
+
* the reason and nothing is stored. Adding an address that already exists
|
|
806
|
+
* only updates its label.
|
|
807
|
+
*/
|
|
808
|
+
addCustomAddress: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
809
|
+
baseUrl: /* @__PURE__ */ zod.z.string(),
|
|
810
|
+
label: /* @__PURE__ */ zod.z.string().max(80)
|
|
811
|
+
}), HubAddressBookSchema, {
|
|
812
|
+
kind: "mutation",
|
|
813
|
+
auth: "admin"
|
|
814
|
+
}),
|
|
815
|
+
/** Remove a custom address. Its role flags go with it (those roles turn automatic). */
|
|
816
|
+
removeCustomAddress: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ baseUrl: /* @__PURE__ */ zod.z.string() }), HubAddressBookSchema, {
|
|
817
|
+
kind: "mutation",
|
|
818
|
+
auth: "admin"
|
|
819
|
+
}),
|
|
820
|
+
/**
|
|
821
|
+
* Flag (`enabled: true`) or unflag an address for a role. For a
|
|
822
|
+
* single-valued role, flagging moves the flag off every other address.
|
|
823
|
+
* `baseUrl: null` returns the role to automatic. The address must be a row
|
|
824
|
+
* of the table (detected, custom, or the app link for `notificationTaps`);
|
|
825
|
+
* `publicEndpoint` on a plain-http address is refused unless
|
|
826
|
+
* `acceptInsecureHttp`, and never takes the app link.
|
|
827
|
+
*/
|
|
828
|
+
setAddressRole: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
829
|
+
role: HubAddressRoleSchema,
|
|
830
|
+
baseUrl: /* @__PURE__ */ zod.z.string().nullable(),
|
|
831
|
+
enabled: /* @__PURE__ */ zod.z.boolean(),
|
|
832
|
+
acceptInsecureHttp: /* @__PURE__ */ zod.z.boolean().optional()
|
|
833
|
+
}), HubAddressBookSchema, {
|
|
834
|
+
kind: "mutation",
|
|
835
|
+
auth: "admin"
|
|
836
|
+
}),
|
|
837
|
+
/**
|
|
838
|
+
* @deprecated Read `getAddresses().roles.internal` / `.publicEndpoint`.
|
|
839
|
+
* Kept so an addon built against the D729 amendment keeps resolving:
|
|
840
|
+
* `cluster` = the `internal` role, `browser` = the `publicEndpoint` role.
|
|
841
|
+
*/
|
|
842
|
+
getHubAddresses: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), HubAddressesSchema),
|
|
843
|
+
/**
|
|
844
|
+
* Read the operator's allowlist. Empty = "auto" (no filter). Used
|
|
845
|
+
* by the admin UI's address selector to seed its checkbox state.
|
|
846
|
+
*/
|
|
847
|
+
getAllowedAddresses: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), AllowedAddressesSchema),
|
|
848
|
+
/**
|
|
849
|
+
* Replace the allowlist atomically. Persisted via the addon store
|
|
850
|
+
* (kernel-managed) so it survives restarts. Pass `[]` to revert to
|
|
851
|
+
* auto mode.
|
|
852
|
+
*/
|
|
853
|
+
setAllowedAddresses: /* @__PURE__ */ require_capability_definition.method(AllowedAddressesSchema, /* @__PURE__ */ zod.z.object({ success: /* @__PURE__ */ zod.z.literal(true) }), { kind: "mutation" }),
|
|
854
|
+
/**
|
|
855
|
+
* Re-run the boot heuristic over the current interface snapshot
|
|
856
|
+
* and atomically replace the allowlist with the result. Useful
|
|
857
|
+
* after a major network change (new dock, new VPN, IP rebound)
|
|
858
|
+
* when the operator wants to wipe their manual edits and start
|
|
859
|
+
* over from the auto-detected best matches.
|
|
860
|
+
*/
|
|
861
|
+
resetAllowlistToBestMatch: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), AllowedAddressesSchema, { kind: "mutation" }),
|
|
862
|
+
/**
|
|
863
|
+
* Live TLS material for the Network → Local access certificate card.
|
|
864
|
+
* LAN HTTP / hostname are scoped settings (the cap's own form), not
|
|
865
|
+
* a second store — this query is status, not configuration.
|
|
866
|
+
*/
|
|
867
|
+
getTlsStatus: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), TlsStatusSchema),
|
|
868
|
+
/** Issue a new leaf under the existing local CA. Disabled in uploaded mode. */
|
|
869
|
+
regenerateCertificate: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ reason: /* @__PURE__ */ zod.z.string().optional() }), TlsStatusSchema, {
|
|
870
|
+
kind: "mutation",
|
|
871
|
+
auth: "admin"
|
|
872
|
+
}),
|
|
873
|
+
/**
|
|
874
|
+
* Replace the served material with operator-supplied PEMs. A certificate that does not lead
|
|
875
|
+
* to a public CA must come with its CA certificate, validated and kept for Download CA (D873).
|
|
876
|
+
*/
|
|
877
|
+
uploadCertificate: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
878
|
+
certPem: /* @__PURE__ */ zod.z.string().min(1),
|
|
879
|
+
keyPem: /* @__PURE__ */ zod.z.string().min(1),
|
|
880
|
+
caPem: /* @__PURE__ */ zod.z.string().optional()
|
|
881
|
+
}), TlsStatusSchema, {
|
|
882
|
+
kind: "mutation",
|
|
883
|
+
auth: "admin"
|
|
884
|
+
}),
|
|
885
|
+
/** The local CA PEM, or empty when there is none to download. */
|
|
886
|
+
downloadCa: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), /* @__PURE__ */ zod.z.object({ pem: /* @__PURE__ */ zod.z.string() })),
|
|
887
|
+
/**
|
|
888
|
+
* Serve the kept upload again after "Revert to generated" (D873). Refused when none is kept.
|
|
889
|
+
*/
|
|
890
|
+
useStoredUploadedCertificate: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), TlsStatusSchema, {
|
|
891
|
+
kind: "mutation",
|
|
892
|
+
auth: "admin"
|
|
893
|
+
}),
|
|
894
|
+
/**
|
|
895
|
+
* The LAN discovery engine. Every provider that declared discovery modes
|
|
896
|
+
* (`device-provider.getDiscoveryModes`) is scanned in ONE pass: a single
|
|
897
|
+
* mDNS browse for the union of service types, one WS-Discovery probe, one
|
|
898
|
+
* SSDP search per target and one sweep that visits each host once and runs
|
|
899
|
+
* every http-probe of every provider. Subnets scanned = the hub's own
|
|
900
|
+
* non-internal IPv4 /24s ∪ the saved list (`getScanSubnets`) ∪ `subnets`.
|
|
901
|
+
* A bad CIDR, or more than 4096 hosts in total, refuses the scan.
|
|
902
|
+
*/
|
|
903
|
+
scanNetwork: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({
|
|
904
|
+
requests: /* @__PURE__ */ zod.z.array(ScanRequestSchema),
|
|
905
|
+
subnets: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()).optional()
|
|
906
|
+
}), ScanNetworkResultSchema, {
|
|
907
|
+
kind: "mutation",
|
|
908
|
+
auth: "admin",
|
|
909
|
+
timeoutMs: 9e4
|
|
910
|
+
}),
|
|
911
|
+
/** Extra subnets every scan covers besides the hub's own, as CIDR strings. */
|
|
912
|
+
getScanSubnets: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), /* @__PURE__ */ zod.z.object({ subnets: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()) }), { auth: "admin" }),
|
|
913
|
+
/**
|
|
914
|
+
* Replace the saved extra subnets (a cluster setting). Each entry is IPv4
|
|
915
|
+
* CIDR, at most a /22; the list is refused when it is invalid or its hosts
|
|
916
|
+
* would exceed the scan cap.
|
|
917
|
+
*/
|
|
918
|
+
setScanSubnets: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.object({ subnets: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()) }), /* @__PURE__ */ zod.z.object({ subnets: /* @__PURE__ */ zod.z.array(/* @__PURE__ */ zod.z.string()) }), {
|
|
919
|
+
kind: "mutation",
|
|
920
|
+
auth: "admin"
|
|
921
|
+
}),
|
|
922
|
+
/** Return to the generated local CA. The uploaded certificate stays stored (D873). */
|
|
923
|
+
revertToGeneratedCertificate: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), TlsStatusSchema, {
|
|
924
|
+
kind: "mutation",
|
|
925
|
+
auth: "admin"
|
|
926
|
+
})
|
|
927
|
+
},
|
|
928
|
+
/** BIG PLAN 2: declarative mount hint — read by `@camstack/server/system` `buildCapRouters`. */
|
|
929
|
+
mount: { kind: "hub-only" },
|
|
930
|
+
vocabulary: { notOperatorFacing: require_system_reasons.NOT_A_DEVICE.NETWORK }
|
|
931
|
+
};
|
|
932
|
+
//#endregion
|
|
933
|
+
//#region ../types/dist/esm/capabilities/network-access.cap.mjs
|
|
934
|
+
var NetworkEndpointSchema = /* @__PURE__ */ zod.z.object({
|
|
935
|
+
url: /* @__PURE__ */ zod.z.string(),
|
|
936
|
+
hostname: /* @__PURE__ */ zod.z.string(),
|
|
937
|
+
port: /* @__PURE__ */ zod.z.number(),
|
|
938
|
+
protocol: /* @__PURE__ */ zod.z.enum(["http", "https"]),
|
|
939
|
+
/**
|
|
940
|
+
* Whether this address survives a restart of its provider. `false` = it is
|
|
941
|
+
* re-issued every time (a Quick tunnel's random `*.trycloudflare.com`); the
|
|
942
|
+
* hub never selects such an address AUTOMATICALLY for a role (D860), though
|
|
943
|
+
* it stays visible and an operator may still flag it. Absent = stable: every
|
|
944
|
+
* provider except a Quick tunnel owns a name that does not change.
|
|
945
|
+
*/
|
|
946
|
+
stable: /* @__PURE__ */ zod.z.boolean().optional()
|
|
947
|
+
});
|
|
948
|
+
/**
|
|
949
|
+
* `data` of a `network.tunnel.started` event — what `local-network` (which
|
|
950
|
+
* tails the bus and cannot import a provider) learns about the new address.
|
|
951
|
+
*/
|
|
952
|
+
var NetworkTunnelStartedDataSchema = /* @__PURE__ */ zod.z.object({
|
|
953
|
+
url: /* @__PURE__ */ zod.z.string(),
|
|
954
|
+
/** Mirrors {@link NetworkEndpointSchema} `stable`; absent = stable. */
|
|
955
|
+
stable: /* @__PURE__ */ zod.z.boolean().optional(),
|
|
956
|
+
updated: /* @__PURE__ */ zod.z.boolean().optional()
|
|
957
|
+
});
|
|
958
|
+
var NetworkAccessStatusSchema = /* @__PURE__ */ zod.z.object({
|
|
959
|
+
connected: /* @__PURE__ */ zod.z.boolean(),
|
|
960
|
+
endpoint: /* @__PURE__ */ NetworkEndpointSchema.nullable(),
|
|
961
|
+
error: /* @__PURE__ */ zod.z.string().optional()
|
|
962
|
+
});
|
|
963
|
+
/**
|
|
964
|
+
* Optional, richer endpoint shape returned by providers that expose
|
|
965
|
+
* MORE than one ingress concurrently (Tailscale Funnel with mixed
|
|
966
|
+
* serve+funnel rules, future ngrok multi-tunnel, …). Each entry carries
|
|
967
|
+
* the originating provider config (mode + sourcePort) so the
|
|
968
|
+
* orchestrator UI can label rows distinctly. Providers that expose only
|
|
969
|
+
* one endpoint just omit `listEndpoints` from their provider impl.
|
|
970
|
+
*/
|
|
971
|
+
var NetworkEndpointEntrySchema = /* @__PURE__ */ NetworkEndpointSchema.extend({
|
|
972
|
+
/**
|
|
973
|
+
* Stable id within the provider — typically `<mode>-<sourcePort>` so
|
|
974
|
+
* the orchestrator can dedupe across `listEndpoints` polls.
|
|
975
|
+
*/
|
|
976
|
+
id: /* @__PURE__ */ zod.z.string(),
|
|
977
|
+
/** Operator-facing label (mirrors `MeshEndpoint.label`). */
|
|
978
|
+
label: /* @__PURE__ */ zod.z.string(),
|
|
979
|
+
/** Optional provider-specific mode tag, used for icon/colour in admin UI. */
|
|
980
|
+
mode: /* @__PURE__ */ zod.z.string().optional(),
|
|
981
|
+
/** Originating local port the ingress fronts (informational). */
|
|
982
|
+
sourcePort: /* @__PURE__ */ zod.z.number().optional()
|
|
983
|
+
});
|
|
984
|
+
var networkAccessCapability = {
|
|
985
|
+
name: "network-access",
|
|
986
|
+
scope: "system",
|
|
987
|
+
mode: "collection",
|
|
988
|
+
providerKind: "ingress",
|
|
989
|
+
methods: {
|
|
990
|
+
start: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), NetworkEndpointSchema, { kind: "mutation" }),
|
|
991
|
+
stop: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), /* @__PURE__ */ zod.z.void(), { kind: "mutation" }),
|
|
992
|
+
getEndpoint: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), /* @__PURE__ */ NetworkEndpointSchema.nullable()),
|
|
993
|
+
getStatus: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), NetworkAccessStatusSchema),
|
|
994
|
+
/**
|
|
995
|
+
* Enumerate every active ingress entry. Providers that expose only a
|
|
996
|
+
* single endpoint may omit this method; callers fall back to
|
|
997
|
+
* `getEndpoint()` in that case.
|
|
998
|
+
*/
|
|
999
|
+
listEndpoints: /* @__PURE__ */ require_capability_definition.method(/* @__PURE__ */ zod.z.void(), /* @__PURE__ */ zod.z.array(NetworkEndpointEntrySchema).readonly())
|
|
1000
|
+
},
|
|
1001
|
+
vocabulary: { notOperatorFacing: require_system_reasons.NOT_A_DEVICE.NETWORK }
|
|
1002
|
+
};
|
|
1003
|
+
//#endregion
|
|
1004
|
+
Object.defineProperty(exports, "AGENT_MDNS_SERVICE_TYPE", {
|
|
1005
|
+
enumerable: true,
|
|
1006
|
+
get: function() {
|
|
1007
|
+
return AGENT_MDNS_SERVICE_TYPE;
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
Object.defineProperty(exports, "AGENT_MDNS_TXT_KEYS", {
|
|
1011
|
+
enumerable: true,
|
|
1012
|
+
get: function() {
|
|
1013
|
+
return AGENT_MDNS_TXT_KEYS;
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
Object.defineProperty(exports, "CAMSTACK_APP_LINK_ORIGIN", {
|
|
1017
|
+
enumerable: true,
|
|
1018
|
+
get: function() {
|
|
1019
|
+
return CAMSTACK_APP_LINK_ORIGIN;
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
Object.defineProperty(exports, "HUB_MDNS_SERVICE_TYPE", {
|
|
1023
|
+
enumerable: true,
|
|
1024
|
+
get: function() {
|
|
1025
|
+
return HUB_MDNS_SERVICE_TYPE;
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
Object.defineProperty(exports, "HUB_MDNS_TXT_KEYS", {
|
|
1029
|
+
enumerable: true,
|
|
1030
|
+
get: function() {
|
|
1031
|
+
return HUB_MDNS_TXT_KEYS;
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
Object.defineProperty(exports, "NetworkTunnelStartedDataSchema", {
|
|
1035
|
+
enumerable: true,
|
|
1036
|
+
get: function() {
|
|
1037
|
+
return NetworkTunnelStartedDataSchema;
|
|
1038
|
+
}
|
|
1039
|
+
});
|
|
1040
|
+
Object.defineProperty(exports, "checkRoleAddress", {
|
|
1041
|
+
enumerable: true,
|
|
1042
|
+
get: function() {
|
|
1043
|
+
return checkRoleAddress;
|
|
1044
|
+
}
|
|
1045
|
+
});
|
|
1046
|
+
Object.defineProperty(exports, "isAppLinkBase", {
|
|
1047
|
+
enumerable: true,
|
|
1048
|
+
get: function() {
|
|
1049
|
+
return isAppLinkBase;
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
Object.defineProperty(exports, "isDefaultAppConnectionEndpoint", {
|
|
1053
|
+
enumerable: true,
|
|
1054
|
+
get: function() {
|
|
1055
|
+
return isDefaultAppConnectionEndpoint;
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
Object.defineProperty(exports, "localNetworkCapability", {
|
|
1059
|
+
enumerable: true,
|
|
1060
|
+
get: function() {
|
|
1061
|
+
return localNetworkCapability;
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
Object.defineProperty(exports, "networkAccessCapability", {
|
|
1065
|
+
enumerable: true,
|
|
1066
|
+
get: function() {
|
|
1067
|
+
return networkAccessCapability;
|
|
1068
|
+
}
|
|
1069
|
+
});
|
|
1070
|
+
Object.defineProperty(exports, "pickAppLinkHub", {
|
|
1071
|
+
enumerable: true,
|
|
1072
|
+
get: function() {
|
|
1073
|
+
return pickAppLinkHub;
|
|
1074
|
+
}
|
|
1075
|
+
});
|
|
1076
|
+
Object.defineProperty(exports, "resolveAppConnections", {
|
|
1077
|
+
enumerable: true,
|
|
1078
|
+
get: function() {
|
|
1079
|
+
return resolveAppConnections;
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
Object.defineProperty(exports, "resolveHubAddressRoles", {
|
|
1083
|
+
enumerable: true,
|
|
1084
|
+
get: function() {
|
|
1085
|
+
return resolveHubAddressRoles;
|
|
1086
|
+
}
|
|
1087
|
+
});
|
|
1088
|
+
Object.defineProperty(exports, "resolveNotificationTapAddress", {
|
|
1089
|
+
enumerable: true,
|
|
1090
|
+
get: function() {
|
|
1091
|
+
return resolveNotificationTapAddress;
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
Object.defineProperty(exports, "validateCustomAddress", {
|
|
1095
|
+
enumerable: true,
|
|
1096
|
+
get: function() {
|
|
1097
|
+
return validateCustomAddress;
|
|
1098
|
+
}
|
|
1099
|
+
});
|