@maiyunnet/kebab 8.6.0 → 8.6.1

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
@@ -1410,7 +1410,7 @@ index/variables/VER.md
1410
1410
 
1411
1411
  # Variable: VER
1412
1412
 
1413
- > `const` **VER**: `"8.6.0"` = `'8.6.0'`
1413
+ > `const` **VER**: `"8.6.1"` = `'8.6.1'`
1414
1414
 
1415
1415
  Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
1416
1416
 
@@ -20059,7 +20059,7 @@ Defined in: [sys/ctr.ts:548](https://github.com/maiyunnet/kebab/blob/master/sys/
20059
20059
 
20060
20060
  > `protected` **\_cross**(): `boolean`
20061
20061
 
20062
- Defined in: [sys/ctr.ts:762](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L762)
20062
+ Defined in: [sys/ctr.ts:765](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L765)
20063
20063
 
20064
20064
  开启跨域请求
20065
20065
  返回 true 接续执行,返回 false 需要中断用户本次访问(options请求)
@@ -20074,7 +20074,7 @@ Defined in: [sys/ctr.ts:762](https://github.com/maiyunnet/kebab/blob/master/sys/
20074
20074
 
20075
20075
  > `protected` **\_device**(): `"unknown"` \| `"android"` \| `"linux"` \| `"windows"` \| `"macintosh"` \| `"ipad"`
20076
20076
 
20077
- Defined in: [sys/ctr.ts:587](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L587)
20077
+ Defined in: [sys/ctr.ts:590](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L590)
20078
20078
 
20079
20079
  根据用户 ua 获取当前用户的设备类型
20080
20080
 
@@ -20086,13 +20086,21 @@ Defined in: [sys/ctr.ts:587](https://github.com/maiyunnet/kebab/blob/master/sys/
20086
20086
 
20087
20087
  ### \_enabledXsrf()
20088
20088
 
20089
- > `protected` **\_enabledXsrf**(): `void`
20089
+ > `protected` **\_enabledXsrf**(`opt?`): `void`
20090
20090
 
20091
20091
  Defined in: [sys/ctr.ts:559](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L559)
20092
20092
 
20093
20093
  当前页面开启 XSRF 支持(主要检测 cookie 是否存在)
20094
20094
  如果当前页面有 CDN,请不要使用
20095
20095
 
20096
+ #### Parameters
20097
+
20098
+ ##### opt?
20099
+
20100
+ ###### domain?
20101
+
20102
+ `string`
20103
+
20096
20104
  #### Returns
20097
20105
 
20098
20106
  `void`
@@ -20103,7 +20111,7 @@ Defined in: [sys/ctr.ts:559](https://github.com/maiyunnet/kebab/blob/master/sys/
20103
20111
 
20104
20112
  > `protected` **\_end**(): `void`
20105
20113
 
20106
- Defined in: [sys/ctr.ts:845](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L845)
20114
+ Defined in: [sys/ctr.ts:848](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L848)
20107
20115
 
20108
20116
  主动关闭当前 socket 连接
20109
20117
 
@@ -20117,7 +20125,7 @@ Defined in: [sys/ctr.ts:845](https://github.com/maiyunnet/kebab/blob/master/sys/
20117
20125
 
20118
20126
  > `protected` **\_getBasicAuth**(`user`, `pwd`): `string`
20119
20127
 
20120
- Defined in: [sys/ctr.ts:580](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L580)
20128
+ Defined in: [sys/ctr.ts:583](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L583)
20121
20129
 
20122
20130
  获取 Auth 字符串,用于客户端提交
20123
20131
 
@@ -20145,7 +20153,7 @@ Defined in: [sys/ctr.ts:580](https://github.com/maiyunnet/kebab/blob/master/sys/
20145
20153
 
20146
20154
  > `protected` **\_getLocale**(): `string`
20147
20155
 
20148
- Defined in: [sys/ctr.ts:754](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L754)
20156
+ Defined in: [sys/ctr.ts:757](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L757)
20149
20157
 
20150
20158
  获取当前语言名
20151
20159
 
@@ -20159,7 +20167,7 @@ Defined in: [sys/ctr.ts:754](https://github.com/maiyunnet/kebab/blob/master/sys/
20159
20167
 
20160
20168
  > `protected` **\_getLocaleJsonString**(): `string`
20161
20169
 
20162
- Defined in: [sys/ctr.ts:742](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L742)
20170
+ Defined in: [sys/ctr.ts:745](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L745)
20163
20171
 
20164
20172
  根据当前后台语言包设置情况获取 JSON 字符串传输到前台
20165
20173
 
@@ -20211,7 +20219,7 @@ Defined in: [sys/ctr.ts:315](https://github.com/maiyunnet/kebab/blob/master/sys/
20211
20219
 
20212
20220
  > `protected` **\_handleFormData**(`events?`): `Promise`\<`boolean`\>
20213
20221
 
20214
- Defined in: [sys/ctr.ts:853](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L853)
20222
+ Defined in: [sys/ctr.ts:856](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L856)
20215
20223
 
20216
20224
  获取 formdata 的信息
20217
20225
 
@@ -20243,7 +20251,7 @@ Defined in: [sys/ctr.ts:853](https://github.com/maiyunnet/kebab/blob/master/sys/
20243
20251
 
20244
20252
  > **\_l**(`key`, `data?`): `string`
20245
20253
 
20246
- Defined in: [sys/ctr.ts:780](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L780)
20254
+ Defined in: [sys/ctr.ts:783](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L783)
20247
20255
 
20248
20256
  获取语言包值
20249
20257
 
@@ -20269,7 +20277,7 @@ Defined in: [sys/ctr.ts:780](https://github.com/maiyunnet/kebab/blob/master/sys/
20269
20277
 
20270
20278
  > `protected` **\_loadData**(`path`): `Promise`\<`Record`\<`string`, `string`\> \| `null`\>
20271
20279
 
20272
- Defined in: [sys/ctr.ts:645](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L645)
20280
+ Defined in: [sys/ctr.ts:648](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L648)
20273
20281
 
20274
20282
  获取 data 数据
20275
20283
 
@@ -20291,7 +20299,7 @@ Defined in: [sys/ctr.ts:645](https://github.com/maiyunnet/kebab/blob/master/sys/
20291
20299
 
20292
20300
  > `protected` **\_loadLocale**(`loc`, `pkg?`): `Promise`\<`boolean`\>
20293
20301
 
20294
- Defined in: [sys/ctr.ts:693](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L693)
20302
+ Defined in: [sys/ctr.ts:696](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L696)
20295
20303
 
20296
20304
  设定语言并加载语言包
20297
20305
 
@@ -20343,7 +20351,7 @@ Defined in: [sys/ctr.ts:332](https://github.com/maiyunnet/kebab/blob/master/sys/
20343
20351
 
20344
20352
  > `protected` **\_location**(`location`): `false`
20345
20353
 
20346
- Defined in: [sys/ctr.ts:663](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L663)
20354
+ Defined in: [sys/ctr.ts:666](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L666)
20347
20355
 
20348
20356
  跳转(302临时跳转),支持相对本项目根路径的路径或绝对路径
20349
20357
 
@@ -20365,7 +20373,7 @@ Defined in: [sys/ctr.ts:663](https://github.com/maiyunnet/kebab/blob/master/sys/
20365
20373
 
20366
20374
  > `protected` **\_ping**(`data?`): `boolean`
20367
20375
 
20368
- Defined in: [sys/ctr.ts:830](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L830)
20376
+ Defined in: [sys/ctr.ts:833](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L833)
20369
20377
 
20370
20378
  发送 socket ping
20371
20379
 
@@ -20387,7 +20395,7 @@ Defined in: [sys/ctr.ts:830](https://github.com/maiyunnet/kebab/blob/master/sys/
20387
20395
 
20388
20396
  > `protected` **\_pong**(`data?`): `boolean`
20389
20397
 
20390
- Defined in: [sys/ctr.ts:838](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L838)
20398
+ Defined in: [sys/ctr.ts:841](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L841)
20391
20399
 
20392
20400
  发送 socket pong
20393
20401
 
@@ -20409,7 +20417,7 @@ Defined in: [sys/ctr.ts:838](https://github.com/maiyunnet/kebab/blob/master/sys/
20409
20417
 
20410
20418
  > `protected` **\_startSession**(`link`, `auth?`, `opt?`): `Promise`\<`boolean`\>
20411
20419
 
20412
- Defined in: [sys/ctr.ts:677](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L677)
20420
+ Defined in: [sys/ctr.ts:680](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L680)
20413
20421
 
20414
20422
  开启 Session
20415
20423
 
@@ -20443,7 +20451,7 @@ Kv 或 Db 实例
20443
20451
 
20444
20452
  > `protected` **\_writeBinary**(`data`): `boolean`
20445
20453
 
20446
- Defined in: [sys/ctr.ts:822](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L822)
20454
+ Defined in: [sys/ctr.ts:825](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L825)
20447
20455
 
20448
20456
  发送 socket 二进制
20449
20457
 
@@ -20465,7 +20473,7 @@ Defined in: [sys/ctr.ts:822](https://github.com/maiyunnet/kebab/blob/master/sys/
20465
20473
 
20466
20474
  > `protected` **\_writeResult**(`data`): `boolean`
20467
20475
 
20468
- Defined in: [sys/ctr.ts:814](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L814)
20476
+ Defined in: [sys/ctr.ts:817](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L817)
20469
20477
 
20470
20478
  发送结果对象文本
20471
20479
 
@@ -20487,7 +20495,7 @@ Defined in: [sys/ctr.ts:814](https://github.com/maiyunnet/kebab/blob/master/sys/
20487
20495
 
20488
20496
  > `protected` **\_writeText**(`data`): `boolean`
20489
20497
 
20490
- Defined in: [sys/ctr.ts:806](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L806)
20498
+ Defined in: [sys/ctr.ts:809](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L809)
20491
20499
 
20492
20500
  发送 socket 文本
20493
20501
 
@@ -20509,7 +20517,7 @@ Defined in: [sys/ctr.ts:806](https://github.com/maiyunnet/kebab/blob/master/sys/
20509
20517
 
20510
20518
  > **getAuthorization**(): `string` \| `false` \| \{ `pwd`: `string`; `user`: `string`; \}
20511
20519
 
20512
- Defined in: [sys/ctr.ts:608](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L608)
20520
+ Defined in: [sys/ctr.ts:611](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L611)
20513
20521
 
20514
20522
  通过 header 或 _auth 获取鉴权信息或 JWT 信息(不解析)
20515
20523
 
package/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * --- 本文件用来定义每个目录实体地址的常量 ---
6
6
  */
7
7
  /** --- 当前系统版本号 --- */
8
- export declare const VER = "8.6.0";
8
+ export declare const VER = "8.6.1";
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 = '8.6.0';
9
+ export const VER = '8.6.1';
10
10
  // --- 服务端用的路径 ---
11
11
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
12
12
  /** --- /xxx/xxx --- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "8.6.0",
3
+ "version": "8.6.1",
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
@@ -179,7 +179,9 @@ export declare class Ctr {
179
179
  * --- 当前页面开启 XSRF 支持(主要检测 cookie 是否存在) ---
180
180
  * --- 如果当前页面有 CDN,请不要使用 ---
181
181
  */
182
- protected _enabledXsrf(): void;
182
+ protected _enabledXsrf(opt?: {
183
+ 'domain'?: string;
184
+ }): void;
183
185
  /**
184
186
  * --- 获取 Auth 字符串,用于客户端提交 ---
185
187
  * @param user 用户名
package/sys/ctr.js CHANGED
@@ -440,14 +440,15 @@ export class Ctr {
440
440
  * --- 当前页面开启 XSRF 支持(主要检测 cookie 是否存在) ---
441
441
  * --- 如果当前页面有 CDN,请不要使用 ---
442
442
  */
443
- _enabledXsrf() {
443
+ _enabledXsrf(opt) {
444
444
  // --- 设置 XSRF 值 ---
445
445
  if (this._cookie['XSRF-TOKEN'] === undefined) {
446
446
  const xsrf = lCore.random(16, lCore.RANDOM_LUN);
447
447
  this._xsrf = xsrf;
448
448
  lCore.setCookie(this, 'XSRF-TOKEN', xsrf, {
449
449
  'path': '/',
450
- 'httponly': true
450
+ 'httponly': true,
451
+ 'domain': opt?.domain,
451
452
  });
452
453
  this._cookie['XSRF-TOKEN'] = xsrf;
453
454
  }