dsh-zen-remote 2.3.11 → 2.4.1
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 +45 -78
- package/README.md +94 -84
- package/README.zh-CN.md +90 -81
- package/bin/zen-remote.mjs +5 -0
- package/docs/interface.md +6 -6
- package/docs/remote-access.en.md +6 -4
- package/docs/remote-access.md +6 -4
- package/dsh-push.mjs +96 -10
- package/lib/adapters/dsh-better-sidebar/index.js +7 -3
- package/lib/adapters/dsh-better-sidebar/index.js.map +1 -1
- package/lib/admin-routes.js +10 -2
- package/lib/admin-routes.js.map +1 -1
- package/lib/cli/args.js +251 -0
- package/lib/cli/args.js.map +1 -0
- package/lib/cli/bootstrap.js +449 -0
- package/lib/cli/bootstrap.js.map +1 -0
- package/lib/cli/command-setup.js +484 -0
- package/lib/cli/command-setup.js.map +1 -0
- package/lib/cli/commands-client.js +359 -0
- package/lib/cli/commands-client.js.map +1 -0
- package/lib/cli/commands-host.js +1108 -0
- package/lib/cli/commands-host.js.map +1 -0
- package/lib/cli/commands-status.js +279 -0
- package/lib/cli/commands-status.js.map +1 -0
- package/lib/cli/config-writer.js +334 -0
- package/lib/cli/config-writer.js.map +1 -0
- package/lib/cli/context.js +10 -0
- package/lib/cli/context.js.map +1 -0
- package/lib/cli/i18n.js +620 -0
- package/lib/cli/i18n.js.map +1 -0
- package/lib/cli/ipc-client.js +160 -0
- package/lib/cli/ipc-client.js.map +1 -0
- package/lib/cli/ipc-server.js +464 -0
- package/lib/cli/ipc-server.js.map +1 -0
- package/lib/cli/main.js +245 -0
- package/lib/cli/main.js.map +1 -0
- package/lib/cli/qr-terminal.js +48 -0
- package/lib/cli/qr-terminal.js.map +1 -0
- package/lib/client-data/qr.js +286 -0
- package/lib/client-data/qr.js.map +1 -0
- package/lib/client-routes.js +308 -25
- package/lib/client-routes.js.map +1 -1
- package/lib/client.js +1013 -229
- package/lib/config.js +50 -12
- package/lib/config.js.map +1 -1
- package/lib/debug-report.js +28 -1
- package/lib/debug-report.js.map +1 -1
- package/lib/fetch-route-intercept.js +334 -26
- package/lib/fetch-route-intercept.js.map +1 -1
- package/lib/index.js +608 -375
- package/lib/index.js.map +1 -1
- package/lib/intercept.js +1833 -280
- package/lib/intercept.js.map +1 -1
- package/lib/lan-gate-server.cjs +36 -10
- package/lib/merge-streams.js +103 -11
- package/lib/merge-streams.js.map +1 -1
- package/lib/plugin-route-intercept.js +93 -63
- package/lib/plugin-route-intercept.js.map +1 -1
- package/lib/relay-access.js +8 -1
- package/lib/relay-access.js.map +1 -1
- package/lib/relay-client.js +133 -4
- package/lib/relay-client.js.map +1 -1
- package/lib/relay-pool.js +275 -0
- package/lib/relay-pool.js.map +1 -0
- package/lib/relay-server.js +269 -17
- package/lib/relay-server.js.map +1 -1
- package/lib/restart-fields.js +6 -4
- package/lib/restart-fields.js.map +1 -1
- package/lib/share-ops.js +68 -0
- package/lib/share-ops.js.map +1 -1
- package/lib/share-store.js +65 -27
- package/lib/share-store.js.map +1 -1
- package/lib/state-store.js +400 -0
- package/lib/state-store.js.map +1 -0
- package/lib/types/adapters/dsh-better-sidebar/index.d.ts +3 -2
- package/lib/types/adapters/dsh-better-sidebar/index.d.ts.map +1 -1
- package/lib/types/admin-routes.d.ts.map +1 -1
- package/lib/types/cli/args.d.ts +78 -0
- package/lib/types/cli/args.d.ts.map +1 -0
- package/lib/types/cli/bootstrap.d.ts +170 -0
- package/lib/types/cli/bootstrap.d.ts.map +1 -0
- package/lib/types/cli/command-setup.d.ts +72 -0
- package/lib/types/cli/command-setup.d.ts.map +1 -0
- package/lib/types/cli/commands-client.d.ts +36 -0
- package/lib/types/cli/commands-client.d.ts.map +1 -0
- package/lib/types/cli/commands-host.d.ts +82 -0
- package/lib/types/cli/commands-host.d.ts.map +1 -0
- package/lib/types/cli/commands-status.d.ts +46 -0
- package/lib/types/cli/commands-status.d.ts.map +1 -0
- package/lib/types/cli/config-writer.d.ts +92 -0
- package/lib/types/cli/config-writer.d.ts.map +1 -0
- package/lib/types/cli/context.d.ts +39 -0
- package/lib/types/cli/context.d.ts.map +1 -0
- package/lib/types/cli/i18n.d.ts +32 -0
- package/lib/types/cli/i18n.d.ts.map +1 -0
- package/lib/types/cli/ipc-client.d.ts +83 -0
- package/lib/types/cli/ipc-client.d.ts.map +1 -0
- package/lib/types/cli/ipc-server.d.ts +113 -0
- package/lib/types/cli/ipc-server.d.ts.map +1 -0
- package/lib/types/cli/main.d.ts +57 -0
- package/lib/types/cli/main.d.ts.map +1 -0
- package/lib/types/cli/qr-terminal.d.ts +17 -0
- package/lib/types/cli/qr-terminal.d.ts.map +1 -0
- package/lib/types/client/RemoteStatusIcon.d.ts.map +1 -1
- package/lib/types/client/current-session-report.d.ts +4 -0
- package/lib/types/client/current-session-report.d.ts.map +1 -1
- package/lib/types/client/effects/model-group-side.d.ts.map +1 -1
- package/lib/types/client/effects/remote-session.d.ts.map +1 -1
- package/lib/types/client/locales.d.ts +47 -3
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/settings/SettingsSection.d.ts.map +1 -1
- package/lib/types/client/settings/settings-css.d.ts +1 -1
- package/lib/types/client/settings/settings-css.d.ts.map +1 -1
- package/lib/types/client/styles/remote-session.css.d.ts +1 -1
- package/lib/types/client/styles/remote-session.css.d.ts.map +1 -1
- package/lib/types/client/wizard/GatewayWizard.d.ts.map +1 -1
- package/lib/types/client/wizard/cards/ProxyCard.d.ts.map +1 -1
- package/lib/types/client/wizard/wizard-css.d.ts +1 -1
- package/lib/types/client/wizard/wizard-css.d.ts.map +1 -1
- package/lib/types/client-data/model-group-side.d.ts +23 -2
- package/lib/types/client-data/model-group-side.d.ts.map +1 -1
- package/lib/types/client-data/remote-status.d.ts +47 -1
- package/lib/types/client-data/remote-status.d.ts.map +1 -1
- package/lib/types/client-data/settings-form.d.ts +85 -1
- package/lib/types/client-data/settings-form.d.ts.map +1 -1
- package/lib/types/client-data/wizard.d.ts +56 -1
- package/lib/types/client-data/wizard.d.ts.map +1 -1
- package/lib/types/client-routes.d.ts +25 -1
- package/lib/types/client-routes.d.ts.map +1 -1
- package/lib/types/config.d.ts +40 -14
- package/lib/types/config.d.ts.map +1 -1
- package/lib/types/debug-report.d.ts.map +1 -1
- package/lib/types/fetch-route-intercept.d.ts +66 -8
- package/lib/types/fetch-route-intercept.d.ts.map +1 -1
- package/lib/types/index.d.ts +9 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/intercept.d.ts +72 -10
- package/lib/types/intercept.d.ts.map +1 -1
- package/lib/types/merge-streams.d.ts +79 -1
- package/lib/types/merge-streams.d.ts.map +1 -1
- package/lib/types/plugin-route-intercept.d.ts +25 -9
- package/lib/types/plugin-route-intercept.d.ts.map +1 -1
- package/lib/types/relay-access.d.ts +3 -1
- package/lib/types/relay-access.d.ts.map +1 -1
- package/lib/types/relay-client.d.ts +23 -2
- package/lib/types/relay-client.d.ts.map +1 -1
- package/lib/types/relay-pool.d.ts +148 -0
- package/lib/types/relay-pool.d.ts.map +1 -0
- package/lib/types/relay-server.d.ts +30 -3
- package/lib/types/relay-server.d.ts.map +1 -1
- package/lib/types/restart-fields.d.ts +5 -5
- package/lib/types/restart-fields.d.ts.map +1 -1
- package/lib/types/share-ops.d.ts +47 -1
- package/lib/types/share-ops.d.ts.map +1 -1
- package/lib/types/share-store.d.ts.map +1 -1
- package/lib/types/state-store.d.ts +179 -0
- package/lib/types/state-store.d.ts.map +1 -0
- package/lib/types/upload-limits.d.ts +15 -0
- package/lib/types/upload-limits.d.ts.map +1 -1
- package/lib/types/virtual-id.d.ts +21 -0
- package/lib/types/virtual-id.d.ts.map +1 -1
- package/lib/types/wizard/probe.d.ts.map +1 -1
- package/lib/types/wizard/proxy-snippets.d.ts +3 -0
- package/lib/types/wizard/proxy-snippets.d.ts.map +1 -1
- package/lib/types/wizard/routes.d.ts +1 -0
- package/lib/types/wizard/routes.d.ts.map +1 -1
- package/lib/types/wizard/status.d.ts +9 -0
- package/lib/types/wizard/status.d.ts.map +1 -1
- package/lib/types/wizard/verify.d.ts +3 -0
- package/lib/types/wizard/verify.d.ts.map +1 -1
- package/lib/upload-limits.js +15 -0
- package/lib/upload-limits.js.map +1 -1
- package/lib/virtual-id.js +60 -0
- package/lib/virtual-id.js.map +1 -1
- package/lib/wizard/probe.js +46 -1
- package/lib/wizard/probe.js.map +1 -1
- package/lib/wizard/proxy-snippets.js +14 -1
- package/lib/wizard/proxy-snippets.js.map +1 -1
- package/lib/wizard/routes.js +23 -4
- package/lib/wizard/routes.js.map +1 -1
- package/lib/wizard/status.js +21 -0
- package/lib/wizard/status.js.map +1 -1
- package/lib/wizard/verify.js +31 -8
- package/lib/wizard/verify.js.map +1 -1
- package/package.json +8 -4
- package/pwa/icons/badge-96.png +0 -0
- package/pwa/icons/badge.svg +1 -0
- package/pwa/manifest.json +2 -1
- package/pwa/sw.js +3 -1
- package/scripts/check-debug-report.mjs +41 -1
- package/scripts/check-settings-form.mjs +14 -3
- package/scripts/check-settings-view.mjs +247 -0
- package/scripts/check-wizard-ui.mjs +37 -0
- package/src/adapters/dsh-better-sidebar/index.ts +7 -3
- package/src/admin-routes.ts +10 -2
- package/src/cli/args.ts +289 -0
- package/src/cli/bootstrap.ts +569 -0
- package/src/cli/command-setup.ts +540 -0
- package/src/cli/commands-client.ts +369 -0
- package/src/cli/commands-host.ts +1127 -0
- package/src/cli/commands-status.ts +296 -0
- package/src/cli/config-writer.ts +354 -0
- package/src/cli/context.ts +38 -0
- package/src/cli/i18n.ts +645 -0
- package/src/cli/ipc-client.ts +216 -0
- package/src/cli/ipc-server.ts +531 -0
- package/src/cli/main.ts +285 -0
- package/src/cli/qr-terminal.ts +49 -0
- package/src/client/RemoteStatusIcon.tsx +4 -1
- package/src/client/current-session-report.ts +28 -4
- package/src/client/effects/model-group-side.ts +19 -5
- package/src/client/effects/remote-session.ts +26 -6
- package/src/client/locales.ts +96 -6
- package/src/client/settings/SettingsSection.tsx +287 -92
- package/src/client/settings/settings-css.ts +18 -0
- package/src/client/styles/remote-session.css.ts +15 -1
- package/src/client/wizard/GatewayWizard.tsx +470 -109
- package/src/client/wizard/cards/ProxyCard.tsx +2 -1
- package/src/client/wizard/wizard-css.ts +23 -0
- package/src/client-data/model-group-side.ts +37 -10
- package/src/client-data/remote-status.ts +112 -17
- package/src/client-data/settings-form.ts +164 -8
- package/src/client-data/wizard.ts +112 -2
- package/src/client-routes.ts +334 -26
- package/src/config.ts +62 -16
- package/src/debug-report.ts +27 -1
- package/src/fetch-route-intercept.ts +381 -32
- package/src/index.ts +608 -380
- package/src/intercept.ts +1866 -286
- package/src/merge-streams.ts +155 -10
- package/src/plugin-route-intercept.ts +120 -71
- package/src/relay-access.ts +14 -3
- package/src/relay-client.ts +163 -5
- package/src/relay-pool.ts +387 -0
- package/src/relay-server.ts +312 -16
- package/src/restart-fields.ts +6 -4
- package/src/share-ops.ts +82 -1
- package/src/share-store.ts +59 -26
- package/src/state-store.ts +428 -0
- package/src/upload-limits.ts +16 -0
- package/src/virtual-id.ts +57 -0
- package/src/wizard/probe.ts +54 -2
- package/src/wizard/proxy-snippets.ts +17 -2
- package/src/wizard/routes.ts +24 -5
- package/src/wizard/status.ts +28 -0
- package/src/wizard/verify.ts +33 -11
- package/AGENTS.md +0 -185
- package/docs/adr/0001-plugin-bridge-forwards-plugin-routes.md +0 -15
- package/docs/adr/0002-relay-emulates-websocket.md +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"share-store.d.ts","sourceRoot":"","sources":["../../src/share-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;
|
|
1
|
+
{"version":3,"file":"share-store.d.ts","sourceRoot":"","sources":["../../src/share-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAOH,oDAAoD;AACpD,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,uEAAuE;IACvE,QAAQ,EAAE,MA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G,MAAM,GAAG,SAAS,CAAA;IAClD,qEAAqE;IACrE,IAAI,IAAI,UAAU,EAAE,CAAA;IACpB;6DACyD;IACzD,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC;kCAC8B;IAC9B,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;CAC7D;AAgDD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CA4QvE"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three-in-one state file (MS-1): `<DSH_HOME>/zen-remote-state.json`
|
|
3
|
+
* holds the server's own identity (`serverId`), the shared-session table
|
|
4
|
+
* (`sessions`) and the list of paired relay servers (`servers`) in ONE file,
|
|
5
|
+
* so the three writers — relay-server.ts's loadServerId, share-store.ts's
|
|
6
|
+
* persist, and the pairing operations below — can never clobber each other's
|
|
7
|
+
* top-level fields. Every write goes through {@link writeStateFile}, which
|
|
8
|
+
* reads the CURRENT file first and hands it to the updater: a share-table
|
|
9
|
+
* write preserves `serverId` and `servers`, an identity write preserves the
|
|
10
|
+
* table and the list.
|
|
11
|
+
*
|
|
12
|
+
* The file is 0600 on purpose: `servers` rows carry pairing tokens. The write
|
|
13
|
+
* is the same atomic tmp+rename dance the share table has always used, with
|
|
14
|
+
* an explicit chmod in front of the rename (writeFileSync's `mode` only
|
|
15
|
+
* applies at creation — a leftover `.tmp` from a crashed run would keep its
|
|
16
|
+
* old mode).
|
|
17
|
+
*
|
|
18
|
+
* Migration (MS-1): the pre-multi-server layout kept three separate files —
|
|
19
|
+
* `zen-remote-server.json` (the identity) and `zen-remote-shares.json` (the
|
|
20
|
+
* table) — and the plugin row carried the one paired server's address+token.
|
|
21
|
+
* {@link ensureStateMigrated} folds all three into the state file exactly
|
|
22
|
+
* once, deleting a legacy file only after its data landed on disk. The
|
|
23
|
+
* migration parts are also exported singly: relay-server.ts runs the identity
|
|
24
|
+
* one at its `loadServerId` entry and share-store.ts runs the table one at
|
|
25
|
+
* its startup load, so each writer is correct even when nothing else called
|
|
26
|
+
* the combined migration first.
|
|
27
|
+
*
|
|
28
|
+
* Pure module discipline: no clocks of its own (`Date.now` at the two call
|
|
29
|
+
* sites that need a timestamp), every read tolerant, nothing throws out of
|
|
30
|
+
* the migration helpers — a damaged file degrades to an empty state, never a
|
|
31
|
+
* dead plugin.
|
|
32
|
+
*/
|
|
33
|
+
/** The one state file this module owns, always directly under DSH_HOME. */
|
|
34
|
+
export declare const STATE_FILE_NAME = "zen-remote-state.json";
|
|
35
|
+
/** Pre-multi-server identity file, migrated into the state file and deleted. */
|
|
36
|
+
export declare const LEGACY_SERVER_ID_FILE = "zen-remote-server.json";
|
|
37
|
+
/** Pre-multi-server share-table file, migrated into the state file and deleted. */
|
|
38
|
+
export declare const LEGACY_SHARES_FILE = "zen-remote-shares.json";
|
|
39
|
+
/** How many relay servers one sub-client may keep paired at once (MS-2). */
|
|
40
|
+
export declare const MAX_PAIRED_SERVERS = 8;
|
|
41
|
+
/** One row of the persisted share table (verbatim from share-store.ts). */
|
|
42
|
+
export interface PersistedShareRow {
|
|
43
|
+
sharedAt: number;
|
|
44
|
+
lastActivityAt: number;
|
|
45
|
+
}
|
|
46
|
+
export interface PairedServerRecord {
|
|
47
|
+
/** Local stable entry id (8-hex, `randomBytes(4).toString('hex')`). */
|
|
48
|
+
id: string;
|
|
49
|
+
/** The server address, normalized by `normalizeServerUrl`. */
|
|
50
|
+
serverUrl: string;
|
|
51
|
+
/** The device pairing token — sensitive, 0600 on disk, NEVER echoed into
|
|
52
|
+
* any state response that leaves the process. */
|
|
53
|
+
token: string;
|
|
54
|
+
/** The server's 8-hex id as of the last completed handshake; unset until
|
|
55
|
+
* the first one succeeds. */
|
|
56
|
+
serverId?: string;
|
|
57
|
+
/** The server's display name as of the last completed handshake. */
|
|
58
|
+
serverName?: string;
|
|
59
|
+
/** This device's id on that server, as the pairing registered it. */
|
|
60
|
+
deviceId?: string;
|
|
61
|
+
/** This device's name in that server's table, as last confirmed. */
|
|
62
|
+
deviceName?: string;
|
|
63
|
+
/** When the pairing was first added (epoch ms) — decides the merged
|
|
64
|
+
* sidebar order and the -1/-2 numbering of duplicate display names. */
|
|
65
|
+
createdAt: number;
|
|
66
|
+
}
|
|
67
|
+
export interface ZenRemoteStateFile {
|
|
68
|
+
version: 1;
|
|
69
|
+
serverId?: string;
|
|
70
|
+
sessions?: Record<string, PersistedShareRow>;
|
|
71
|
+
servers?: PairedServerRecord[];
|
|
72
|
+
}
|
|
73
|
+
/** The one legal shape of a persisted server id (relay-server.ts mints it). */
|
|
74
|
+
export declare function isLegalServerId(value: unknown): value is string;
|
|
75
|
+
/**
|
|
76
|
+
* Read and parse the state file. A missing file is the normal first run; a
|
|
77
|
+
* damaged file reads as empty — quarantined as `<file>.corrupt-<now>` UNLESS
|
|
78
|
+
* it still carries a migration source (a legal `serverId`, the one shape the
|
|
79
|
+
* migration paths know how to rescue): renaming that away would silently
|
|
80
|
+
* reset the server identity on the next load, so the file stays put and the
|
|
81
|
+
* salvageable field rides along in the returned state.
|
|
82
|
+
* Never throws.
|
|
83
|
+
*/
|
|
84
|
+
export declare function readStateFile(filePath: string): ZenRemoteStateFile;
|
|
85
|
+
/**
|
|
86
|
+
* The one write door: read the CURRENT file, let `updater` produce the next
|
|
87
|
+
* state from it, then atomically replace the file (tmp at 0600, best-effort
|
|
88
|
+
* chmod, rename). Belt AND braces: the braces are the updaters in this module
|
|
89
|
+
* spreading `current` explicitly; the belt is the merge below — an updater
|
|
90
|
+
* that names only the field it owns must never erase the top-level fields it
|
|
91
|
+
* did not name (the partial-updater shape caught in the MS-phase1 review). A
|
|
92
|
+
* field the updater explicitly sets to `undefined` still goes away, so
|
|
93
|
+
* removal stays expressible. The result is normalized to the four known
|
|
94
|
+
* top-level fields before it reaches disk. Throws on I/O failure; callers
|
|
95
|
+
* decide what that means (share-store records it, loadServerId degrades, the
|
|
96
|
+
* migration helpers swallow it).
|
|
97
|
+
*/
|
|
98
|
+
export declare function writeStateFile(filePath: string, updater: (current: ZenRemoteStateFile) => ZenRemoteStateFile): void;
|
|
99
|
+
/**
|
|
100
|
+
* Move a legacy `zen-remote-server.json` identity into the state file — but
|
|
101
|
+
* only when the state file has no legal identity of its own yet. The legacy
|
|
102
|
+
* file is deleted only after the write succeeded; a failed write leaves both
|
|
103
|
+
* files alone so the next start can try again. Never throws.
|
|
104
|
+
*/
|
|
105
|
+
export declare function ensureServerIdMigrated(stateFile: string): void;
|
|
106
|
+
/**
|
|
107
|
+
* Move a legacy `zen-remote-shares.json` table into the state file — but only
|
|
108
|
+
* when the state file carries no sessions yet. Legal rows only; the legacy
|
|
109
|
+
* file is deleted only after the write succeeded. Never throws.
|
|
110
|
+
*/
|
|
111
|
+
export declare function ensureSharesMigrated(stateFile: string): void;
|
|
112
|
+
/**
|
|
113
|
+
* The paired-servers list, in file (pairing) order, as validated copies.
|
|
114
|
+
* Invalid rows are skipped — one hostile record must not hide the rest.
|
|
115
|
+
*/
|
|
116
|
+
export declare function listPairedServers(filePath: string): PairedServerRecord[];
|
|
117
|
+
/** What {@link upsertPairedServer} answers. */
|
|
118
|
+
export type UpsertPairingResult = {
|
|
119
|
+
ok: true;
|
|
120
|
+
record: PairedServerRecord;
|
|
121
|
+
replaced: boolean;
|
|
122
|
+
} | {
|
|
123
|
+
ok: false;
|
|
124
|
+
code: 'invalid-url' | 'limit-reached';
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Add or re-pair one server. A NEW address appends (refused past
|
|
128
|
+
* {@link MAX_PAIRED_SERVERS}); an EXISTING address updates in place — same
|
|
129
|
+
* entry id, same position, same `createdAt`, fresh token and device fields —
|
|
130
|
+
* which is why the cap never blocks a re-pair.
|
|
131
|
+
*/
|
|
132
|
+
export declare function upsertPairedServer(filePath: string, input: {
|
|
133
|
+
serverUrl: string;
|
|
134
|
+
token: string;
|
|
135
|
+
deviceId?: string;
|
|
136
|
+
deviceName?: string;
|
|
137
|
+
now?: number;
|
|
138
|
+
}): UpsertPairingResult;
|
|
139
|
+
/**
|
|
140
|
+
* Fold one completed handshake into the record: `serverId`, `serverName` and
|
|
141
|
+
* (when the server speaks it) `deviceName`. The second dedupe layer lives
|
|
142
|
+
* here too: a DIFFERENT entry already carrying the same `serverId` is a stale
|
|
143
|
+
* duplicate (the same server re-paired under a new address) — it is removed
|
|
144
|
+
* from the list and reported in `removedEntryIds`, the handshaking entry
|
|
145
|
+
* kept. A non-8-hex `serverId` is not recorded and dedupes nothing.
|
|
146
|
+
*/
|
|
147
|
+
export declare function recordServerHandshake(filePath: string, entryId: string, handshake: {
|
|
148
|
+
serverId: string;
|
|
149
|
+
serverName: string;
|
|
150
|
+
deviceName?: string;
|
|
151
|
+
}): {
|
|
152
|
+
removedEntryIds: string[];
|
|
153
|
+
};
|
|
154
|
+
/** Remove one entry by id; true when it was actually on the list. */
|
|
155
|
+
export declare function removePairedServer(filePath: string, entryId: string): boolean;
|
|
156
|
+
/** Empty the list; answers how many records went away. */
|
|
157
|
+
export declare function clearPairedServers(filePath: string): number;
|
|
158
|
+
/**
|
|
159
|
+
* The third migration: the pre-multi-server row carried exactly one server's
|
|
160
|
+
* address and pairing token. When the state file has no paired servers yet,
|
|
161
|
+
* they become `servers[0]`; the address must pass the claim route's
|
|
162
|
+
* normalizer and the token must be a non-empty string, or nothing is written.
|
|
163
|
+
* Runs at most once in practice — a non-empty list is never re-migrated.
|
|
164
|
+
*/
|
|
165
|
+
export declare function migrateLegacyClientIntoServers(filePath: string, legacyClient: {
|
|
166
|
+
serverUrl?: unknown;
|
|
167
|
+
deviceToken?: unknown;
|
|
168
|
+
}): void;
|
|
169
|
+
/**
|
|
170
|
+
* The combined one-shot migration for a DSH home: identity, share table and
|
|
171
|
+
* (when handed the row's legacy client credentials) the paired-servers seed.
|
|
172
|
+
* Best effort end to end — any failure leaves the files as they are for the
|
|
173
|
+
* next start.
|
|
174
|
+
*/
|
|
175
|
+
export declare function ensureStateMigrated(home: string, legacyClient?: {
|
|
176
|
+
serverUrl?: unknown;
|
|
177
|
+
deviceToken?: unknown;
|
|
178
|
+
}): void;
|
|
179
|
+
//# sourceMappingURL=state-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-store.d.ts","sourceRoot":"","sources":["../../src/state-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAOH,2EAA2E;AAC3E,eAAO,MAAM,eAAe,0BAA0B,CAAA;AAEtD,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,2BAA2B,CAAA;AAE7D,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,2BAA2B,CAAA;AAE1D,4EAA4E;AAC5E,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAKnC,2EAA2E;AAC3E,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,uEAAuE;IACvE,EAAE,EAAE,MAAM,CAAA;IACV,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAA;IACjB;qDACiD;IACjD,KAAK,EAAE,MAAM,CAAA;IACb;iCAC6B;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;2EACuE;IACvE,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,CAAC,CAAA;IACV,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAC5C,OAAO,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AAS,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GACvE;IAAE,eAAe,EAAE,MAAM,EAAE,CAAA;CAAE,CAwB/B;AAED,qEAAqE;AACrE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAM7E;AAED,0DAA0D;AAC1D,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK3D;AAED;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAC3D,IAAI,CAQN;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAWrH"}
|
|
@@ -64,4 +64,19 @@ export declare const DEFAULT_MAX_UPLOAD_BYTES: number;
|
|
|
64
64
|
* like any other oversized read.
|
|
65
65
|
*/
|
|
66
66
|
export declare const MAX_INVOKE_BODY_BYTES: number;
|
|
67
|
+
/**
|
|
68
|
+
* Cap for ONE forwarded `/api/file` media answer (P55-2): the sub-client's
|
|
69
|
+
* fetch-route wrap pulls a remote session's inline image / media file
|
|
70
|
+
* through `workspaceFiles/readBytes` and answers the browser's native
|
|
71
|
+
* `<img>` request with the bytes. Deliberately TIGHTER than the host's own
|
|
72
|
+
* `maxImageBytes` default (50 MiB, RT dsh-attachment-local
|
|
73
|
+
* DEFAULT_MAX_IMAGE_BYTES): every forwarded byte rides the relay's JSON
|
|
74
|
+
* channel base64-encoded (~1.33×), so 50 MiB would move ~67 MiB through the
|
|
75
|
+
* link — 20 MiB answers everything a reply body realistically embeds and
|
|
76
|
+
* fails fast past it. NOT related to {@link DEFAULT_MAX_UPLOAD_BYTES}
|
|
77
|
+
* (which sizes the phone composer's uploads); the equal value is
|
|
78
|
+
* coincidence, kept as one definition here only so the drift scanner sees
|
|
79
|
+
* every MiB-scale ceiling exactly once.
|
|
80
|
+
*/
|
|
81
|
+
export declare const MAX_FILE_MEDIA_BYTES: number;
|
|
67
82
|
//# sourceMappingURL=upload-limits.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-limits.d.ts","sourceRoot":"","sources":["../../src/upload-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,gBAAgB,QAAoB,CAAA;AAEjD;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,QAAmB,CAAA;AAExD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,QAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"upload-limits.d.ts","sourceRoot":"","sources":["../../src/upload-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,gBAAgB,QAAoB,CAAA;AAEjD;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,QAAmB,CAAA;AAExD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB,QAAmB,CAAA;AAErD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,QAAmB,CAAA"}
|
|
@@ -32,6 +32,27 @@ export declare const VIRTUAL_ID_PREFIX = "zr~";
|
|
|
32
32
|
* text.
|
|
33
33
|
*/
|
|
34
34
|
export declare const VIRTUAL_GROUP_NAME_MARK = "\u2060";
|
|
35
|
+
/**
|
|
36
|
+
* MS-4: the invisible prefix a REMOTE model-menu group heading carries
|
|
37
|
+
* before its server name (merge-streams.ts mergeModelCatalogs). The full
|
|
38
|
+
* form is `${MARK}${32 zero-width bits}${MARK}` — the 32 bits of the
|
|
39
|
+
* 8-hex serverId (MSB first per nibble), ZERO_BIT for 0 and ONE_BIT for 1
|
|
40
|
+
* — so the browser half can tell WHICH server a remote model group came
|
|
41
|
+
* from (effects/model-group-side.ts classifies per-server hiding from
|
|
42
|
+
* heading text alone). A serverId that is not 8 lowercase hex (the format
|
|
43
|
+
* every real handshake carries) degrades to the bare legacy mark: the
|
|
44
|
+
* heading stays a marked remote heading, just without a decodable server.
|
|
45
|
+
*/
|
|
46
|
+
export declare function encodeServerIdZeroWidth(serverId: unknown): string;
|
|
47
|
+
/**
|
|
48
|
+
* MS-4: read the server id back out of one group heading, or `undefined`.
|
|
49
|
+
* Strict like every decoder here: the text must start with the mark, the
|
|
50
|
+
* window right after it must be exactly 32 zero-width bits closed by the
|
|
51
|
+
* terminator mark — anything else (the legacy bare-mark heading, visible
|
|
52
|
+
* text, a short or long bit run, a missing terminator) answers
|
|
53
|
+
* `undefined`, which the classifier reads as "remote, server unknown".
|
|
54
|
+
*/
|
|
55
|
+
export declare function decodeServerIdZeroWidth(headingText: unknown): string | undefined;
|
|
35
56
|
/** The two halves {@link fromVirtual} recovers from a virtual id. */
|
|
36
57
|
export interface VirtualIdParts {
|
|
37
58
|
serverId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-id.d.ts","sourceRoot":"","sources":["../../src/virtual-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,qDAAqD;AACrD,eAAO,MAAM,iBAAiB,QAAQ,CAAA;AAEtC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"virtual-id.d.ts","sourceRoot":"","sources":["../../src/virtual-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,qDAAqD;AACrD,eAAO,MAAM,iBAAiB,QAAQ,CAAA;AAEtC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,WAAW,CAAA;AAe/C;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CASjE;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAgBhF;AAED,qEAAqE;AACrE,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,EAAE,EAAE,MAAM,CAAA;CACX;AAED,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CASnE;AAED,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,CAE9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../../../src/wizard/probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"probe.d.ts","sourceRoot":"","sources":["../../../src/wizard/probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,2CAA2C;AAC3C,MAAM,MAAM,kBAAkB,GAC1B,sBAAsB,GACtB,gBAAgB,GAChB,gBAAgB,GAChB,UAAU,GACV,YAAY,CAAA;AAEhB,yDAAyD;AACzD,MAAM,MAAM,mBAAmB,GAC3B,mBAAmB,GACnB,eAAe,GACf,WAAW,GACX,YAAY,CAAA;AAEhB;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAQ1G;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAkB5G;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,kBAAkB,CAAA;IACxB,KAAK,EAAE,mBAAmB,CAAA;IAC1B,sDAAsD;IACtD,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,aAAa,CAAA;IACnB;8EAC0E;IAC1E,MAAM,EAAE,aAAa,GAAG,eAAe,GAAG,SAAS,GAAG,SAAS,CAAA;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,mBAAmB,CAAA;AAEnE,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;IACxB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CACnB;AAuED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CA+B5G"}
|
|
@@ -26,6 +26,8 @@ export interface SnippetInput {
|
|
|
26
26
|
upstreamHost: unknown;
|
|
27
27
|
/** The gateway's ACTUAL port. */
|
|
28
28
|
upstreamPort: unknown;
|
|
29
|
+
/** Language of the header comment (`'zh'` default, `'en'` English). */
|
|
30
|
+
lang?: 'zh' | 'en' | undefined;
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
33
|
* nginx: a complete server block. The WebSocket upgrade map sits outside
|
|
@@ -57,5 +59,6 @@ export type StepsResult = {
|
|
|
57
59
|
export declare function luckySteps(input: {
|
|
58
60
|
upstreamHost: unknown;
|
|
59
61
|
upstreamPort: unknown;
|
|
62
|
+
lang?: 'zh' | 'en' | undefined;
|
|
60
63
|
}): StepsResult;
|
|
61
64
|
//# sourceMappingURL=proxy-snippets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy-snippets.d.ts","sourceRoot":"","sources":["../../../src/wizard/proxy-snippets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,MAAM,MAAM,aAAa,GACrB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC1B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,YAAY,GAAG,mBAAmB,GAAG,mBAAmB,CAAA;CAAE,CAAA;AAElF,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,MAAM,EAAE,OAAO,CAAA;IACf;4BACwB;IACxB,YAAY,EAAE,OAAO,CAAA;IACrB,iCAAiC;IACjC,YAAY,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"proxy-snippets.d.ts","sourceRoot":"","sources":["../../../src/wizard/proxy-snippets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,MAAM,MAAM,aAAa,GACrB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC1B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,YAAY,GAAG,mBAAmB,GAAG,mBAAmB,CAAA;CAAE,CAAA;AAElF,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,MAAM,EAAE,OAAO,CAAA;IACf;4BACwB;IACxB,YAAY,EAAE,OAAO,CAAA;IACrB,iCAAiC;IACjC,YAAY,EAAE,OAAO,CAAA;IACrB,uEAAuE;IACvE,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAA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MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;QACnF,IAAI,EAAE,MAAM,IAAI,CAAA;QAChB,MAAM,EAAE,MAAM,iBAAiB,CAAA;KAChC,CAAA;IACD;;yEAEqE;IACrE,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,CAAC,KAAK,EAAE;YAAE,SAAS,EAAE,OAAO,CAAC;YAAC,SAAS,CAAC,EAAE,OAAO,CAAC;YAAC,aAAa,CAAC,EAAE,OAAO,CAAA;SAAE,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;QACxH,KAAK,EAAE,MAAM,OAAO,CAAC,uBAAuB,CAAC,CAAA;KAC9C,CAAA;CACF;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AA8BxF;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CAmXhF"}
|
|
@@ -66,13 +66,20 @@ export interface WizardForwardedSourceInput {
|
|
|
66
66
|
* fields. Token presence is reported as booleans only; port as the gateway
|
|
67
67
|
* child's ACTUAL listening port (it may differ from the configured one).
|
|
68
68
|
*/
|
|
69
|
+
export interface WizardLanCandidate {
|
|
70
|
+
ip: string;
|
|
71
|
+
kind: 'tailscale' | 'lan';
|
|
72
|
+
iface: string;
|
|
73
|
+
}
|
|
69
74
|
export interface WizardRuntimeInput {
|
|
70
75
|
cfTokenConfigured?: unknown;
|
|
71
76
|
tunnelTokenConfigured?: unknown;
|
|
72
77
|
caddyRunning?: unknown;
|
|
73
78
|
cloudflaredRunning?: unknown;
|
|
74
79
|
gatewayActualPort?: unknown;
|
|
80
|
+
gatewayActualHost?: unknown;
|
|
75
81
|
lanAddress?: unknown;
|
|
82
|
+
lanAddresses?: unknown;
|
|
76
83
|
lastHostProbe?: WizardRecordInput | null;
|
|
77
84
|
lastExternalVerification?: WizardRecordInput | null;
|
|
78
85
|
lastForwardedSource?: WizardForwardedSourceInput | null;
|
|
@@ -100,7 +107,9 @@ export interface WizardStatus {
|
|
|
100
107
|
caddyRunning: boolean;
|
|
101
108
|
cloudflaredRunning: boolean;
|
|
102
109
|
gatewayActualPort: number | null;
|
|
110
|
+
gatewayActualHost?: string;
|
|
103
111
|
lanAddress?: string;
|
|
112
|
+
lanAddresses?: WizardLanCandidate[];
|
|
104
113
|
lastHostProbe: WizardStatusRecord | null;
|
|
105
114
|
lastExternalVerification: WizardStatusRecord | null;
|
|
106
115
|
lastForwardedSource: WizardStatusForwardedSource | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/wizard/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB,sDAAuD,CAAA;AAExF,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAA;AAErE;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,OAAO,CAAA;CACb;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,EAAE,CAAC,EAAE,OAAO,CAAA;IACZ,EAAE,CAAC,EAAE,OAAO,CAAA;CACb;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,qBAA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I,CAAA;IACnD,mBAAmB,CAAC,EAAE,0BAA0B,GAAG,IAAI,CAAA;CACxD;AAED,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;CAClB;AAED,6EAA6E;AAC7E,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAA;IACV,EAAE,EAAE,MAAM,CAAA;CACX;AAED,sEAAsE;AACtE,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,IAAI,CAAA;IACR,IAAI,EAAE,iBAAiB,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,qBAAqB,EAAE,OAAO,CAAA;IAC9B,YAAY,EAAE,OAAO,CAAA;IACrB,kBAAkB,EAAE,OAAO,CAAA;IAC3B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,kBAAkB,EAAE,CAAA;IACnC,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAA;IACxC,wBAAwB,EAAE,kBAAkB,GAAG,IAAI,CAAA;IACnD,mBAAmB,EAAE,2BAA2B,GAAG,IAAI,CAAA;CACxD;AAwDD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,GAAE,mBAAwB,EAAE,OAAO,GAAE,kBAAuB,GAAG,YAAY,CAoBtH"}
|
|
@@ -52,8 +52,10 @@ export interface VerificationManagerOptions {
|
|
|
52
52
|
export type VerificationStartResult = {
|
|
53
53
|
ok: true;
|
|
54
54
|
pairingCode: string;
|
|
55
|
+
desktopPairingCode?: string;
|
|
55
56
|
publicUrl: string;
|
|
56
57
|
expiresAt: number;
|
|
58
|
+
probeWarning?: unknown;
|
|
57
59
|
} | {
|
|
58
60
|
ok: false;
|
|
59
61
|
reason: 'no-public-url' | 'bad-public-url' | 'runtime-not-ready' | 'gateway-unreachable' | 'probe-failed' | 'pair-refused';
|
|
@@ -87,6 +89,7 @@ export interface VerificationManager {
|
|
|
87
89
|
start(input: {
|
|
88
90
|
publicUrl: unknown;
|
|
89
91
|
probeOnly?: boolean;
|
|
92
|
+
allowUnprobed?: boolean;
|
|
90
93
|
}): Promise<VerificationStartResult>;
|
|
91
94
|
check(): Promise<VerificationCheckResult>;
|
|
92
95
|
/** Whether a verification session is open (the route surfaces it for the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/wizard/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AAEhE,MAAM,WAAW,0BAA0B;IACzC,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAA;IACnB,mEAAmE;IACnE,SAAS,EAAE,MAAM,eAAe,CAAA;IAChC,8EAA8E;IAC9E,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;IACvD;;mEAE+D;IAC/D,YAAY,CAAC,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/C,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;IACxB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kCAAkC;IAClC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CACnB;AAED,MAAM,MAAM,uBAAuB,GAC/B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC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;AAEH,MAAM,MAAM,uBAAuB,GAC/B;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,GACzB;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GACnB;IAAE,MAAM,EAAE,cAAc,CAAA;CAAE,GAC1B;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,iBAAiB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA;AAUpD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAUnG;AAWD,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;IACpH,KAAK,IAAI,OAAO,CAAC,uBAAuB,CAAC,CAAA;IACzC;8BAC0B;IAC1B,UAAU,IAAI,OAAO,CAAA;CACtB;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,GAAG,mBAAmB,CA8IlG"}
|
package/lib/upload-limits.js
CHANGED
|
@@ -64,4 +64,19 @@ export const DEFAULT_MAX_UPLOAD_BYTES = 20 * 1024 * 1024;
|
|
|
64
64
|
* like any other oversized read.
|
|
65
65
|
*/
|
|
66
66
|
export const MAX_INVOKE_BODY_BYTES = 32 * 1024 * 1024;
|
|
67
|
+
/**
|
|
68
|
+
* Cap for ONE forwarded `/api/file` media answer (P55-2): the sub-client's
|
|
69
|
+
* fetch-route wrap pulls a remote session's inline image / media file
|
|
70
|
+
* through `workspaceFiles/readBytes` and answers the browser's native
|
|
71
|
+
* `<img>` request with the bytes. Deliberately TIGHTER than the host's own
|
|
72
|
+
* `maxImageBytes` default (50 MiB, RT dsh-attachment-local
|
|
73
|
+
* DEFAULT_MAX_IMAGE_BYTES): every forwarded byte rides the relay's JSON
|
|
74
|
+
* channel base64-encoded (~1.33×), so 50 MiB would move ~67 MiB through the
|
|
75
|
+
* link — 20 MiB answers everything a reply body realistically embeds and
|
|
76
|
+
* fails fast past it. NOT related to {@link DEFAULT_MAX_UPLOAD_BYTES}
|
|
77
|
+
* (which sizes the phone composer's uploads); the equal value is
|
|
78
|
+
* coincidence, kept as one definition here only so the drift scanner sees
|
|
79
|
+
* every MiB-scale ceiling exactly once.
|
|
80
|
+
*/
|
|
81
|
+
export const MAX_FILE_MEDIA_BYTES = 20 * 1024 * 1024;
|
|
67
82
|
//# sourceMappingURL=upload-limits.js.map
|
package/lib/upload-limits.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-limits.js","sourceRoot":"","sources":["../src/upload-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAA;AAEjD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA"}
|
|
1
|
+
{"version":3,"file":"upload-limits.js","sourceRoot":"","sources":["../src/upload-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAA;AAEjD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AAExD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA;AAErD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAA"}
|
package/lib/virtual-id.js
CHANGED
|
@@ -32,9 +32,69 @@ export const VIRTUAL_ID_PREFIX = 'zr~';
|
|
|
32
32
|
* text.
|
|
33
33
|
*/
|
|
34
34
|
export const VIRTUAL_GROUP_NAME_MARK = '\u2060';
|
|
35
|
+
/** MS-4: the two zero-width code points the serverId rides on inside a
|
|
36
|
+
* virtual group NAME — ZERO WIDTH SPACE encodes bit 0, ZERO WIDTH
|
|
37
|
+
* NON-JOINER bit 1. Invisible everywhere, and neither can appear in a
|
|
38
|
+
* server id's own visible text, so the window between the two marks is
|
|
39
|
+
* unambiguous. */
|
|
40
|
+
const ZERO_BIT = '\u200b';
|
|
41
|
+
const ONE_BIT = '\u200c';
|
|
42
|
+
const SERVER_ID_BITS = 32;
|
|
35
43
|
/** The server id half: exactly the 8 lowercase hex chars relay-server.ts
|
|
36
44
|
* mints (`randomBytes(4).toString('hex')`). */
|
|
37
45
|
const SERVER_ID_PATTERN = /^[0-9a-f]{8}$/;
|
|
46
|
+
/**
|
|
47
|
+
* MS-4: the invisible prefix a REMOTE model-menu group heading carries
|
|
48
|
+
* before its server name (merge-streams.ts mergeModelCatalogs). The full
|
|
49
|
+
* form is `${MARK}${32 zero-width bits}${MARK}` — the 32 bits of the
|
|
50
|
+
* 8-hex serverId (MSB first per nibble), ZERO_BIT for 0 and ONE_BIT for 1
|
|
51
|
+
* — so the browser half can tell WHICH server a remote model group came
|
|
52
|
+
* from (effects/model-group-side.ts classifies per-server hiding from
|
|
53
|
+
* heading text alone). A serverId that is not 8 lowercase hex (the format
|
|
54
|
+
* every real handshake carries) degrades to the bare legacy mark: the
|
|
55
|
+
* heading stays a marked remote heading, just without a decodable server.
|
|
56
|
+
*/
|
|
57
|
+
export function encodeServerIdZeroWidth(serverId) {
|
|
58
|
+
if (typeof serverId !== 'string' || !SERVER_ID_PATTERN.test(serverId))
|
|
59
|
+
return VIRTUAL_GROUP_NAME_MARK;
|
|
60
|
+
let bits = '';
|
|
61
|
+
for (const nibble of serverId) {
|
|
62
|
+
for (const bit of Number.parseInt(nibble, 16).toString(2).padStart(4, '0')) {
|
|
63
|
+
bits += bit === '0' ? ZERO_BIT : ONE_BIT;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return `${VIRTUAL_GROUP_NAME_MARK}${bits}${VIRTUAL_GROUP_NAME_MARK}`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* MS-4: read the server id back out of one group heading, or `undefined`.
|
|
70
|
+
* Strict like every decoder here: the text must start with the mark, the
|
|
71
|
+
* window right after it must be exactly 32 zero-width bits closed by the
|
|
72
|
+
* terminator mark — anything else (the legacy bare-mark heading, visible
|
|
73
|
+
* text, a short or long bit run, a missing terminator) answers
|
|
74
|
+
* `undefined`, which the classifier reads as "remote, server unknown".
|
|
75
|
+
*/
|
|
76
|
+
export function decodeServerIdZeroWidth(headingText) {
|
|
77
|
+
if (typeof headingText !== 'string' || !headingText.startsWith(VIRTUAL_GROUP_NAME_MARK))
|
|
78
|
+
return undefined;
|
|
79
|
+
const rest = headingText.slice(VIRTUAL_GROUP_NAME_MARK.length);
|
|
80
|
+
if (rest.length < SERVER_ID_BITS + 1 || rest[SERVER_ID_BITS] !== VIRTUAL_GROUP_NAME_MARK)
|
|
81
|
+
return undefined;
|
|
82
|
+
let hex = '';
|
|
83
|
+
for (let i = 0; i < SERVER_ID_BITS; i += 4) {
|
|
84
|
+
let nibble = 0;
|
|
85
|
+
for (let bit = 0; bit < 4; bit++) {
|
|
86
|
+
const bitChar = rest[i + bit];
|
|
87
|
+
if (bitChar === ZERO_BIT)
|
|
88
|
+
nibble = nibble << 1;
|
|
89
|
+
else if (bitChar === ONE_BIT)
|
|
90
|
+
nibble = (nibble << 1) | 1;
|
|
91
|
+
else
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
hex += nibble.toString(16);
|
|
95
|
+
}
|
|
96
|
+
return hex;
|
|
97
|
+
}
|
|
38
98
|
/** Build the virtual form of one server-side session or workspace id. */
|
|
39
99
|
export function toVirtual(serverId, id) {
|
|
40
100
|
return `${VIRTUAL_ID_PREFIX}${serverId}~${id}`;
|
package/lib/virtual-id.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-id.js","sourceRoot":"","sources":["../src/virtual-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,qDAAqD;AACrD,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAA;AAEtC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,QAAQ,CAAA;AAE/C;+CAC+C;AAC/C,MAAM,iBAAiB,GAAG,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"virtual-id.js","sourceRoot":"","sources":["../src/virtual-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,qDAAqD;AACrD,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAA;AAEtC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,QAAQ,CAAA;AAE/C;;;;kBAIkB;AAClB,MAAM,QAAQ,GAAG,QAAQ,CAAA;AACzB,MAAM,OAAO,GAAG,QAAQ,CAAA;AACxB,MAAM,cAAc,GAAG,EAAE,CAAA;AAEzB;+CAC+C;AAC/C,MAAM,iBAAiB,GAAG,eAAe,CAAA;AAEzC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAiB;IACvD,IAAI,OA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C,CAAC"}
|
package/lib/wizard/probe.js
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* `normalizeServerUrl` (https anywhere; plain http only for the explicit
|
|
14
14
|
* private-network allowances) and a 10 s ceiling per request.
|
|
15
15
|
*/
|
|
16
|
+
import http from 'node:http';
|
|
17
|
+
import https from 'node:https';
|
|
16
18
|
import { normalizeServerUrl } from '../client-pairing.js';
|
|
17
19
|
/**
|
|
18
20
|
* `GET /`: the ONE right answer is the gateway's pairing page — 401,
|
|
@@ -66,7 +68,50 @@ export function classifyAdminResponse(status, contentType, body) {
|
|
|
66
68
|
* the caller is an XHR/API client and makes `GET /` answer 401 JSON
|
|
67
69
|
* `{"ok":false,"reason":"unpaired"}` instead of the HTML pairing page;
|
|
68
70
|
* `/lan-gate/admin` answers 403 JSON regardless of `Accept`). */
|
|
71
|
+
async function probeOnceDirect(url, timeoutMs) {
|
|
72
|
+
const parsed = new URL(url);
|
|
73
|
+
const mod = parsed.protocol === 'https:' ? https : http;
|
|
74
|
+
return await new Promise((resolve, reject) => {
|
|
75
|
+
const req = mod.request(parsed, {
|
|
76
|
+
method: 'GET',
|
|
77
|
+
headers: { Accept: 'text/html' },
|
|
78
|
+
agent: false,
|
|
79
|
+
}, (res) => {
|
|
80
|
+
const chunks = [];
|
|
81
|
+
res.on('data', (chunk) => {
|
|
82
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
83
|
+
});
|
|
84
|
+
res.on('end', () => {
|
|
85
|
+
clearTimeout(timer);
|
|
86
|
+
resolve({
|
|
87
|
+
status: res.statusCode ?? 0,
|
|
88
|
+
contentType: String(res.headers['content-type'] ?? ''),
|
|
89
|
+
body: Buffer.concat(chunks).toString('utf8'),
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
res.on('error', (err) => {
|
|
93
|
+
clearTimeout(timer);
|
|
94
|
+
reject(err);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
const timer = setTimeout(() => {
|
|
98
|
+
const timeoutError = new Error('The operation was aborted due to timeout');
|
|
99
|
+
timeoutError.name = 'TimeoutError';
|
|
100
|
+
req.destroy(timeoutError);
|
|
101
|
+
}, timeoutMs);
|
|
102
|
+
if (typeof timer.unref === 'function')
|
|
103
|
+
timer.unref();
|
|
104
|
+
req.on('error', (err) => {
|
|
105
|
+
clearTimeout(timer);
|
|
106
|
+
reject(err);
|
|
107
|
+
});
|
|
108
|
+
req.end();
|
|
109
|
+
});
|
|
110
|
+
}
|
|
69
111
|
async function probeOnce(fetchImpl, url, timeoutMs) {
|
|
112
|
+
if (fetchImpl === undefined) {
|
|
113
|
+
return await probeOnceDirect(url, timeoutMs);
|
|
114
|
+
}
|
|
70
115
|
const response = await fetchImpl(url, {
|
|
71
116
|
redirect: 'manual',
|
|
72
117
|
signal: AbortSignal.timeout(timeoutMs),
|
|
@@ -91,7 +136,7 @@ export async function probeHostPath(publicUrl, options = {}) {
|
|
|
91
136
|
if (!normalized.ok) {
|
|
92
137
|
return { kind: 'unreachable', reason: normalized.reason === 'insecure-http' ? 'insecure-http' : 'invalid-url', ms: 0 };
|
|
93
138
|
}
|
|
94
|
-
const fetchImpl = options.fetchImpl
|
|
139
|
+
const fetchImpl = options.fetchImpl;
|
|
95
140
|
const timeoutMs = options.timeoutMs ?? 10_000;
|
|
96
141
|
try {
|
|
97
142
|
const [root, admin] = await Promise.all([
|
package/lib/wizard/probe.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probe.js","sourceRoot":"","sources":["../../src/wizard/probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAiBzD;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc,EAAE,WAAmB,EAAE,IAAY;IACpF,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;QACnB,IAAI,WAAW,CAAC,QAAQ,CAAC,W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E,SAAS,CAAC;SACpE,CAAC,CAAA;QACF,OAAO;YACL,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,oBAAoB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC;YACpE,KAAK,EAAE,qBAAqB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC;YACzE,EAAE,EAAE,OAAO,EAAE;SACd,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,GAAI,KAAe,EAAE,IAAI,CAAA;QACnC,OAAO;YACL,IAAI,EAAE,aAAa;YACnB,MAAM,EAAE,IAAI,KAAK,cAAc,IAAI,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;YAChF,MAAM,EAAE,MAAM,CAAE,KAAe,EAAE,OAAO,IAAI,KAAK,CAAC;YAClD,EAAE,EAAE,OAAO,EAAE;SACd,CAAA;IACH,CAAC;AACH,CAAC"}
|
|
@@ -42,8 +42,11 @@ export function nginxSnippet(input) {
|
|
|
42
42
|
if ('error' in parts)
|
|
43
43
|
return parts.error;
|
|
44
44
|
const { domain, upstream, port } = parts;
|
|
45
|
+
const headerComment = input.lang === 'en'
|
|
46
|
+
? '# Place this in the http {} block (skip if you already have this map)'
|
|
47
|
+
: '# 这段放在 http {} 层(若已有同名 map 则跳过)';
|
|
45
48
|
const text = [
|
|
46
|
-
|
|
49
|
+
headerComment,
|
|
47
50
|
'map $http_upgrade $connection_upgrade {',
|
|
48
51
|
' default upgrade;',
|
|
49
52
|
" '' close;",
|
|
@@ -101,6 +104,16 @@ export function luckySteps(input) {
|
|
|
101
104
|
const port = portOf(input.upstreamPort);
|
|
102
105
|
if (port === undefined)
|
|
103
106
|
return { ok: false, error: 'bad-upstream-port' };
|
|
107
|
+
if (input.lang === 'en') {
|
|
108
|
+
return {
|
|
109
|
+
ok: true,
|
|
110
|
+
steps: [
|
|
111
|
+
'In Lucky "Web Service", create a new rule listening on port 443 and bind your domain.',
|
|
112
|
+
`Set the backend (reverse proxy target) to http://${upstream}:${port} and enable WebSocket support.`,
|
|
113
|
+
'Turn on the catch-all switch to allow all paths, then save.',
|
|
114
|
+
],
|
|
115
|
+
};
|
|
116
|
+
}
|
|
104
117
|
return {
|
|
105
118
|
ok: true,
|
|
106
119
|
steps: [
|