xshell 1.3.30 → 1.3.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xshell",
3
- "version": "1.3.30",
3
+ "version": "1.3.31",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -56,9 +56,9 @@
56
56
  "@stylistic/eslint-plugin": "^5.7.0",
57
57
  "@svgr/webpack": "^8.1.0",
58
58
  "@types/sass-loader": "^8.0.10",
59
- "@typescript-eslint/eslint-plugin": "^8.53.0",
60
- "@typescript-eslint/parser": "^8.53.0",
61
- "@typescript-eslint/utils": "^8.53.0",
59
+ "@typescript-eslint/eslint-plugin": "^8.53.1",
60
+ "@typescript-eslint/parser": "^8.53.1",
61
+ "@typescript-eslint/utils": "^8.53.1",
62
62
  "archiver": "^7.0.1",
63
63
  "chalk": "^5.6.2",
64
64
  "commander": "^14.0.2",
@@ -101,7 +101,7 @@
101
101
  "@types/koa": "^3.0.1",
102
102
  "@types/koa-compress": "^4.0.7",
103
103
  "@types/mime-types": "^3.0.1",
104
- "@types/node": "^25.0.8",
104
+ "@types/node": "^25.0.9",
105
105
  "@types/react": "^19.2.8",
106
106
  "@types/tough-cookie": "^4.0.5",
107
107
  "@types/vscode": "^1.108.1",
package/server.js CHANGED
@@ -439,12 +439,9 @@ export class Server {
439
439
  const { 'user-agent': user_agent, 'sec-ch-ua': ua, 'sec-ch-ua-mobile': mobile, 'sec-ch-ua-model': _model, 'sec-ch-ua-platform': _platform, 'sec-ch-ua-platform-version': _platform_version } = headers;
440
440
  // --- client hints
441
441
  let model = _model?.slice(1, -1).toLowerCase();
442
- if (model === '22127rk46c')
443
- model = 'redmi k60 pro';
444
- else if (model === '23013rk75c')
445
- model = 'redmi k60';
446
- else if (model === '24129pn74c')
447
- model = 'xiaomi 15';
442
+ const km = known_models[model];
443
+ if (km)
444
+ model = km;
448
445
  const ch_platform = [
449
446
  model,
450
447
  mobile === '?1' ? 'mobile' : '',
@@ -514,12 +511,12 @@ export class Server {
514
511
  if (part0 && part0.startsWith('Mozilla/5.0 (') && part0.endsWith(')')) {
515
512
  // 只取括号中间的
516
513
  ua_platform = part0.slice(13, -1).toLowerCase()
517
- .replace('22127rk46c', 'redmi k60 pro')
518
- .replace('23013rk75c', 'redmi k60')
519
- .replace('24129pn74c', 'xiaomi 15')
520
514
  .replace('macintosh', 'mac')
521
515
  .replace('linux; android', 'android')
522
- .replace(' build/tkq1.220905.001', '');
516
+ .replace(' build/tkq1.220905.001', '')
517
+ .replace(' build/bp2a.250605.031.a3', '');
518
+ for (const k in known_models)
519
+ ua_platform = ua_platform.replace(k, known_models[k]);
523
520
  // 没有多余的信息,屏蔽
524
521
  if (ua_platform === 'windows nt 10.0; win64; x64' && ch_platform.includes('win1'))
525
522
  ua_platform = '';
@@ -820,6 +817,13 @@ export class Server {
820
817
  }
821
818
  export const text_plain = 'text/plain; charset=utf-8';
822
819
  const devtools_trash = '/.well-known/appspecific/com.chrome.devtools.json';
820
+ const known_models = {
821
+ '25128pna1c': 'xiaomi 17 ultra leica',
822
+ '2512bpndac': 'xiaomi 17 ultra',
823
+ '22127rk46c': 'redmi k60 pro',
824
+ '23013rk75c': 'redmi k60',
825
+ '24129pn74c': 'xiaomi 15'
826
+ };
823
827
  function listen_http_server(server, port) {
824
828
  let plisten = defer2();
825
829
  server.once('error', plisten.reject);
package/utils.common.d.ts CHANGED
@@ -82,6 +82,10 @@ export declare function timeout<TReturn>(milliseconds: number, action: Promise<T
82
82
  action 返回 trusy 值时认为成功,返回 action 的结果
83
83
  如果次数用尽仍然失败,返回 null */
84
84
  export declare function poll<TResult>(duration: number, times: number, action: (breaker: () => void) => Promise<TResult>): Promise<TResult>;
85
+ /** 每天在固定时间执行操作
86
+ - hour: 0 - 23 之间的整数,在这个点执行
87
+ - action */
88
+ export declare function schedule_everyday(hour: number, minute: number, action: () => void | Promise<void>): Promise<void>;
85
89
  /** 模糊过滤字符串列表或对象列表,常用于根据用户输入补全或搜索过滤
86
90
  如果有完全匹配关键词的,只返回完全匹配关键词的候选项
87
91
  - query: 查询字符串,要求为全小写
package/utils.common.js CHANGED
@@ -255,6 +255,30 @@ export async function poll(duration, times, action) {
255
255
  }
256
256
  return null;
257
257
  }
258
+ /** 每天在固定时间执行操作
259
+ - hour: 0 - 23 之间的整数,在这个点执行
260
+ - action */
261
+ export async function schedule_everyday(hour, minute, action) {
262
+ const now = Date.now();
263
+ let target = new Date();
264
+ target.setHours(hour, minute, 0, 0);
265
+ // 如果目标时间已过,设定为明天的时间
266
+ if (now > target.getTime())
267
+ target.setDate(target.getDate() + 1);
268
+ // 等时间到
269
+ await delay(target.getTime() - now);
270
+ for (;;) {
271
+ try {
272
+ await action();
273
+ }
274
+ catch (error) {
275
+ // 往上抛没什么意义,打印个日志算了
276
+ console.error(error);
277
+ }
278
+ // 等一天
279
+ await delay(1000 * 60 * 60 * 24);
280
+ }
281
+ }
258
282
  /** 模糊过滤字符串列表或对象列表,常用于根据用户输入补全或搜索过滤
259
283
  如果有完全匹配关键词的,只返回完全匹配关键词的候选项
260
284
  - query: 查询字符串,要求为全小写
package/utils.d.ts CHANGED
@@ -8,10 +8,6 @@ export declare const output_width = 180;
8
8
  export declare const url_width = 52;
9
9
  export declare function set_inspect_options(colors?: boolean): void;
10
10
  export declare function typed_array_to_buffer(view: ArrayBufferView): Buffer<ArrayBufferLike>;
11
- /** 每天在固定时间执行操作
12
- - hour: 0 - 23 之间的整数,在这个点执行
13
- - action */
14
- export declare function schedule_everyday(hour: number, minute: number, action: () => Promise<void>): Promise<void>;
15
11
  export declare function log_line(): void;
16
12
  export declare function sha256(data: string | Uint8Array): string;
17
13
  export declare function sha1(data: string | Uint8Array): string;
package/utils.js CHANGED
@@ -3,7 +3,7 @@ import util from 'node:util';
3
3
  import ncrypto from 'node:crypto';
4
4
  import "./prototype.js";
5
5
  import "./platform.js";
6
- import { assert, decode, defer, delay } from "./utils.common.js";
6
+ import { assert, decode, defer } from "./utils.common.js";
7
7
  export * from "./utils.common.js";
8
8
  /** `180` 输出字符宽度 */
9
9
  export const output_width = 180;
@@ -27,30 +27,6 @@ export function set_inspect_options(colors = true) {
27
27
  export function typed_array_to_buffer(view) {
28
28
  return Buffer.from(view.buffer, view.byteOffset, view.byteLength);
29
29
  }
30
- /** 每天在固定时间执行操作
31
- - hour: 0 - 23 之间的整数,在这个点执行
32
- - action */
33
- export async function schedule_everyday(hour, minute, action) {
34
- const now = Date.now();
35
- let target = new Date();
36
- target.setHours(hour, minute, 0, 0);
37
- // 如果目标时间已过,设定为明天的时间
38
- if (now > target.getTime())
39
- target.setDate(target.getDate() + 1);
40
- // 等时间到
41
- await delay(target.getTime() - now);
42
- for (;;) {
43
- try {
44
- await action();
45
- }
46
- catch (error) {
47
- // 往上抛没什么意义,打印个日志算了
48
- console.error(error);
49
- }
50
- // 等一天
51
- await delay(1000 * 60 * 60 * 24);
52
- }
53
- }
54
30
  export function log_line() {
55
31
  console.log('---');
56
32
  }