@linxin666/dsh-remote-web-ui 0.3.18 → 0.3.20
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/lib/client.js +249 -90
- package/lib/client.js.map +1 -1
- package/lib/index.js +128 -30
- package/lib/types/client/mobile-adapt.d.ts.map +1 -1
- package/lib/types/client/mobile-adapt.js +313 -117
- package/lib/types/routes.d.ts +23 -0
- package/lib/types/routes.d.ts.map +1 -1
- package/lib/types/routes.js +94 -29
- package/lib/types/tunnel.d.ts +8 -0
- package/lib/types/tunnel.d.ts.map +1 -1
- package/lib/types/tunnel.js +11 -1
- package/lib/types/update.d.ts.map +1 -1
- package/lib/types/update.js +31 -11
- package/package.json +18 -18
- package/src/client/mobile-adapt.ts +293 -112
- package/src/client/remote.module.css +10 -4
- package/src/routes.ts +92 -25
- package/src/tunnel.ts +12 -1
- package/src/update.ts +30 -11
package/lib/types/routes.d.ts
CHANGED
|
@@ -31,6 +31,29 @@ import { type PairingService, type PairingSnapshot } from './pairing.ts';
|
|
|
31
31
|
* browser markers are same-origin.
|
|
32
32
|
*/
|
|
33
33
|
export declare function isTrustedApiRequest(request: IncomingMessage, trustedHosts: readonly string[]): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the request's Host is an authority this surface serves: loopback, or
|
|
36
|
+
* a trusted entry (exact `host:port`, or port-less `host` matching any port).
|
|
37
|
+
* The browser-marker checks stay in {@link isTrustedApiRequest}: a pairing
|
|
38
|
+
* entry page is a navigation, and its authority is the token or device
|
|
39
|
+
* credential it carries, not who linked to it.
|
|
40
|
+
* @param request - the node HTTP request.
|
|
41
|
+
* @param trustedHosts - non-loopback authorities this surface serves.
|
|
42
|
+
* @returns true when the Host is ours.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isTrustedHost(request: IncomingMessage, trustedHosts: readonly string[]): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the request is a top-level document navigation — the shape every
|
|
47
|
+
* phone uses to open a pairing link. Browsers label it `Sec-Fetch-Mode:
|
|
48
|
+
* navigate` with `Sec-Fetch-Dest: document`; in-app browsers (WeChat, and
|
|
49
|
+
* anything else wrapping a WKWebView) additionally attach `Sec-Fetch-Site:
|
|
50
|
+
* cross-site` or an opaque `Origin: null`, which the API fence must keep
|
|
51
|
+
* refusing but which says nothing about a document navigation: the pairing
|
|
52
|
+
* token or the device id in the URL is what authorizes it.
|
|
53
|
+
* @param request - the node HTTP request.
|
|
54
|
+
* @returns true for a top-level document navigation.
|
|
55
|
+
*/
|
|
56
|
+
export declare function isTopLevelDocumentNavigation(request: IncomingMessage): boolean;
|
|
34
57
|
/**
|
|
35
58
|
* Test whether a hostname represents a private local-area network (RFC 1918 / ULA / mDNS / loopback).
|
|
36
59
|
* Supports pairing in container-bridged (Docker) or NAT-proxied topologies where the host
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC/D,OAAO,EAAE,CAAC,EAAgB,MAAM,KAAK,CAAA;AACrC,OAAO,EAA0B,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAKhG;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC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,MAAM,EAAE,CAAC,CAAA;CAC7D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,QAAQ,EAAE,CAob3D"}
|
package/lib/types/routes.js
CHANGED
|
@@ -32,6 +32,35 @@ import { readJsonBody, writeJson } from "./http.js";
|
|
|
32
32
|
* browser markers are same-origin.
|
|
33
33
|
*/
|
|
34
34
|
export function isTrustedApiRequest(request, trustedHosts) {
|
|
35
|
+
if (!isTrustedHost(request, trustedHosts))
|
|
36
|
+
return false;
|
|
37
|
+
// Cross-site fence: an explicit cross-site marker is refused regardless of
|
|
38
|
+
// Origin (modern browsers label the initiator on every fetch).
|
|
39
|
+
if (request.headers['sec-fetch-site'] === 'cross-site')
|
|
40
|
+
return false;
|
|
41
|
+
// Origin fence: when a browser attaches an Origin it must be exactly this
|
|
42
|
+
// authority; absent Origin is fine — the Host fence already bound it.
|
|
43
|
+
const origin = request.headers.origin;
|
|
44
|
+
if (origin === undefined)
|
|
45
|
+
return true;
|
|
46
|
+
try {
|
|
47
|
+
return new URL(origin).host === new URL(`http://${request.headers.host ?? ''}`).host;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Whether the request's Host is an authority this surface serves: loopback, or
|
|
55
|
+
* a trusted entry (exact `host:port`, or port-less `host` matching any port).
|
|
56
|
+
* The browser-marker checks stay in {@link isTrustedApiRequest}: a pairing
|
|
57
|
+
* entry page is a navigation, and its authority is the token or device
|
|
58
|
+
* credential it carries, not who linked to it.
|
|
59
|
+
* @param request - the node HTTP request.
|
|
60
|
+
* @param trustedHosts - non-loopback authorities this surface serves.
|
|
61
|
+
* @returns true when the Host is ours.
|
|
62
|
+
*/
|
|
63
|
+
export function isTrustedHost(request, trustedHosts) {
|
|
35
64
|
const host = request.headers.host;
|
|
36
65
|
if (typeof host !== 'string')
|
|
37
66
|
return false;
|
|
@@ -43,29 +72,26 @@ export function isTrustedApiRequest(request, trustedHosts) {
|
|
|
43
72
|
return false;
|
|
44
73
|
}
|
|
45
74
|
const hostname = hostUrl.hostname;
|
|
46
|
-
|
|
75
|
+
return isLoopbackClient(request) || trustedHosts.some(entry => {
|
|
47
76
|
// A port-less entry matches the hostname on any port; an exact host:port
|
|
48
77
|
// entry matches that authority verbatim (WHATWG normalization both sides).
|
|
49
78
|
const entryUrl = new URL(`http://${entry}`);
|
|
50
79
|
return entryUrl.port === '' ? entryUrl.hostname === hostname : entryUrl.host === hostUrl.host;
|
|
51
80
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
catch {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Whether the request is a top-level document navigation — the shape every
|
|
84
|
+
* phone uses to open a pairing link. Browsers label it `Sec-Fetch-Mode:
|
|
85
|
+
* navigate` with `Sec-Fetch-Dest: document`; in-app browsers (WeChat, and
|
|
86
|
+
* anything else wrapping a WKWebView) additionally attach `Sec-Fetch-Site:
|
|
87
|
+
* cross-site` or an opaque `Origin: null`, which the API fence must keep
|
|
88
|
+
* refusing but which says nothing about a document navigation: the pairing
|
|
89
|
+
* token or the device id in the URL is what authorizes it.
|
|
90
|
+
* @param request - the node HTTP request.
|
|
91
|
+
* @returns true for a top-level document navigation.
|
|
92
|
+
*/
|
|
93
|
+
export function isTopLevelDocumentNavigation(request) {
|
|
94
|
+
return request.headers['sec-fetch-mode'] === 'navigate' && request.headers['sec-fetch-dest'] === 'document';
|
|
69
95
|
}
|
|
70
96
|
/**
|
|
71
97
|
* Test whether a hostname represents a private local-area network (RFC 1918 / ULA / mDNS / loopback).
|
|
@@ -133,7 +159,7 @@ export function isNonCrossSite(request) {
|
|
|
133
159
|
* the lanFence fallback use this to serve container-bridged and reverse-proxy
|
|
134
160
|
* topologies whose Host is not among the advertised or configured authorities.
|
|
135
161
|
*/
|
|
136
|
-
function privateLanHostOf(request) {
|
|
162
|
+
function privateLanHostOf(request, navigation = false) {
|
|
137
163
|
const host = request.headers.host;
|
|
138
164
|
if (typeof host !== 'string')
|
|
139
165
|
return undefined;
|
|
@@ -144,7 +170,12 @@ function privateLanHostOf(request) {
|
|
|
144
170
|
catch {
|
|
145
171
|
return undefined;
|
|
146
172
|
}
|
|
147
|
-
if (hostName === '' || !isPrivateOrLocalHostname(hostName)
|
|
173
|
+
if (hostName === '' || !isPrivateOrLocalHostname(hostName))
|
|
174
|
+
return undefined;
|
|
175
|
+
// A top-level navigation is judged by its credential, not by the initiator
|
|
176
|
+
// marker (see isTopLevelDocumentNavigation); every other request keeps the
|
|
177
|
+
// non-cross-site requirement.
|
|
178
|
+
if (!(navigation && isTopLevelDocumentNavigation(request)) && !isNonCrossSite(request))
|
|
148
179
|
return undefined;
|
|
149
180
|
return host;
|
|
150
181
|
}
|
|
@@ -171,6 +202,32 @@ export function acceptLimitKey(socketIp, forwarded, bucket) {
|
|
|
171
202
|
* distinct private Host headers cannot grow the table unboundedly.
|
|
172
203
|
*/
|
|
173
204
|
export const MAX_DYNAMIC_TRUSTED_HOSTS = 64;
|
|
205
|
+
/**
|
|
206
|
+
* Reasons a phone-facing entry page refused a request, logged once per shape
|
|
207
|
+
* so a real device failure is diagnosable from the host console without a
|
|
208
|
+
* debug build. Keyed by `reason|host|path`; bounded by construction (a handful
|
|
209
|
+
* of reasons, and only the first occurrence of each is printed).
|
|
210
|
+
*/
|
|
211
|
+
const loggedEntryRefusals = new Set();
|
|
212
|
+
/**
|
|
213
|
+
* Log one entry-page refusal (first occurrence per shape) and cap the set.
|
|
214
|
+
* @param request - the refused request.
|
|
215
|
+
* @param path - the entry path that refused it.
|
|
216
|
+
* @param reason - why the fence refused.
|
|
217
|
+
*/
|
|
218
|
+
function logEntryRefusal(request, path, reason) {
|
|
219
|
+
const key = `${reason}|${request.headers.host ?? ''}|${path}`;
|
|
220
|
+
if (loggedEntryRefusals.has(key) || loggedEntryRefusals.size >= 64)
|
|
221
|
+
return;
|
|
222
|
+
loggedEntryRefusals.add(key);
|
|
223
|
+
const markers = [
|
|
224
|
+
`sec-fetch-site=${request.headers['sec-fetch-site'] ?? '-'}`,
|
|
225
|
+
`sec-fetch-mode=${request.headers['sec-fetch-mode'] ?? '-'}`,
|
|
226
|
+
`sec-fetch-dest=${request.headers['sec-fetch-dest'] ?? '-'}`,
|
|
227
|
+
`origin=${request.headers.origin ?? '-'}`,
|
|
228
|
+
].join(' ');
|
|
229
|
+
console.log(`remote-web-ui: refused ${path} from host ${request.headers.host ?? '-'} (${reason}; ${markers})`);
|
|
230
|
+
}
|
|
174
231
|
/**
|
|
175
232
|
* FIFO-bounded Set insert: past `max` entries the oldest one is evicted
|
|
176
233
|
* (a Set iterates in insertion order). The dynamic trusted-host table is fed
|
|
@@ -435,8 +492,13 @@ export function makeRoutes(deps) {
|
|
|
435
492
|
const dynamicTrustedHosts = new Set();
|
|
436
493
|
/** Loopback-only fence: the desktop panel's control endpoints. */
|
|
437
494
|
const loopbackFence = (req) => isTrustedApiRequest(req, []);
|
|
438
|
-
/**
|
|
439
|
-
|
|
495
|
+
/**
|
|
496
|
+
* Phone-facing fence: loopback, the service's live LAN literals, configured
|
|
497
|
+
* public host, extra trusted hosts, or dynamically paired hosts. `navigation`
|
|
498
|
+
* relaxes the browser-marker checks for a top-level document navigation (the
|
|
499
|
+
* pairing entry pages), never for an API or subresource request.
|
|
500
|
+
*/
|
|
501
|
+
const lanFence = (req, navigation = false) => {
|
|
440
502
|
const publicHost = publicHostOf(service.publicBaseUrl);
|
|
441
503
|
// The service's LAN bases re-read per request: a hot rebind (the lan-bind
|
|
442
504
|
// toggle) updates them mid-process, and the fence must follow.
|
|
@@ -448,10 +510,10 @@ export function makeRoutes(deps) {
|
|
|
448
510
|
...extraHosts,
|
|
449
511
|
...dynamicTrustedHosts,
|
|
450
512
|
];
|
|
451
|
-
if (isTrustedApiRequest(req, combined))
|
|
513
|
+
if (navigation && isTopLevelDocumentNavigation(req) ? isTrustedHost(req, combined) : isTrustedApiRequest(req, combined))
|
|
452
514
|
return true;
|
|
453
515
|
// If request carries a valid paired device cookie from a private LAN host (e.g. after service restart), trust and remember it
|
|
454
|
-
const privateLanHost = privateLanHostOf(req);
|
|
516
|
+
const privateLanHost = privateLanHostOf(req, navigation);
|
|
455
517
|
if (privateLanHost !== undefined) {
|
|
456
518
|
const cookieDeviceId = readCookie(req.headers.cookie, service.config.cookieName);
|
|
457
519
|
let queryDeviceId = null;
|
|
@@ -706,8 +768,9 @@ export function makeRoutes(deps) {
|
|
|
706
768
|
const handleAcceptPage = async (req, res) => {
|
|
707
769
|
if (!requireMethod(req, res, 'GET'))
|
|
708
770
|
return;
|
|
709
|
-
const privateLanHost = privateLanHostOf(req);
|
|
710
|
-
if (!lanFence(req) && privateLanHost === undefined) {
|
|
771
|
+
const privateLanHost = privateLanHostOf(req, true);
|
|
772
|
+
if (!lanFence(req, true) && privateLanHost === undefined) {
|
|
773
|
+
logEntryRefusal(req, PAIR_PATHS.acceptPage, 'untrusted-host');
|
|
711
774
|
res.writeHead(403, { 'content-type': 'text/plain; charset=utf-8' });
|
|
712
775
|
res.end('forbidden');
|
|
713
776
|
return;
|
|
@@ -722,7 +785,8 @@ export function makeRoutes(deps) {
|
|
|
722
785
|
const ua = req.headers['user-agent'];
|
|
723
786
|
const result = token === '' ? { ok: false, code: 'invalid' } : service.accept(token, typeof ua === 'string' ? ua : undefined);
|
|
724
787
|
if (!result.ok) {
|
|
725
|
-
if (!lanFence(req)) {
|
|
788
|
+
if (!lanFence(req, true)) {
|
|
789
|
+
logEntryRefusal(req, PAIR_PATHS.acceptPage, 'untrusted-host-after-invalid-token');
|
|
726
790
|
res.writeHead(403, { 'content-type': 'text/plain; charset=utf-8' });
|
|
727
791
|
res.end('forbidden');
|
|
728
792
|
return;
|
|
@@ -772,7 +836,8 @@ export function makeRoutes(deps) {
|
|
|
772
836
|
const handleAppPage = async (req, res) => {
|
|
773
837
|
if (!requireMethod(req, res, 'GET'))
|
|
774
838
|
return;
|
|
775
|
-
if (!lanFence(req)) {
|
|
839
|
+
if (!lanFence(req, true)) {
|
|
840
|
+
logEntryRefusal(req, PAIR_PATHS.appPage, 'untrusted-host');
|
|
776
841
|
res.writeHead(403, { 'content-type': 'text/plain; charset=utf-8' });
|
|
777
842
|
res.end('forbidden');
|
|
778
843
|
return;
|
|
@@ -821,7 +886,7 @@ export function makeRoutes(deps) {
|
|
|
821
886
|
const handleAppServiceWorker = (req, res) => {
|
|
822
887
|
if (!requireMethod(req, res, 'GET'))
|
|
823
888
|
return;
|
|
824
|
-
if (!lanFence(req)) {
|
|
889
|
+
if (!lanFence(req, true)) {
|
|
825
890
|
res.writeHead(403, { 'content-type': 'text/plain; charset=utf-8' });
|
|
826
891
|
res.end('forbidden');
|
|
827
892
|
return;
|
package/lib/types/tunnel.d.ts
CHANGED
|
@@ -116,6 +116,14 @@ export declare function createBinaryReadiness(executable: string, seams?: Binary
|
|
|
116
116
|
* authority) — so the connector must restamp it with the stable origin.
|
|
117
117
|
*/
|
|
118
118
|
export declare function quickTunnelFlags(originHostHeader?: string): Record<string, string | boolean>;
|
|
119
|
+
/**
|
|
120
|
+
* Command-line arguments for a named tunnel with a persistent Cloudflare token.
|
|
121
|
+
* Note: `--no-autoupdate` and `--protocol` are flags for the `tunnel` command
|
|
122
|
+
* and must appear BEFORE the `run` subcommand. Putting them after `run` causes
|
|
123
|
+
* cloudflared to exit immediately with "flag provided but not defined: -no-autoupdate"
|
|
124
|
+
* (issues #1432, #1433).
|
|
125
|
+
*/
|
|
126
|
+
export declare function namedTunnelArgs(token: string): string[];
|
|
119
127
|
/**
|
|
120
128
|
* Own the lifecycle of one auto-tunnel: start/stop, URL surfacing, and
|
|
121
129
|
* crash-restart backoff.
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GS, '--http-host-header': originHostHeader };
|
|
133
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Command-line arguments for a named tunnel with a persistent Cloudflare token.
|
|
136
|
+
* Note: `--no-autoupdate` and `--protocol` are flags for the `tunnel` command
|
|
137
|
+
* and must appear BEFORE the `run` subcommand. Putting them after `run` causes
|
|
138
|
+
* cloudflared to exit immediately with "flag provided but not defined: -no-autoupdate"
|
|
139
|
+
* (issues #1432, #1433).
|
|
140
|
+
*/
|
|
141
|
+
export function namedTunnelArgs(token) {
|
|
142
|
+
return ['tunnel', '--no-autoupdate', '--protocol', 'http2', 'run', '--token', token];
|
|
143
|
+
}
|
|
134
144
|
/** Default factory: the cloudflared package's quick and named tunnels. */
|
|
135
145
|
function defaultFactory(target) {
|
|
136
146
|
// `--no-autoupdate`: the binary must never upgrade itself out from under
|
|
@@ -144,7 +154,7 @@ function defaultFactory(target) {
|
|
|
144
154
|
if (target.kind === 'quick') {
|
|
145
155
|
return Tunnel.quick(target.targetUrl, quickTunnelFlags(target.originHostHeader));
|
|
146
156
|
}
|
|
147
|
-
return namedTunnelHandle(Tunnel
|
|
157
|
+
return namedTunnelHandle(new Tunnel(namedTunnelArgs(target.token)), target.publicUrl);
|
|
148
158
|
}
|
|
149
159
|
/** Node timers. */
|
|
150
160
|
const nodeTimer = { setTimeout, clearTimeout };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/update.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE1C,iDAAiD;AACjD,eAAO,MAAM,YAAY,+BAA+B,CAAA;AAExD,iEAAiE;AACjE,eAAO,MAAM,YAAY,gBAAgB,CAAA;AAEzC,sEAAsE;AACtE,eAAO,MAAM,iBAAiB,2BAA2B,CAAA;AAEzD,+EAA+E;AAC/E,eAAO,MAAM,YAAY,iCAAiC,CAAA;AAE1D,sEAAsE;A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GAC1B,aAAa;AACf,6DAA6D;GAC3D,OAAO;AACT,iFAAiF;GAC/E,eAAe,CAAA;AAEnB,gCAAgC;AAChC,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAA;IACX,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAA;IACd,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gEAAgE;IAChE,SAAS,CAAC,EAAE,eAAe,CAAA;CAC5B;AAED,+CAA+C;AAC/C,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAA;IAClB,sCAAsC;IACtC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3B,oDAAoD;IACpD,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;IACxB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAA;CAC3B;AAyCD;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CA+HvE;AAED,0EAA0E;AAC1E,MAAM,WAAW,qBAAqB;IACpC,iDAAiD;IACjD,GAAG,EAAE,aAAa,CAAA;IAClB,8DAA8D;IAC9D,KAAK,EAAE,eAAe,CAAA;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAgE7F"}
|
package/lib/types/update.js
CHANGED
|
@@ -426,10 +426,29 @@ export async function checkUpdates(deps) {
|
|
|
426
426
|
const OUTPUT_CAP = 16 * 1024;
|
|
427
427
|
/**
|
|
428
428
|
* Windows cmd command-not-found stderr. With shell:true a missing shim
|
|
429
|
-
* exits with code 1 (cmd cannot report ENOENT), so the fallback chain
|
|
430
|
-
* detects this message instead of the spawn error event.
|
|
429
|
+
* exits with code 1 or 9009 (cmd cannot report ENOENT), so the fallback chain
|
|
430
|
+
* detects this message instead of the spawn error event. Supports both English
|
|
431
|
+
* and localized (e.g. Chinese) cmd error messages.
|
|
431
432
|
*/
|
|
432
|
-
const WIN_CMD_MISSING_RE = /not recognized as an internal or external command
|
|
433
|
+
const WIN_CMD_MISSING_RE = /not recognized as an internal or external command|不是内部或外部命令/i;
|
|
434
|
+
/**
|
|
435
|
+
* Decode process output with tolerant decoding:
|
|
436
|
+
* Defaults to UTF-8; if invalid byte sequences are encountered (common on
|
|
437
|
+
* Windows consoles using code page 936/GBK), falls back to GBK via TextDecoder.
|
|
438
|
+
*/
|
|
439
|
+
function decodeProcessChunk(chunk) {
|
|
440
|
+
try {
|
|
441
|
+
return new TextDecoder('utf-8', { fatal: true }).decode(chunk);
|
|
442
|
+
}
|
|
443
|
+
catch {
|
|
444
|
+
try {
|
|
445
|
+
return new TextDecoder('gbk').decode(chunk);
|
|
446
|
+
}
|
|
447
|
+
catch {
|
|
448
|
+
return chunk.toString('utf8');
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
433
452
|
/**
|
|
434
453
|
* Bypass for pnpm 11's supply-chain gate: `minimumReleaseAge` (default 24 h)
|
|
435
454
|
* silently skips same-day releases — `pnpm update --latest` then exits 0
|
|
@@ -483,10 +502,11 @@ export function runUpdate(deps) {
|
|
|
483
502
|
let output = '';
|
|
484
503
|
let currentOutput = '';
|
|
485
504
|
const append = (chunk) => {
|
|
486
|
-
|
|
505
|
+
const text = decodeProcessChunk(chunk);
|
|
506
|
+
output += text;
|
|
487
507
|
if (output.length > OUTPUT_CAP)
|
|
488
508
|
output = output.slice(output.length - OUTPUT_CAP);
|
|
489
|
-
currentOutput +=
|
|
509
|
+
currentOutput += text;
|
|
490
510
|
if (currentOutput.length > OUTPUT_CAP)
|
|
491
511
|
currentOutput = currentOutput.slice(currentOutput.length - OUTPUT_CAP);
|
|
492
512
|
};
|
|
@@ -563,11 +583,11 @@ export function runUpdate(deps) {
|
|
|
563
583
|
child.on('close', (code) => {
|
|
564
584
|
if (settled || finished)
|
|
565
585
|
return;
|
|
566
|
-
// Windows + shell: a missing command reports exit 1 with
|
|
567
|
-
// 'not recognized' instead of ENOENT — keep the
|
|
568
|
-
// against this candidate's own output so a prior
|
|
569
|
-
// cannot misclassify a real failure here.
|
|
570
|
-
if (platform === 'win32' && code !== 0 && WIN_CMD_MISSING_RE.test(currentOutput)) {
|
|
586
|
+
// Windows + shell: a missing command reports exit 1 or 9009 with
|
|
587
|
+
// 'not recognized' or localized message instead of ENOENT — keep the
|
|
588
|
+
// chain going. Checked against this candidate's own output so a prior
|
|
589
|
+
// fallback's stderr cannot misclassify a real failure here.
|
|
590
|
+
if (platform === 'win32' && (code === 9009 || (code !== 0 && WIN_CMD_MISSING_RE.test(currentOutput)))) {
|
|
571
591
|
runCandidate(index + 1);
|
|
572
592
|
return;
|
|
573
593
|
}
|
|
@@ -576,7 +596,7 @@ export function runUpdate(deps) {
|
|
|
576
596
|
ok: code === 0,
|
|
577
597
|
exitCode: code,
|
|
578
598
|
output,
|
|
579
|
-
error: code === 0 ? undefined :
|
|
599
|
+
error: code === 0 ? undefined : `${candidate.command} exited with code ` + String(code),
|
|
580
600
|
...(code === 0 ? {} : { errorCode: 'pnpm-failed' }),
|
|
581
601
|
});
|
|
582
602
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linxin666/dsh-remote-web-ui",
|
|
3
3
|
"description": "Scan-to-pair remote access for the dsh web GUI that shares one official interface: a QR beside the settings button pairs phones and PCs into the same Web GUI (a portrait-touch adaptation layer for phones, full desktop on PCs) through one-time tokens and revocable device sessions, with a LAN bind toggle, optional Cloudflare tunnel, and one-click family self-update",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.20",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": "^22.19.0 || >=24.0.0"
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"dsh": {
|
|
38
38
|
"engines": {
|
|
39
|
-
"dsh": ">=0.1.
|
|
39
|
+
"dsh": ">=0.1.5-rc.1"
|
|
40
40
|
},
|
|
41
41
|
"bundle": {
|
|
42
42
|
"patch": "./cordis.patch.yml"
|
|
@@ -63,22 +63,22 @@
|
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
66
|
-
"@deepseek-ai/dsh-agent": "^0.1.
|
|
67
|
-
"@deepseek-ai/dsh-api-remotes": "^0.1.
|
|
68
|
-
"@deepseek-ai/dsh-api-session-controller": "^0.1.
|
|
69
|
-
"@deepseek-ai/dsh-api-workspace-controller": "^0.1.
|
|
70
|
-
"@deepseek-ai/dsh-client-connection": "^0.1.
|
|
71
|
-
"@deepseek-ai/dsh-client-locale": "^0.1.
|
|
72
|
-
"@deepseek-ai/dsh-client-store": "^0.1.
|
|
73
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.
|
|
74
|
-
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.
|
|
75
|
-
"@deepseek-ai/dsh-client-ui-settings": "^0.1.
|
|
76
|
-
"@deepseek-ai/dsh-client-ui-sidebar": "^0.1.
|
|
77
|
-
"@deepseek-ai/dsh-client-ui-slots": "^0.1.
|
|
78
|
-
"@deepseek-ai/dsh-commands": "^0.1.
|
|
79
|
-
"@deepseek-ai/dsh-host-webserver": "^0.1.
|
|
80
|
-
"@deepseek-ai/dsh-invariants": "^0.1.
|
|
81
|
-
"@deepseek-ai/dsh-settings": "^0.1.
|
|
66
|
+
"@deepseek-ai/dsh-agent": "^0.1.5-rc.1",
|
|
67
|
+
"@deepseek-ai/dsh-api-remotes": "^0.1.5-rc.1",
|
|
68
|
+
"@deepseek-ai/dsh-api-session-controller": "^0.1.5-rc.1",
|
|
69
|
+
"@deepseek-ai/dsh-api-workspace-controller": "^0.1.5-rc.1",
|
|
70
|
+
"@deepseek-ai/dsh-client-connection": "^0.1.5-rc.1",
|
|
71
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.5-rc.1",
|
|
72
|
+
"@deepseek-ai/dsh-client-store": "^0.1.5-rc.1",
|
|
73
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.5-rc.1",
|
|
74
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-rc.1",
|
|
75
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.1.5-rc.1",
|
|
76
|
+
"@deepseek-ai/dsh-client-ui-sidebar": "^0.1.5-rc.1",
|
|
77
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.5-rc.1",
|
|
78
|
+
"@deepseek-ai/dsh-commands": "^0.1.5-rc.1",
|
|
79
|
+
"@deepseek-ai/dsh-host-webserver": "^0.1.5-rc.1",
|
|
80
|
+
"@deepseek-ai/dsh-invariants": "^0.1.5-rc.1",
|
|
81
|
+
"@deepseek-ai/dsh-settings": "^0.1.5-rc.1",
|
|
82
82
|
"@testing-library/dom": "^10.4.1",
|
|
83
83
|
"@testing-library/react": "^16.3.2",
|
|
84
84
|
"@types/node": "^22.20.0",
|