xshell 1.2.12 → 1.2.14
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/net.browser.js +17 -17
- package/net.d.ts +5 -0
- package/net.js +27 -18
- package/package.json +20 -20
- package/process.js +1 -1
- package/server.d.ts +1 -0
- package/server.js +7 -7
- package/utils.browser.js +0 -3
- package/utils.js +0 -3
- /package/patches/{koa@2.15.3.patch → koa@2.15.4.patch} +0 -0
package/net.browser.js
CHANGED
|
@@ -315,9 +315,9 @@ export class Remote {
|
|
|
315
315
|
if (keeper) {
|
|
316
316
|
check(this.initiator && url);
|
|
317
317
|
this.keeper = {
|
|
318
|
-
reconnect_interval:
|
|
318
|
+
reconnect_interval: 5000,
|
|
319
319
|
heartbeat_interval: 1000 * 60,
|
|
320
|
-
error_delay:
|
|
320
|
+
error_delay: 2000,
|
|
321
321
|
...keeper
|
|
322
322
|
};
|
|
323
323
|
}
|
|
@@ -377,19 +377,20 @@ export class Remote {
|
|
|
377
377
|
await this.lwebsocket.request(async (websocket) => {
|
|
378
378
|
// 保存的 rpc 状态在 this.handlers, 与 websocket 无关,因此即使断开重连也不影响 rpc 的运行,即
|
|
379
379
|
// 底层连接断开后自动重连对上层应该是无感知的,除非再次连接时失败
|
|
380
|
-
if (websocket?.readyState
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
380
|
+
if (websocket?.readyState === WebSocket.OPEN)
|
|
381
|
+
return;
|
|
382
|
+
// 重连
|
|
383
|
+
try {
|
|
384
|
+
this.lwebsocket.resource = await connect_websocket(this.url, {
|
|
385
|
+
on_message: this._on_message,
|
|
386
|
+
on_error: this._on_error,
|
|
387
|
+
print: this.print
|
|
388
|
+
});
|
|
389
|
+
reconnected = true;
|
|
390
|
+
}
|
|
391
|
+
catch (error) {
|
|
392
|
+
this._on_error(error);
|
|
393
|
+
throw error;
|
|
393
394
|
}
|
|
394
395
|
});
|
|
395
396
|
if (this.keeper) {
|
|
@@ -502,8 +503,7 @@ export class Remote {
|
|
|
502
503
|
async call(func, args, websocket) {
|
|
503
504
|
return new Promise(async (resolve, reject) => {
|
|
504
505
|
const id = genid();
|
|
505
|
-
this.handlers.set(id, (
|
|
506
|
-
const { error, data } = message;
|
|
506
|
+
this.handlers.set(id, ({ error, data }) => {
|
|
507
507
|
if (error)
|
|
508
508
|
reject(error);
|
|
509
509
|
else
|
package/net.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const WebSocketConnecting = 0;
|
|
|
11
11
|
export declare const WebSocketOpen = 1;
|
|
12
12
|
export declare const WebSocketClosing = 2;
|
|
13
13
|
export declare const WebSocketClosed = 3;
|
|
14
|
+
export declare const websocket_states: readonly ["connecting", "open", "closing", "closed"];
|
|
14
15
|
export declare enum MyProxy {
|
|
15
16
|
socks5 = "http://127.0.0.1:10080",
|
|
16
17
|
whistle = "http://localhost:8899",
|
|
@@ -281,4 +282,8 @@ export declare class RemoteClient {
|
|
|
281
282
|
/** 发送 message 到 client
|
|
282
283
|
发送或连接出错时自动清理 message.id 对应的 handler */
|
|
283
284
|
send(message: Message): Promise<void>;
|
|
285
|
+
[inspect.custom](): {
|
|
286
|
+
remote: string;
|
|
287
|
+
websocket: string;
|
|
288
|
+
} & Omit<this, "websocket" | typeof import("util").inspect.custom | "call" | "remote" | "send">;
|
|
284
289
|
}
|
package/net.js
CHANGED
|
@@ -9,6 +9,7 @@ export const WebSocketConnecting = 0;
|
|
|
9
9
|
export const WebSocketOpen = 1;
|
|
10
10
|
export const WebSocketClosing = 2;
|
|
11
11
|
export const WebSocketClosed = 3;
|
|
12
|
+
export const websocket_states = ['connecting', 'open', 'closing', 'closed'];
|
|
12
13
|
export var MyProxy;
|
|
13
14
|
(function (MyProxy) {
|
|
14
15
|
MyProxy["socks5"] = "http://127.0.0.1:10080";
|
|
@@ -107,7 +108,7 @@ export async function request(url, options = {}) {
|
|
|
107
108
|
let headers = {
|
|
108
109
|
'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7,ja-JP;q=0.6,ja;q=0.5',
|
|
109
110
|
'accept-encoding': 'gzip, deflate, br',
|
|
110
|
-
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
|
|
111
|
+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36',
|
|
111
112
|
'sec-ch-ua-platform': '"Windows"',
|
|
112
113
|
'sec-ch-ua-platform-version': '"15.0.0"',
|
|
113
114
|
};
|
|
@@ -502,9 +503,9 @@ export class Remote {
|
|
|
502
503
|
if (keeper) {
|
|
503
504
|
check(this.initiator && url);
|
|
504
505
|
this.keeper = {
|
|
505
|
-
reconnect_interval:
|
|
506
|
+
reconnect_interval: 5000,
|
|
506
507
|
heartbeat_interval: 1000 * 60,
|
|
507
|
-
error_delay:
|
|
508
|
+
error_delay: 2000,
|
|
508
509
|
...keeper
|
|
509
510
|
};
|
|
510
511
|
}
|
|
@@ -564,19 +565,20 @@ export class Remote {
|
|
|
564
565
|
await this.lwebsocket.request(async (websocket) => {
|
|
565
566
|
// 保存的 rpc 状态在 this.handlers, 与 websocket 无关,因此即使断开重连也不影响 rpc 的运行,即
|
|
566
567
|
// 底层连接断开后自动重连对上层应该是无感知的,除非再次连接时失败
|
|
567
|
-
if (websocket?.readyState
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
568
|
+
if (websocket?.readyState === WebSocketOpen)
|
|
569
|
+
return;
|
|
570
|
+
// 重连
|
|
571
|
+
try {
|
|
572
|
+
this.lwebsocket.resource = await connect_websocket(this.url, {
|
|
573
|
+
on_message: this._on_message,
|
|
574
|
+
on_error: this._on_error,
|
|
575
|
+
print: this.print
|
|
576
|
+
});
|
|
577
|
+
reconnected = true;
|
|
578
|
+
}
|
|
579
|
+
catch (error) {
|
|
580
|
+
this._on_error(error);
|
|
581
|
+
throw error;
|
|
580
582
|
}
|
|
581
583
|
});
|
|
582
584
|
if (this.keeper) {
|
|
@@ -689,8 +691,7 @@ export class Remote {
|
|
|
689
691
|
async call(func, args, websocket) {
|
|
690
692
|
return new Promise(async (resolve, reject) => {
|
|
691
693
|
const id = genid();
|
|
692
|
-
this.handlers.set(id, (
|
|
693
|
-
const { error, data } = message;
|
|
694
|
+
this.handlers.set(id, ({ error, data }) => {
|
|
694
695
|
if (error)
|
|
695
696
|
reject(error);
|
|
696
697
|
else
|
|
@@ -723,5 +724,13 @@ export class RemoteClient {
|
|
|
723
724
|
async send(message) {
|
|
724
725
|
return this.remote.send(message, this.websocket);
|
|
725
726
|
}
|
|
727
|
+
[inspect.custom]() {
|
|
728
|
+
const { [inspect.custom]: _inspect, websocket, remote, ...others } = this;
|
|
729
|
+
return {
|
|
730
|
+
remote: '<Remote(receiver)>',
|
|
731
|
+
websocket: `<WebSocket(${websocket_states[websocket.readyState]})>`,
|
|
732
|
+
...others
|
|
733
|
+
};
|
|
734
|
+
}
|
|
726
735
|
}
|
|
727
736
|
//# sourceMappingURL=net.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xshell",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"bin": {
|
|
@@ -49,17 +49,17 @@
|
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@babel/core": "^7.26.
|
|
53
|
-
"@babel/parser": "^7.26.
|
|
54
|
-
"@babel/traverse": "^7.26.
|
|
52
|
+
"@babel/core": "^7.26.8",
|
|
53
|
+
"@babel/parser": "^7.26.8",
|
|
54
|
+
"@babel/traverse": "^7.26.8",
|
|
55
55
|
"@koa/cors": "^5.0.0",
|
|
56
|
-
"@stylistic/eslint-plugin": "^3.
|
|
56
|
+
"@stylistic/eslint-plugin": "^3.1.0",
|
|
57
57
|
"@svgr/webpack": "^8.1.0",
|
|
58
58
|
"@types/sass-loader": "^8.0.9",
|
|
59
59
|
"@types/ws": "^8.5.14",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
61
|
-
"@typescript-eslint/parser": "^8.
|
|
62
|
-
"@typescript-eslint/utils": "^8.
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
|
61
|
+
"@typescript-eslint/parser": "^8.24.0",
|
|
62
|
+
"@typescript-eslint/utils": "^8.24.0",
|
|
63
63
|
"archiver": "^7.0.1",
|
|
64
64
|
"chalk": "^5.4.1",
|
|
65
65
|
"cli-table3": "^0.6.5",
|
|
@@ -67,35 +67,35 @@
|
|
|
67
67
|
"commander": "^13.1.0",
|
|
68
68
|
"css-loader": "^7.1.2",
|
|
69
69
|
"emoji-regex": "^10.4.0",
|
|
70
|
-
"eslint": "^9.
|
|
70
|
+
"eslint": "^9.20.1",
|
|
71
71
|
"eslint-plugin-import": "^2.31.0",
|
|
72
72
|
"eslint-plugin-react": "^7.37.4",
|
|
73
73
|
"gulp-sort": "^2.0.0",
|
|
74
74
|
"https-proxy-agent": "^7.0.6",
|
|
75
75
|
"i18next": "^24.2.2",
|
|
76
76
|
"i18next-scanner": "^4.6.0",
|
|
77
|
-
"koa": "^2.15.
|
|
77
|
+
"koa": "^2.15.4",
|
|
78
78
|
"koa-compress": "^5.1.1",
|
|
79
79
|
"license-webpack-plugin": "^4.0.2",
|
|
80
80
|
"lodash": "^4.17.21",
|
|
81
81
|
"map-stream": "^0.0.7",
|
|
82
82
|
"mime-types": "^2.1.35",
|
|
83
|
-
"ora": "^8.
|
|
83
|
+
"ora": "^8.2.0",
|
|
84
84
|
"react": "^19.0.0",
|
|
85
85
|
"react-i18next": "^15.4.0",
|
|
86
|
-
"react-object-model": "^1.2.
|
|
86
|
+
"react-object-model": "^1.2.23",
|
|
87
87
|
"resolve-path": "^1.4.0",
|
|
88
|
-
"sass": "^1.
|
|
88
|
+
"sass": "^1.84.0",
|
|
89
89
|
"sass-loader": "^16.0.4",
|
|
90
90
|
"source-map-loader": "^5.0.0",
|
|
91
91
|
"strip-ansi": "^7.1.0",
|
|
92
92
|
"style-loader": "^4.0.0",
|
|
93
93
|
"through2": "^4.0.2",
|
|
94
|
-
"tough-cookie": "^5.1.
|
|
94
|
+
"tough-cookie": "^5.1.1",
|
|
95
95
|
"ts-loader": "^9.5.2",
|
|
96
96
|
"tslib": "^2.8.1",
|
|
97
97
|
"typescript": "^5.7.3",
|
|
98
|
-
"ua-parser-js": "^2.0.
|
|
98
|
+
"ua-parser-js": "^2.0.2",
|
|
99
99
|
"undici": "^7.3.0",
|
|
100
100
|
"vinyl": "^3.0.0",
|
|
101
101
|
"vinyl-fs": "^4.0.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"ws": "^8.18.0"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
|
-
"@babel/types": "^7.26.
|
|
107
|
+
"@babel/types": "^7.26.8",
|
|
108
108
|
"@types/archiver": "^6.0.3",
|
|
109
109
|
"@types/babel__traverse": "^7.20.6",
|
|
110
110
|
"@types/eslint": "^9.6.1",
|
|
@@ -112,20 +112,20 @@
|
|
|
112
112
|
"@types/gulp-sort": "^2.0.4",
|
|
113
113
|
"@types/koa": "^2.15.0",
|
|
114
114
|
"@types/koa-compress": "^4.0.6",
|
|
115
|
-
"@types/lodash": "^4.17.
|
|
115
|
+
"@types/lodash": "^4.17.15",
|
|
116
116
|
"@types/mime-types": "^2.1.4",
|
|
117
|
-
"@types/node": "^22.
|
|
117
|
+
"@types/node": "^22.13.1",
|
|
118
118
|
"@types/react": "^19.0.8",
|
|
119
119
|
"@types/through2": "^2.0.41",
|
|
120
120
|
"@types/tough-cookie": "^4.0.5",
|
|
121
121
|
"@types/ua-parser-js": "^0.7.39",
|
|
122
122
|
"@types/vinyl-fs": "^3.0.5",
|
|
123
|
-
"@types/vscode": "^1.
|
|
123
|
+
"@types/vscode": "^1.97.0",
|
|
124
124
|
"@types/webpack-bundle-analyzer": "^4.7.0"
|
|
125
125
|
},
|
|
126
126
|
"pnpm": {
|
|
127
127
|
"patchedDependencies": {
|
|
128
|
-
"koa@2.15.
|
|
128
|
+
"koa@2.15.4": "patches/koa@2.15.4.patch"
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
}
|
package/process.js
CHANGED
|
@@ -252,7 +252,7 @@ export async function call(exe, args = [], options = {}) {
|
|
|
252
252
|
});
|
|
253
253
|
});
|
|
254
254
|
const message = `进程 ${command} ` + (code
|
|
255
|
-
? `${throw_code ? '异常' : ''}结束,退出码: ${code}${signal ? `,信号: ${signal}` : ''}`
|
|
255
|
+
? `${throw_code ? '异常' : ''}结束,退出码: ${code} (${code.to_hex_str()})${signal ? `,信号: ${signal}` : ''}`
|
|
256
256
|
: '正常结束');
|
|
257
257
|
if (print.code && !code)
|
|
258
258
|
console.log(message.blue);
|
package/server.d.ts
CHANGED
package/server.js
CHANGED
|
@@ -572,7 +572,7 @@ export class Server {
|
|
|
572
572
|
return
|
|
573
573
|
} */
|
|
574
574
|
async try_send(ctx, fp, { fpd_root, assets_root, sea: _sea = sea, log_404 = true, } = {}) {
|
|
575
|
-
const { request: {
|
|
575
|
+
const { request: { method }, response, } = ctx;
|
|
576
576
|
if (response.body !== undefined || response.status !== 404)
|
|
577
577
|
return true;
|
|
578
578
|
if (method !== 'HEAD' && method !== 'GET')
|
|
@@ -584,15 +584,15 @@ export class Server {
|
|
|
584
584
|
catch (error) {
|
|
585
585
|
if (error.status !== 404)
|
|
586
586
|
throw error;
|
|
587
|
-
if (log_404 && this.print.logs)
|
|
588
|
-
|
|
589
|
-
if (_path !== path)
|
|
590
|
-
s += ` ${_path.bracket()}`;
|
|
591
|
-
console.log(s.red);
|
|
592
|
-
}
|
|
587
|
+
if (log_404 && this.print.logs)
|
|
588
|
+
this.log_404(ctx);
|
|
593
589
|
return false;
|
|
594
590
|
}
|
|
595
591
|
}
|
|
592
|
+
log_404(ctx) {
|
|
593
|
+
const { request: { _path, path, method } } = ctx;
|
|
594
|
+
console.log(`${' '.repeat(15)}${method.toLowerCase()} 404: ${path}${_path === path ? '' : ` ${_path.bracket()}`}`.red);
|
|
595
|
+
}
|
|
596
596
|
/** 将 body 设置为 fp 所指文件的 ReadStream
|
|
597
597
|
检查 fp 是否合法,设置对应的 content-type,支持缓存,支持分块下载
|
|
598
598
|
- ctx: Koa.Context
|
package/utils.browser.js
CHANGED
package/utils.js
CHANGED
|
File without changes
|