xshell 1.0.80 → 1.0.82

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/i18n/dict.json CHANGED
@@ -376,5 +376,8 @@
376
376
  },
377
377
  "不支持 content-encoding: {{encoding}} 的 http 请求": {
378
378
  "en": "http requests with content-encoding: {{encoding}} are not supported"
379
+ },
380
+ "等待 {{duration}} 秒后重试 request (已尝试 {{_count}} 次) …": {
381
+ "en": "Wait {{duration}} seconds before retrying request (tried {{_count}} times) …"
379
382
  }
380
383
  }
package/net.js CHANGED
@@ -43,14 +43,16 @@ async function request_retry(url, options, timeout, retries = 0, count = 0) {
43
43
  return await undici_request(url, options);
44
44
  }
45
45
  catch (error) {
46
- if (count < retries && (error.name === 'AbortError' || error.name === 'TimeoutError')) {
47
- const duration = 2 ** count;
48
- console.log(`${t('等待 {{duration}} 秒后重试 fetch ({{_count}}) …', { duration, _count: count }).yellow} ${url.toString().blue.underline}`);
49
- await delay(1000 * duration);
50
- return request_retry(url, options, timeout, retries, count + 1);
46
+ if (error.name === 'TimeoutError') {
47
+ if (count < retries) {
48
+ const duration = 2 ** count;
49
+ console.log(`${t('等待 {{duration}} 秒后重试 request (已尝试 {{_count}} 次) …', { duration, _count: count + 1 }).yellow} ${url.toString().blue.underline}`);
50
+ await delay(1000 * duration);
51
+ return request_retry(url, options, timeout, retries, count + 1);
52
+ }
53
+ else
54
+ throw Object.assign(new Error(`request 超时: ${url.toString()}`), { name: 'TimeoutError' });
51
55
  }
52
- else if (error.name === 'AbortError' || error.name === 'TimeoutError')
53
- throw Object.assign(new Error(`request 超时: ${url.toString()}`), { name: 'TimeoutError' });
54
56
  else
55
57
  throw error;
56
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.0.80",
3
+ "version": "1.0.82",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -70,7 +70,7 @@
70
70
  "emoji-regex": "^10.3.0",
71
71
  "gulp-sort": "^2.0.0",
72
72
  "hash-string": "^1.0.0",
73
- "i18next": "^23.7.13",
73
+ "i18next": "^23.7.16",
74
74
  "i18next-scanner": "^4.4.0",
75
75
  "js-cookie": "^3.0.5",
76
76
  "koa": "^2.15.0",
@@ -89,7 +89,7 @@
89
89
  "tslib": "^2.6.2",
90
90
  "typescript": "^5.3.3",
91
91
  "ua-parser-js": "2.0.0-alpha.2",
92
- "undici": "^6.2.1",
92
+ "undici": "^6.3.0",
93
93
  "vinyl": "^3.0.0",
94
94
  "vinyl-fs": "^4.0.0",
95
95
  "ws": "^8.16.0",
@@ -107,22 +107,17 @@
107
107
  "@types/chardet": "^0.8.3",
108
108
  "@types/gulp-sort": "2.0.4",
109
109
  "@types/js-cookie": "^3.0.6",
110
- "@types/koa": "^2.13.12",
110
+ "@types/koa": "^2.14.0",
111
111
  "@types/koa-compress": "^4.0.6",
112
112
  "@types/lodash": "^4.14.202",
113
113
  "@types/mime-types": "^2.1.4",
114
- "@types/node": "^20.10.6",
115
- "@types/react": "^18.2.46",
114
+ "@types/node": "^20.11.0",
115
+ "@types/react": "^18.2.47",
116
116
  "@types/through2": "^2.0.41",
117
117
  "@types/tough-cookie": "^4.0.5",
118
118
  "@types/ua-parser-js": "^0.7.39",
119
119
  "@types/vinyl-fs": "^3.0.5",
120
- "@types/vscode": "^1.85.0",
121
- "@typescript-eslint/eslint-plugin": "^6.17.0",
122
- "@typescript-eslint/parser": "^6.17.0",
123
- "eslint": "^8.56.0",
124
- "eslint-plugin-react": "^7.33.2",
125
- "eslint-plugin-xlint": "^1.0.11"
120
+ "@types/vscode": "^1.85.0"
126
121
  },
127
122
  "pnpm": {
128
123
  "patchedDependencies": {
package/process.d.ts CHANGED
@@ -65,6 +65,16 @@ export interface CallResult<TOutput extends string | Buffer = string> {
65
65
  child: ChildProcess;
66
66
  [inspect.custom](): string;
67
67
  }
68
+ export interface CallError {
69
+ result: {
70
+ pid: number;
71
+ stdout: string;
72
+ stderr: string;
73
+ code: number;
74
+ signal: number | NodeJS.Signals;
75
+ child: ChildProcess;
76
+ };
77
+ }
68
78
  /** call process for result
69
79
  - exe: .exe 路径或文件名 (建议使用路径,跳过 path 搜索,性能更高) path or filename (full path is recommanded to skip path searching for better perf)
70
80
  - args: `[]` 参数列表 arguments list
package/server.js CHANGED
@@ -109,18 +109,22 @@ export class Server {
109
109
  // fpd_certs 文件夹下面的每个 .key 对应一个证书及域名
110
110
  (await flist(fpd_certs, { print: false, filter: /\.key$/ }))
111
111
  .map(async (fname) => {
112
- const domain = fname.slice(0, -'.key'.length);
112
+ let domain = fname.slice(0, -'.key'.length);
113
113
  const [key, cert] = await Promise.all([
114
114
  fname,
115
115
  `${domain}.crt`,
116
116
  ].map(async (fname) => fread(`${fpd_certs}${fname}`, { print: false })));
117
+ if (domain.startsWith('star.'))
118
+ domain = `*.${domain.slice('star.'.length)}`;
117
119
  return [domain, { key, cert }];
118
120
  })));
119
121
  const default_ctx = lazy_secure_ctxs[this.default_hostnames.find(hostname => hostname in lazy_secure_ctxs)];
120
122
  assert(default_ctx);
121
123
  this.http2_server = http2_create_server({
122
124
  SNICallback(servername, callback) {
123
- let lazy_ctx = lazy_secure_ctxs[servername] || default_ctx;
125
+ let lazy_ctx = lazy_secure_ctxs[servername] ||
126
+ lazy_secure_ctxs[servername.replace(/^.*?\./, '*.')] ||
127
+ default_ctx;
124
128
  callback(null, lazy_ctx.ctx ??= createSecureContext(lazy_ctx));
125
129
  },
126
130
  allowHTTP1: true,
package/.eslintrc.json DELETED
@@ -1,186 +0,0 @@
1
- {
2
- "$schema": "./.eslintrc.schema.json",
3
-
4
- "root": true,
5
-
6
- "ignorePatterns": [
7
- "**/*.d.ts"
8
- ],
9
-
10
- "parser": "@typescript-eslint/parser",
11
- "parserOptions": {
12
- "ecmaVersion": "latest",
13
- "sourceType": "module",
14
- "project": "./tsconfig.json",
15
- "ecmaFeatures": {
16
- "jsx": true
17
- }
18
- },
19
-
20
- "plugins": [
21
- "@typescript-eslint",
22
- "react",
23
- "xlint"
24
- ],
25
-
26
- "settings": {
27
- "react": {
28
- "version": "detect"
29
- }
30
- },
31
-
32
- "env": {
33
- "node": true,
34
- "browser": true
35
- },
36
-
37
- "rules": {
38
- "xlint/fold-jsdoc-comments": "error",
39
-
40
- // 取代 nonblock-statement-body-position
41
- "xlint/nonblock-statement-body-position-with-indentation": "error",
42
-
43
- "xlint/empty-bracket-spacing": "error",
44
-
45
- // a + b**c
46
- "xlint/space-infix-ops-except-exponentiation": "error",
47
-
48
- "xlint/space-in-for-statement": "error",
49
-
50
- "xlint/jsx-no-redundant-parenthesis-in-return": "error",
51
-
52
- "xlint/keep-indent": "error",
53
-
54
- // 函数使用 function 来声明而不是 const foo = () => { }
55
- "xlint/func-style": "error",
56
-
57
-
58
- "@typescript-eslint/semi": ["error", "never"],
59
- "@typescript-eslint/no-extra-semi": "error",
60
- "semi-style": ["error", "first"],
61
-
62
- // 使用 ===
63
- "eqeqeq": "error",
64
-
65
- // 父类尽量返回 this 类型
66
- "@typescript-eslint/prefer-return-this-type": "error",
67
-
68
- // 尽量使用 . 访问属性而不是 []
69
- "@typescript-eslint/dot-notation": "error",
70
-
71
- // 必须 throw Error
72
- "@typescript-eslint/no-throw-literal": "error",
73
-
74
- // ------------ async
75
- // 返回 Promise 的函数一定要标记为 async 函数
76
- "@typescript-eslint/promise-function-async": "error",
77
-
78
- // 不要 return await promise, 直接 return promise, 除非外面有 try catch
79
- "@typescript-eslint/return-await": "error",
80
-
81
- // ------------ 括号
82
-
83
- // a => { } 而不是 (a) => { }
84
- "arrow-parens": ["error", "as-needed", { "requireForBlockBody": false }],
85
-
86
- // 不要多余的大括号
87
- // if (true)
88
- // console.log()
89
- "curly": ["error", "multi"],
90
-
91
- // 简单属性不要冗余的大括号 <Component prop='simple-value' />
92
- "react/jsx-curly-brace-presence": ["error", "never"],
93
-
94
- // ------------ 空格
95
-
96
- // { a, b } 这样的对象,大括号里面要有空格
97
- "@typescript-eslint/object-curly-spacing": ["error", "always"],
98
-
99
- // [a, b, c]
100
- "@typescript-eslint/comma-spacing": "error",
101
-
102
- // foo()
103
- "@typescript-eslint/func-call-spacing": "error",
104
-
105
- // a => { } 中箭头左右两边空格
106
- "arrow-spacing": ["error"],
107
-
108
- // 注释双斜杠后面要有空格
109
- "spaced-comment": ["error", "always", { "markers": ["/"] }],
110
-
111
- // 函数声明中,名称后面要有空格
112
- "@typescript-eslint/space-before-function-paren": "error",
113
-
114
- // { return true } 这样的 block 大括号里面要有空格
115
- "block-spacing": ["error", "always"],
116
-
117
- // aaa: 123
118
- "@typescript-eslint/key-spacing": ["error", { "beforeColon": false, "afterColon": true, "mode": "minimum" }],
119
-
120
- // aaa: string
121
- "@typescript-eslint/type-annotation-spacing": "error",
122
-
123
- // if ()
124
- "@typescript-eslint/keyword-spacing": ["error", { "before": true, "after": true }],
125
-
126
- // if (1) { }
127
- "@typescript-eslint/space-before-blocks": "error",
128
-
129
- // case 1: ...
130
- "switch-colon-spacing": "error",
131
-
132
- // <Hello name={firstname} />
133
- "react/jsx-equals-spacing": ["error", "never"],
134
-
135
- // 不允许使用 tab
136
- "no-tabs": "error",
137
-
138
- // 使用 \n 换行
139
- "linebreak-style": ["error", "unix"],
140
-
141
- // 文件以 \n 结尾
142
- "eol-last": ["error", "always"],
143
-
144
- // ------------ 引号
145
-
146
- // 用单引号
147
- "jsx-quotes": ["error", "prefer-single"],
148
-
149
- // 用单引号
150
- "quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": false }],
151
-
152
- // 不要冗余的引号包裹属性
153
- "quote-props": ["error", "as-needed", { "keywords": false, "unnecessary": true }],
154
-
155
- // ------------ 其它
156
- // boolean 属性不要冗余的 ={true} <Component boolprop />
157
- "react/jsx-boolean-value": ["error", "never"],
158
-
159
- // 没有 children 的 Component 写成闭合标签 <Component />
160
- "react/self-closing-comp": "error",
161
-
162
- // 单行类型声明用 `,` 分割,多行类型声明结尾不要加分号
163
- "@typescript-eslint/member-delimiter-style": ["error", {
164
- "multiline": {
165
- "delimiter": "none",
166
- "requireLast": false
167
- },
168
- "singleline": {
169
- "delimiter": "comma",
170
- "requireLast": false
171
- }
172
- }],
173
-
174
- "@typescript-eslint/prefer-includes": "error",
175
-
176
- "@typescript-eslint/prefer-regexp-exec": "error",
177
-
178
- // 禁止使用 export default
179
- "no-restricted-exports": ["error", { "restrictDefaultExports": { "direct": true, "named": true, "defaultFrom": true, "namedFrom": true, "namespaceFrom": true } }],
180
-
181
- "@typescript-eslint/consistent-type-imports": ["error", { "fixStyle": "inline-type-imports", "disallowTypeAnnotations": false }],
182
-
183
- // () => { 返回 void 的表达式 }
184
- "@typescript-eslint/no-confusing-void-expression": "error"
185
- }
186
- }