@maiyunnet/kebab 9.13.3 → 9.13.4

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/doc/kebab-rag.md CHANGED
@@ -1360,7 +1360,7 @@ index/variables/VER.md
1360
1360
 
1361
1361
  # Variable: VER
1362
1362
 
1363
- > `const` **VER**: `"9.13.3"` = `'9.13.3'`
1363
+ > `const` **VER**: `"9.13.4"` = `'9.13.4'`
1364
1364
 
1365
1365
  Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
1366
1366
 
@@ -22762,9 +22762,9 @@ Defined in: [sys/ctr.ts:571](https://github.com/maiyunnet/kebab/blob/master/sys/
22762
22762
 
22763
22763
  ### \_checkXInput()
22764
22764
 
22765
- > `protected` **\_checkXInput**(`input`, `rule`, `rtn`): `boolean`
22765
+ > `protected` **\_checkXInput**(`input`, `rule`, `rtn`, `ignore?`): `boolean`
22766
22766
 
22767
- Defined in: [sys/ctr.ts:749](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L749)
22767
+ Defined in: [sys/ctr.ts:750](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L750)
22768
22768
 
22769
22769
  检测提交的数据类型(会检测 XSRF)
22770
22770
 
@@ -22788,6 +22788,12 @@ Defined in: [sys/ctr.ts:749](https://github.com/maiyunnet/kebab/blob/master/sys/
22788
22788
 
22789
22789
  返回值
22790
22790
 
22791
+ ##### ignore?
22792
+
22793
+ `boolean` = `false`
22794
+
22795
+ 忽略 xsrf 判断
22796
+
22791
22797
  #### Returns
22792
22798
 
22793
22799
  `boolean`
@@ -22798,7 +22804,7 @@ Defined in: [sys/ctr.ts:749](https://github.com/maiyunnet/kebab/blob/master/sys/
22798
22804
 
22799
22805
  > `protected` **\_cross**(`opt?`): `boolean`
22800
22806
 
22801
- Defined in: [sys/ctr.ts:978](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L978)
22807
+ Defined in: [sys/ctr.ts:982](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L982)
22802
22808
 
22803
22809
  开启跨域请求
22804
22810
 
@@ -22843,7 +22849,7 @@ Defined in: [sys/ctr.ts:978](https://github.com/maiyunnet/kebab/blob/master/sys/
22843
22849
 
22844
22850
  > `protected` **\_device**(): `"unknown"` \| `"android"` \| `"linux"` \| `"windows"` \| `"macintosh"` \| `"ipad"`
22845
22851
 
22846
- Defined in: [sys/ctr.ts:791](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L791)
22852
+ Defined in: [sys/ctr.ts:795](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L795)
22847
22853
 
22848
22854
  根据用户 ua 获取当前用户的设备类型
22849
22855
 
@@ -22857,7 +22863,7 @@ Defined in: [sys/ctr.ts:791](https://github.com/maiyunnet/kebab/blob/master/sys/
22857
22863
 
22858
22864
  > `protected` **\_enabledXsrf**(`opt?`): `void`
22859
22865
 
22860
- Defined in: [sys/ctr.ts:760](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L760)
22866
+ Defined in: [sys/ctr.ts:764](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L764)
22861
22867
 
22862
22868
  当前页面开启 XSRF 支持(主要检测 cookie 是否存在)
22863
22869
  如果当前页面有 CDN,请不要使用
@@ -22880,7 +22886,7 @@ Defined in: [sys/ctr.ts:760](https://github.com/maiyunnet/kebab/blob/master/sys/
22880
22886
 
22881
22887
  > `protected` **\_end**(): `void`
22882
22888
 
22883
- Defined in: [sys/ctr.ts:1086](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1086)
22889
+ Defined in: [sys/ctr.ts:1090](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1090)
22884
22890
 
22885
22891
  主动关闭当前 socket 连接
22886
22892
 
@@ -22894,7 +22900,7 @@ Defined in: [sys/ctr.ts:1086](https://github.com/maiyunnet/kebab/blob/master/sys
22894
22900
 
22895
22901
  > `protected` **\_getBasicAuth**(`user`, `pwd`): `string`
22896
22902
 
22897
- Defined in: [sys/ctr.ts:784](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L784)
22903
+ Defined in: [sys/ctr.ts:788](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L788)
22898
22904
 
22899
22905
  获取 Auth 字符串,用于客户端提交
22900
22906
 
@@ -22922,7 +22928,7 @@ Defined in: [sys/ctr.ts:784](https://github.com/maiyunnet/kebab/blob/master/sys/
22922
22928
 
22923
22929
  > `protected` **\_getLocale**(): `string`
22924
22930
 
22925
- Defined in: [sys/ctr.ts:969](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L969)
22931
+ Defined in: [sys/ctr.ts:973](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L973)
22926
22932
 
22927
22933
  获取当前语言名
22928
22934
 
@@ -22936,7 +22942,7 @@ Defined in: [sys/ctr.ts:969](https://github.com/maiyunnet/kebab/blob/master/sys/
22936
22942
 
22937
22943
  > `protected` **\_getLocaleJsonString**(): `string`
22938
22944
 
22939
- Defined in: [sys/ctr.ts:957](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L957)
22945
+ Defined in: [sys/ctr.ts:961](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L961)
22940
22946
 
22941
22947
  根据当前后台语言包设置情况获取 JSON 字符串传输到前台
22942
22948
 
@@ -22988,7 +22994,7 @@ Defined in: [sys/ctr.ts:315](https://github.com/maiyunnet/kebab/blob/master/sys/
22988
22994
 
22989
22995
  > `protected` **\_handleFormData**(`events?`, `limits?`): `Promise`\<`boolean`\>
22990
22996
 
22991
- Defined in: [sys/ctr.ts:1095](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1095)
22997
+ Defined in: [sys/ctr.ts:1099](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1099)
22992
22998
 
22993
22999
  获取 formdata 的信息
22994
23000
 
@@ -23036,7 +23042,7 @@ Defined in: [sys/ctr.ts:1095](https://github.com/maiyunnet/kebab/blob/master/sys
23036
23042
 
23037
23043
  > **\_l**(`key`, `data?`): `string`
23038
23044
 
23039
- Defined in: [sys/ctr.ts:1021](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1021)
23045
+ Defined in: [sys/ctr.ts:1025](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1025)
23040
23046
 
23041
23047
  获取语言包值
23042
23048
 
@@ -23062,7 +23068,7 @@ Defined in: [sys/ctr.ts:1021](https://github.com/maiyunnet/kebab/blob/master/sys
23062
23068
 
23063
23069
  > `protected` **\_loadData**(`path`): `Promise`\<`Record`\<`string`, `string`\> \| `null`\>
23064
23070
 
23065
- Defined in: [sys/ctr.ts:860](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L860)
23071
+ Defined in: [sys/ctr.ts:864](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L864)
23066
23072
 
23067
23073
  获取 data 数据
23068
23074
 
@@ -23084,7 +23090,7 @@ Defined in: [sys/ctr.ts:860](https://github.com/maiyunnet/kebab/blob/master/sys/
23084
23090
 
23085
23091
  > `protected` **\_loadLocale**(`loc`, `pkg?`): `Promise`\<`boolean`\>
23086
23092
 
23087
- Defined in: [sys/ctr.ts:908](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L908)
23093
+ Defined in: [sys/ctr.ts:912](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L912)
23088
23094
 
23089
23095
  设定语言并加载语言包
23090
23096
 
@@ -23205,7 +23211,7 @@ Defined in: [sys/ctr.ts:332](https://github.com/maiyunnet/kebab/blob/master/sys/
23205
23211
 
23206
23212
  > `protected` **\_location**(`location`): `false`
23207
23213
 
23208
- Defined in: [sys/ctr.ts:878](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L878)
23214
+ Defined in: [sys/ctr.ts:882](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L882)
23209
23215
 
23210
23216
  跳转(302临时跳转),支持相对本项目根路径的路径或绝对路径
23211
23217
 
@@ -23227,7 +23233,7 @@ Defined in: [sys/ctr.ts:878](https://github.com/maiyunnet/kebab/blob/master/sys/
23227
23233
 
23228
23234
  > `protected` **\_ping**(`data?`): `boolean`
23229
23235
 
23230
- Defined in: [sys/ctr.ts:1071](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1071)
23236
+ Defined in: [sys/ctr.ts:1075](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1075)
23231
23237
 
23232
23238
  发送 socket ping
23233
23239
 
@@ -23249,7 +23255,7 @@ Defined in: [sys/ctr.ts:1071](https://github.com/maiyunnet/kebab/blob/master/sys
23249
23255
 
23250
23256
  > `protected` **\_pong**(`data?`): `boolean`
23251
23257
 
23252
- Defined in: [sys/ctr.ts:1079](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1079)
23258
+ Defined in: [sys/ctr.ts:1083](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1083)
23253
23259
 
23254
23260
  发送 socket pong
23255
23261
 
@@ -23271,7 +23277,7 @@ Defined in: [sys/ctr.ts:1079](https://github.com/maiyunnet/kebab/blob/master/sys
23271
23277
 
23272
23278
  > `protected` **\_startSession**(`link`, `auth?`, `opt?`): `Promise`\<`boolean`\>
23273
23279
 
23274
- Defined in: [sys/ctr.ts:892](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L892)
23280
+ Defined in: [sys/ctr.ts:896](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L896)
23275
23281
 
23276
23282
  开启 Session
23277
23283
 
@@ -23305,7 +23311,7 @@ Kv 或 Db 实例
23305
23311
 
23306
23312
  > `protected` **\_writeBinary**(`data`): `boolean`
23307
23313
 
23308
- Defined in: [sys/ctr.ts:1063](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1063)
23314
+ Defined in: [sys/ctr.ts:1067](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1067)
23309
23315
 
23310
23316
  发送 socket 二进制
23311
23317
 
@@ -23327,7 +23333,7 @@ Defined in: [sys/ctr.ts:1063](https://github.com/maiyunnet/kebab/blob/master/sys
23327
23333
 
23328
23334
  > `protected` **\_writeResult**(`data`): `boolean`
23329
23335
 
23330
- Defined in: [sys/ctr.ts:1055](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1055)
23336
+ Defined in: [sys/ctr.ts:1059](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1059)
23331
23337
 
23332
23338
  发送结果对象文本
23333
23339
 
@@ -23349,7 +23355,7 @@ Defined in: [sys/ctr.ts:1055](https://github.com/maiyunnet/kebab/blob/master/sys
23349
23355
 
23350
23356
  > `protected` **\_writeText**(`data`): `boolean`
23351
23357
 
23352
- Defined in: [sys/ctr.ts:1047](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1047)
23358
+ Defined in: [sys/ctr.ts:1051](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1051)
23353
23359
 
23354
23360
  发送 socket 文本
23355
23361
 
@@ -23371,7 +23377,7 @@ Defined in: [sys/ctr.ts:1047](https://github.com/maiyunnet/kebab/blob/master/sys
23371
23377
 
23372
23378
  > **getAuthorization**(): `false` \| \{ `pwd`: `string`; `type`: `"basic"`; `user`: `string`; \} \| \{ `token`: `string`; `type`: `"bearer"`; \}
23373
23379
 
23374
- Defined in: [sys/ctr.ts:812](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L812)
23380
+ Defined in: [sys/ctr.ts:816](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L816)
23375
23381
 
23376
23382
  通过 header 或 _auth 获取鉴权信息,支持 Basic Auth 和 Bearer Token
23377
23383
 
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "9.13.3";
8
+ export declare const VER = "9.13.4";
9
9
  /** --- 框架根目录,以 / 结尾 --- */
10
10
  export declare const ROOT_PATH: string;
11
11
  /** --- 框架的 LIB,以 / 结尾 --- */
package/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * --- 本文件用来定义每个目录实体地址的常量 ---
7
7
  */
8
8
  /** --- 当前系统版本号 --- */
9
- export const VER = '9.13.3';
9
+ export const VER = '9.13.4';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
@@ -31,7 +31,7 @@ export declare class Response {
31
31
  /**
32
32
  * --- 获取响应读取流对象 ---
33
33
  */
34
- getStream(): (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | zlib.Gunzip | zlib.Inflate | zlib.BrotliDecompress | null;
34
+ getStream(): zlib.BrotliDecompress | zlib.Gunzip | zlib.Inflate | (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | null;
35
35
  /**
36
36
  * --- 获取原生响应读取流对象 ---
37
37
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "9.13.3",
3
+ "version": "9.13.4",
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": [
package/sys/ctr.d.ts CHANGED
@@ -212,8 +212,9 @@ export declare class Ctr {
212
212
  * @param input 要校验的输入项
213
213
  * @param rule 规则, int, double, num(可字符串), array, bool, string, ascii
214
214
  * @param rtn 返回值
215
+ * @param ignore 忽略 xsrf 判断
215
216
  */
216
- protected _checkXInput(input: Record<string, kebab.Json>, rule: Record<string, kebab.Json[]>, rtn: kebab.Json[]): boolean;
217
+ protected _checkXInput(input: Record<string, kebab.Json>, rule: Record<string, kebab.Json[]>, rtn: kebab.Json[], ignore?: boolean): boolean;
217
218
  /**
218
219
  * --- 当前页面开启 XSRF 支持(主要检测 cookie 是否存在) ---
219
220
  * --- 如果当前页面有 CDN,请不要使用 ---
package/sys/ctr.js CHANGED
@@ -595,9 +595,12 @@ export class Ctr {
595
595
  * @param input 要校验的输入项
596
596
  * @param rule 规则, int, double, num(可字符串), array, bool, string, ascii
597
597
  * @param rtn 返回值
598
+ * @param ignore 忽略 xsrf 判断
598
599
  */
599
- _checkXInput(input, rule, rtn) {
600
- rule['_xsrf'] ??= ['require', this._cookie['XSRF-TOKEN'], [0, 'Bad request, no permission.']];
600
+ _checkXInput(input, rule, rtn, ignore = false) {
601
+ if (!ignore) {
602
+ rule['_xsrf'] ??= ['require', this._cookie['XSRF-TOKEN'], [0, 'Bad request, no permission.']];
603
+ }
601
604
  return this._checkInput(input, rule, rtn);
602
605
  }
603
606
  /**