@maiyunnet/kebab 3.1.8 → 3.1.9

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/index.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * ------------------------
9
9
  */
10
10
  /** --- 当前系统版本号 --- */
11
- export declare const VER = "3.1.8";
11
+ export declare const VER = "3.1.9";
12
12
  /** --- 框架根目录,以 / 结尾 --- */
13
13
  export declare const ROOT_PATH: string;
14
14
  export declare const LIB_PATH: string;
package/index.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * ------------------------
10
10
  */
11
11
  /** --- 当前系统版本号 --- */
12
- export const VER = '3.1.8';
12
+ export const VER = '3.1.9';
13
13
  // --- 服务端用的路径 ---
14
14
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
15
15
  /** --- /xxx/xxx --- */
package/lib/core.js CHANGED
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import * as cp from 'child_process';
7
7
  import * as stream from 'stream';
8
+ import * as os from 'os';
8
9
  import * as kebab from '#kebab/index.js';
9
10
  import * as lTime from '#kebab/lib/time.js';
10
11
  import * as lFs from '#kebab/lib/fs.js';
@@ -624,7 +625,7 @@ export function log(opt, msg, fend = '') {
624
625
  }
625
626
  path += h + '.csv';
626
627
  if (!await lFs.isFile(path)) {
627
- if (!await lFs.putContent(path, 'TIME,UNIX,URL,COOKIE,SESSION,JWT,USER_AGENT,REALIP,CLIENTIP,MESSAGE\n', {
628
+ if (!await lFs.putContent(path, 'TIME,UNIX,URL,COOKIE,SESSION,JWT,USER_AGENT,REALIP,CLIENTIP,OS,PROCESS,MESSAGE\n', {
628
629
  'encoding': 'utf8',
629
630
  'mode': 0o777
630
631
  })) {
@@ -641,6 +642,8 @@ export function log(opt, msg, fend = '') {
641
642
  (headers['user-agent']?.replace(/"/g, '""') ?? 'No HTTP_USER_AGENT') + '","' +
642
643
  realIp.replace(/"/g, '""') + '","' +
643
644
  clientIp.replace(/"/g, '""') + '","' +
645
+ lText.sizeFormat(os.totalmem() - os.freemem(), '') + '","' +
646
+ lText.sizeFormat(process.memoryUsage().rss, '') + '","' +
644
647
  JSON.stringify(msg).slice(1, -1).replace(/"/g, '""') + '"\n', {
645
648
  'encoding': 'utf8',
646
649
  'mode': 0o777,
package/lib/lang.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /** --- 支持的语言缩写列表 --- */
2
2
  export const codes = [
3
- 'sc', 'tc', 'ja', 'ko', 'en', 'es', 'th', 'vi',
4
- 'de', 'fr', 'pt', 'ru', 'ar', 'id', 'it', 'tr',
3
+ 'sc', 'tc', 'ja', 'ko', 'th', 'vi', 'ar', 'id',
4
+ 'en', 'es', 'de', 'fr', 'pt', 'ru', 'it', 'tr',
5
5
  ];
6
6
  export const names = [
7
- '简体中文', '繁體中文', '日本語', '한국어', 'English', 'Español', 'ไทย', 'Tiếng việt',
8
- 'Deutsch', 'Français', 'Português', 'Русский', 'العربية', 'Bahasa Indonesia', 'Italiano', 'Türkçe',
7
+ '简体中文', '繁體中文', '日本語', '한국어', 'ไทย', 'Tiếng việt', 'العربية', 'Bahasa Indonesia',
8
+ 'English', 'Español', 'Deutsch', 'Français', 'Português', 'Русский', 'Italiano', 'Türkçe',
9
9
  ];
10
10
  /** --- 浏览器常用映射为本语言 --- */
11
11
  export const map = {
@@ -13,16 +13,16 @@ export const map = {
13
13
  'zh': 'tc',
14
14
  'ja': 'ja',
15
15
  'ko': 'ko',
16
- 'en': 'en',
17
- 'es': 'es',
18
16
  'th': 'th',
19
17
  'vi': 'vi',
18
+ 'ar': 'ar',
19
+ 'id': 'id',
20
+ 'en': 'en',
21
+ 'es': 'es',
20
22
  'de': 'de',
21
23
  'fr': 'fr',
22
24
  'pt': 'pt',
23
25
  'ru': 'ru',
24
- 'ar': 'ar',
25
- 'id': 'id',
26
26
  'it': 'it',
27
27
  'tr': 'tr',
28
28
  };
package/lib/net.js CHANGED
@@ -468,6 +468,9 @@ export async function mproxy(ctr, auth, opt = {}) {
468
468
  const res = ctr.getPrototype('_res');
469
469
  /** --- 客户端请求中的 get 的数据 --- */
470
470
  const get = ctr.getPrototype('_get');
471
+ if (req.readableEnded) {
472
+ return -3;
473
+ }
471
474
  if (get['auth'] !== auth) {
472
475
  return 0;
473
476
  }
@@ -519,6 +522,9 @@ export async function rproxy(ctr, route, opt = {}) {
519
522
  const res = ctr.getPrototype('_res');
520
523
  const config = ctr.getPrototype('_config');
521
524
  const path = config.const.path + (config.const.qs ? '?' + config.const.qs : '');
525
+ if (req.readableEnded) {
526
+ return false;
527
+ }
522
528
  for (const key in route) {
523
529
  if (!path.startsWith(key)) {
524
530
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "3.1.8",
3
+ "version": "3.1.9",
4
4
  "description": "Simple, easy-to-use, and fully-featured Node.js framework that is ready-to-use out of the box.",
5
5
  "type": "module",
6
6
  "keywords": [