@maiyunnet/kebab 9.3.2 → 9.3.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 +66 -68
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/undici/response.d.ts +2 -2
- package/lib/undici/response.js +1 -1
- package/lib/undici.d.ts +1 -2
- package/lib/undici.js +1 -2
- package/package.json +1 -1
- package/sys/ctr.d.ts +1 -1
- package/sys/ctr.js +4 -1
- package/sys/master.js +72 -4
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.3.
|
|
1363
|
+
> `const` **VER**: `"9.3.4"` = `'9.3.4'`
|
|
1364
1364
|
|
|
1365
1365
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1366
1366
|
|
|
@@ -17807,7 +17807,7 @@ lib/undici/functions/fetch.md
|
|
|
17807
17807
|
|
|
17808
17808
|
> **fetch**(`input`, `init?`): `Promise`\<`Response`\>
|
|
17809
17809
|
|
|
17810
|
-
Defined in: [lib/undici.ts:
|
|
17810
|
+
Defined in: [lib/undici.ts:174](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L174)
|
|
17811
17811
|
|
|
17812
17812
|
发起一个完全兼容 fetch 的请求
|
|
17813
17813
|
|
|
@@ -17842,7 +17842,7 @@ lib/undici/functions/filterHeaders.md
|
|
|
17842
17842
|
|
|
17843
17843
|
> **filterHeaders**(`headers`, `res?`, `filter?`): `Record`\<`string`, `string` \| `string`[]\>
|
|
17844
17844
|
|
|
17845
|
-
Defined in: [lib/undici.ts:
|
|
17845
|
+
Defined in: [lib/undici.ts:529](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L529)
|
|
17846
17846
|
|
|
17847
17847
|
剔除不代理的 header,返回新的 header
|
|
17848
17848
|
|
|
@@ -17883,7 +17883,7 @@ lib/undici/functions/getFormData.md
|
|
|
17883
17883
|
|
|
17884
17884
|
> **getFormData**(): [`FormData`](../formdata/classes/FormData.md)
|
|
17885
17885
|
|
|
17886
|
-
Defined in: [lib/undici.ts:
|
|
17886
|
+
Defined in: [lib/undici.ts:513](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L513)
|
|
17887
17887
|
|
|
17888
17888
|
创建 FormData 对象
|
|
17889
17889
|
|
|
@@ -17966,7 +17966,7 @@ lib/undici/functions/getResponseJson.md
|
|
|
17966
17966
|
|
|
17967
17967
|
> **getResponseJson**(`u`, `opt?`): `Promise`\<`any`\>
|
|
17968
17968
|
|
|
17969
|
-
Defined in: [lib/undici.ts:
|
|
17969
|
+
Defined in: [lib/undici.ts:153](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L153)
|
|
17970
17970
|
|
|
17971
17971
|
发起 GET 请求并解析 JSON 响应
|
|
17972
17972
|
|
|
@@ -18003,7 +18003,7 @@ lib/undici/functions/mproxyData.md
|
|
|
18003
18003
|
|
|
18004
18004
|
> **mproxyData**(`ctr`): `any`
|
|
18005
18005
|
|
|
18006
|
-
Defined in: [lib/undici.ts:
|
|
18006
|
+
Defined in: [lib/undici.ts:618](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L618)
|
|
18007
18007
|
|
|
18008
18008
|
获取 mproxy 的附加数据
|
|
18009
18009
|
|
|
@@ -18032,7 +18032,7 @@ lib/undici/functions/mproxy.md
|
|
|
18032
18032
|
|
|
18033
18033
|
> **mproxy**(`ctr`, `auth`, `opt?`): `Promise`\<`number`\>
|
|
18034
18034
|
|
|
18035
|
-
Defined in: [lib/undici.ts:
|
|
18035
|
+
Defined in: [lib/undici.ts:565](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L565)
|
|
18036
18036
|
|
|
18037
18037
|
正向 mproxy 代理,注意提前处理不要自动处理 post 数据,读取 get 的 url 为实际请求地址
|
|
18038
18038
|
get: url, auth
|
|
@@ -18142,9 +18142,9 @@ lib/undici/functions/postJsonResponseJson.md
|
|
|
18142
18142
|
|
|
18143
18143
|
> **postJsonResponseJson**(`u`, `data`, `opt?`): `Promise`\<`any`\>
|
|
18144
18144
|
|
|
18145
|
-
Defined in: [lib/undici.ts:
|
|
18145
|
+
Defined in: [lib/undici.ts:130](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L130)
|
|
18146
18146
|
|
|
18147
|
-
发起 JSON 请求并解析 JSON
|
|
18147
|
+
发起 JSON 请求并解析 JSON 响应,失败时返回 null
|
|
18148
18148
|
|
|
18149
18149
|
## Parameters
|
|
18150
18150
|
|
|
@@ -18170,8 +18170,6 @@ Defined in: [lib/undici.ts:131](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18170
18170
|
|
|
18171
18171
|
`Promise`\<`any`\>
|
|
18172
18172
|
|
|
18173
|
-
JSON 数据,失败时返回 null
|
|
18174
|
-
|
|
18175
18173
|
lib/undici/functions/post.md
|
|
18176
18174
|
---
|
|
18177
18175
|
|
|
@@ -18226,7 +18224,7 @@ lib/undici/functions/request.md
|
|
|
18226
18224
|
|
|
18227
18225
|
> **request**(`u`, `data?`, `opt?`): `Promise`\<[`Response`](../response/classes/Response.md)\>
|
|
18228
18226
|
|
|
18229
|
-
Defined in: [lib/undici.ts:
|
|
18227
|
+
Defined in: [lib/undici.ts:343](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L343)
|
|
18230
18228
|
|
|
18231
18229
|
发起一个请求
|
|
18232
18230
|
|
|
@@ -18263,7 +18261,7 @@ lib/undici/functions/rproxy.md
|
|
|
18263
18261
|
|
|
18264
18262
|
> **rproxy**(`ctr`, `route`, `opt?`): `Promise`\<`boolean`\>
|
|
18265
18263
|
|
|
18266
|
-
Defined in: [lib/undici.ts:
|
|
18264
|
+
Defined in: [lib/undici.ts:636](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L636)
|
|
18267
18265
|
|
|
18268
18266
|
反向代理,注意提前处理不要自动处理 post 数据,将本服务器的某个路由反代到其他网址
|
|
18269
18267
|
|
|
@@ -18340,7 +18338,7 @@ lib/undici/interfaces/IMproxyOptions.md
|
|
|
18340
18338
|
|
|
18341
18339
|
# Interface: IMproxyOptions
|
|
18342
18340
|
|
|
18343
|
-
Defined in: [lib/undici.ts:
|
|
18341
|
+
Defined in: [lib/undici.ts:720](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L720)
|
|
18344
18342
|
|
|
18345
18343
|
正向代理请求的传入参数选项
|
|
18346
18344
|
|
|
@@ -18350,7 +18348,7 @@ Defined in: [lib/undici.ts:721](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18350
18348
|
|
|
18351
18349
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
18352
18350
|
|
|
18353
|
-
Defined in: [lib/undici.ts:
|
|
18351
|
+
Defined in: [lib/undici.ts:729](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L729)
|
|
18354
18352
|
|
|
18355
18353
|
过滤 header,返回 true 则留下
|
|
18356
18354
|
|
|
@@ -18370,7 +18368,7 @@ Defined in: [lib/undici.ts:730](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18370
18368
|
|
|
18371
18369
|
> `optional` **follow?**: `number`
|
|
18372
18370
|
|
|
18373
|
-
Defined in: [lib/undici.ts:
|
|
18371
|
+
Defined in: [lib/undici.ts:723](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L723)
|
|
18374
18372
|
|
|
18375
18373
|
***
|
|
18376
18374
|
|
|
@@ -18378,7 +18376,7 @@ Defined in: [lib/undici.ts:724](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18378
18376
|
|
|
18379
18377
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18380
18378
|
|
|
18381
|
-
Defined in: [lib/undici.ts:
|
|
18379
|
+
Defined in: [lib/undici.ts:727](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L727)
|
|
18382
18380
|
|
|
18383
18381
|
***
|
|
18384
18382
|
|
|
@@ -18386,7 +18384,7 @@ Defined in: [lib/undici.ts:728](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18386
18384
|
|
|
18387
18385
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18388
18386
|
|
|
18389
|
-
Defined in: [lib/undici.ts:
|
|
18387
|
+
Defined in: [lib/undici.ts:725](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L725)
|
|
18390
18388
|
|
|
18391
18389
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18392
18390
|
|
|
@@ -18396,7 +18394,7 @@ Defined in: [lib/undici.ts:726](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18396
18394
|
|
|
18397
18395
|
> `optional` **local?**: `string`
|
|
18398
18396
|
|
|
18399
|
-
Defined in: [lib/undici.ts:
|
|
18397
|
+
Defined in: [lib/undici.ts:726](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L726)
|
|
18400
18398
|
|
|
18401
18399
|
***
|
|
18402
18400
|
|
|
@@ -18404,7 +18402,7 @@ Defined in: [lib/undici.ts:727](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18404
18402
|
|
|
18405
18403
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18406
18404
|
|
|
18407
|
-
Defined in: [lib/undici.ts:
|
|
18405
|
+
Defined in: [lib/undici.ts:731](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L731)
|
|
18408
18406
|
|
|
18409
18407
|
默认为 default
|
|
18410
18408
|
|
|
@@ -18414,7 +18412,7 @@ Defined in: [lib/undici.ts:732](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18414
18412
|
|
|
18415
18413
|
> `optional` **timeout?**: `number`
|
|
18416
18414
|
|
|
18417
|
-
Defined in: [lib/undici.ts:
|
|
18415
|
+
Defined in: [lib/undici.ts:722](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L722)
|
|
18418
18416
|
|
|
18419
18417
|
秒数
|
|
18420
18418
|
|
|
@@ -18429,7 +18427,7 @@ lib/undici/interfaces/IRequestOptions.md
|
|
|
18429
18427
|
|
|
18430
18428
|
# Interface: IRequestOptions
|
|
18431
18429
|
|
|
18432
|
-
Defined in: [lib/undici.ts:
|
|
18430
|
+
Defined in: [lib/undici.ts:689](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L689)
|
|
18433
18431
|
|
|
18434
18432
|
请求的传入参数选项
|
|
18435
18433
|
|
|
@@ -18439,7 +18437,7 @@ Defined in: [lib/undici.ts:690](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18439
18437
|
|
|
18440
18438
|
> `optional` **cookie?**: `Record`\<`string`, [`ICookie`](../../cookie/interfaces/ICookie.md)\>
|
|
18441
18439
|
|
|
18442
|
-
Defined in: [lib/undici.ts:
|
|
18440
|
+
Defined in: [lib/undici.ts:714](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L714)
|
|
18443
18441
|
|
|
18444
18442
|
cookie 托管对象
|
|
18445
18443
|
|
|
@@ -18449,7 +18447,7 @@ cookie 托管对象
|
|
|
18449
18447
|
|
|
18450
18448
|
> `optional` **follow?**: `number`
|
|
18451
18449
|
|
|
18452
|
-
Defined in: [lib/undici.ts:
|
|
18450
|
+
Defined in: [lib/undici.ts:695](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L695)
|
|
18453
18451
|
|
|
18454
18452
|
追踪 location 次数,0 为不追踪,默认为 0
|
|
18455
18453
|
|
|
@@ -18459,7 +18457,7 @@ Defined in: [lib/undici.ts:696](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18459
18457
|
|
|
18460
18458
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18461
18459
|
|
|
18462
|
-
Defined in: [lib/undici.ts:
|
|
18460
|
+
Defined in: [lib/undici.ts:700](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L700)
|
|
18463
18461
|
|
|
18464
18462
|
***
|
|
18465
18463
|
|
|
@@ -18467,7 +18465,7 @@ Defined in: [lib/undici.ts:701](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18467
18465
|
|
|
18468
18466
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18469
18467
|
|
|
18470
|
-
Defined in: [lib/undici.ts:
|
|
18468
|
+
Defined in: [lib/undici.ts:697](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L697)
|
|
18471
18469
|
|
|
18472
18470
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18473
18471
|
|
|
@@ -18477,7 +18475,7 @@ Defined in: [lib/undici.ts:698](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18477
18475
|
|
|
18478
18476
|
> `optional` **keep?**: `boolean`
|
|
18479
18477
|
|
|
18480
|
-
Defined in: [lib/undici.ts:
|
|
18478
|
+
Defined in: [lib/undici.ts:710](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L710)
|
|
18481
18479
|
|
|
18482
18480
|
连接是否保持长连接(即是否允许复用),默认为 true
|
|
18483
18481
|
|
|
@@ -18487,7 +18485,7 @@ Defined in: [lib/undici.ts:711](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18487
18485
|
|
|
18488
18486
|
> `optional` **local?**: `string`
|
|
18489
18487
|
|
|
18490
|
-
Defined in: [lib/undici.ts:
|
|
18488
|
+
Defined in: [lib/undici.ts:699](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L699)
|
|
18491
18489
|
|
|
18492
18490
|
***
|
|
18493
18491
|
|
|
@@ -18495,7 +18493,7 @@ Defined in: [lib/undici.ts:700](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18495
18493
|
|
|
18496
18494
|
> `optional` **log?**: `boolean`
|
|
18497
18495
|
|
|
18498
|
-
Defined in: [lib/undici.ts:
|
|
18496
|
+
Defined in: [lib/undici.ts:716](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L716)
|
|
18499
18497
|
|
|
18500
18498
|
若有异常写入文件日志,默认为 true
|
|
18501
18499
|
|
|
@@ -18505,7 +18503,7 @@ Defined in: [lib/undici.ts:717](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18505
18503
|
|
|
18506
18504
|
> `optional` **method?**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"OPTIONS"`
|
|
18507
18505
|
|
|
18508
|
-
Defined in: [lib/undici.ts:
|
|
18506
|
+
Defined in: [lib/undici.ts:690](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L690)
|
|
18509
18507
|
|
|
18510
18508
|
***
|
|
18511
18509
|
|
|
@@ -18513,7 +18511,7 @@ Defined in: [lib/undici.ts:691](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18513
18511
|
|
|
18514
18512
|
> `optional` **mproxy?**: `object`
|
|
18515
18513
|
|
|
18516
|
-
Defined in: [lib/undici.ts:
|
|
18514
|
+
Defined in: [lib/undici.ts:702](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L702)
|
|
18517
18515
|
|
|
18518
18516
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
18519
18517
|
|
|
@@ -18541,7 +18539,7 @@ Defined in: [lib/undici.ts:703](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18541
18539
|
|
|
18542
18540
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18543
18541
|
|
|
18544
|
-
Defined in: [lib/undici.ts:
|
|
18542
|
+
Defined in: [lib/undici.ts:712](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L712)
|
|
18545
18543
|
|
|
18546
18544
|
复用池名/Agent,默认为 default
|
|
18547
18545
|
|
|
@@ -18551,7 +18549,7 @@ Defined in: [lib/undici.ts:713](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18551
18549
|
|
|
18552
18550
|
> `optional` **save?**: `string`
|
|
18553
18551
|
|
|
18554
|
-
Defined in: [lib/undici.ts:
|
|
18552
|
+
Defined in: [lib/undici.ts:698](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L698)
|
|
18555
18553
|
|
|
18556
18554
|
***
|
|
18557
18555
|
|
|
@@ -18559,7 +18557,7 @@ Defined in: [lib/undici.ts:699](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18559
18557
|
|
|
18560
18558
|
> `optional` **timeout?**: `number`
|
|
18561
18559
|
|
|
18562
|
-
Defined in: [lib/undici.ts:
|
|
18560
|
+
Defined in: [lib/undici.ts:693](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L693)
|
|
18563
18561
|
|
|
18564
18562
|
秒数,默认 10 秒
|
|
18565
18563
|
|
|
@@ -18569,7 +18567,7 @@ Defined in: [lib/undici.ts:694](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18569
18567
|
|
|
18570
18568
|
> `optional` **type?**: `"form"` \| `"json"`
|
|
18571
18569
|
|
|
18572
|
-
Defined in: [lib/undici.ts:
|
|
18570
|
+
Defined in: [lib/undici.ts:691](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L691)
|
|
18573
18571
|
|
|
18574
18572
|
lib/undici/interfaces/IRproxyOptions.md
|
|
18575
18573
|
---
|
|
@@ -18582,7 +18580,7 @@ lib/undici/interfaces/IRproxyOptions.md
|
|
|
18582
18580
|
|
|
18583
18581
|
# Interface: IRproxyOptions
|
|
18584
18582
|
|
|
18585
|
-
Defined in: [lib/undici.ts:
|
|
18583
|
+
Defined in: [lib/undici.ts:735](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L735)
|
|
18586
18584
|
|
|
18587
18585
|
反向代理请求的传入参数选项
|
|
18588
18586
|
|
|
@@ -18592,7 +18590,7 @@ Defined in: [lib/undici.ts:736](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18592
18590
|
|
|
18593
18591
|
> `optional` **filter?**: (`h`) => `boolean`
|
|
18594
18592
|
|
|
18595
|
-
Defined in: [lib/undici.ts:
|
|
18593
|
+
Defined in: [lib/undici.ts:744](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L744)
|
|
18596
18594
|
|
|
18597
18595
|
过滤 header,返回 true 则留下
|
|
18598
18596
|
|
|
@@ -18612,7 +18610,7 @@ Defined in: [lib/undici.ts:745](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18612
18610
|
|
|
18613
18611
|
> `optional` **follow?**: `number`
|
|
18614
18612
|
|
|
18615
|
-
Defined in: [lib/undici.ts:
|
|
18613
|
+
Defined in: [lib/undici.ts:738](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L738)
|
|
18616
18614
|
|
|
18617
18615
|
***
|
|
18618
18616
|
|
|
@@ -18620,7 +18618,7 @@ Defined in: [lib/undici.ts:739](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18620
18618
|
|
|
18621
18619
|
> `optional` **headers?**: [`THttpHeaders`](../type-aliases/THttpHeaders.md)
|
|
18622
18620
|
|
|
18623
|
-
Defined in: [lib/undici.ts:
|
|
18621
|
+
Defined in: [lib/undici.ts:742](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L742)
|
|
18624
18622
|
|
|
18625
18623
|
***
|
|
18626
18624
|
|
|
@@ -18628,7 +18626,7 @@ Defined in: [lib/undici.ts:743](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18628
18626
|
|
|
18629
18627
|
> `optional` **hosts?**: `string` \| `Record`\<`string`, `string`\>
|
|
18630
18628
|
|
|
18631
|
-
Defined in: [lib/undici.ts:
|
|
18629
|
+
Defined in: [lib/undici.ts:740](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L740)
|
|
18632
18630
|
|
|
18633
18631
|
自定义 host 映射,如 {'www.maiyun.net': '127.0.0.1'},或全部映射到一个 host
|
|
18634
18632
|
|
|
@@ -18638,7 +18636,7 @@ Defined in: [lib/undici.ts:741](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18638
18636
|
|
|
18639
18637
|
> `optional` **local?**: `string`
|
|
18640
18638
|
|
|
18641
|
-
Defined in: [lib/undici.ts:
|
|
18639
|
+
Defined in: [lib/undici.ts:741](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L741)
|
|
18642
18640
|
|
|
18643
18641
|
***
|
|
18644
18642
|
|
|
@@ -18646,7 +18644,7 @@ Defined in: [lib/undici.ts:742](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18646
18644
|
|
|
18647
18645
|
> `optional` **mproxy?**: `object`
|
|
18648
18646
|
|
|
18649
|
-
Defined in: [lib/undici.ts:
|
|
18647
|
+
Defined in: [lib/undici.ts:746](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L746)
|
|
18650
18648
|
|
|
18651
18649
|
正向 mproxy 代理,url 如 https://xxx/abc
|
|
18652
18650
|
|
|
@@ -18674,7 +18672,7 @@ Defined in: [lib/undici.ts:747](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18674
18672
|
|
|
18675
18673
|
> `optional` **reuse?**: `string` \| `Agent` \| `ProxyAgent`
|
|
18676
18674
|
|
|
18677
|
-
Defined in: [lib/undici.ts:
|
|
18675
|
+
Defined in: [lib/undici.ts:754](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L754)
|
|
18678
18676
|
|
|
18679
18677
|
默认为 default
|
|
18680
18678
|
|
|
@@ -18684,7 +18682,7 @@ Defined in: [lib/undici.ts:755](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
18684
18682
|
|
|
18685
18683
|
> `optional` **timeout?**: `number`
|
|
18686
18684
|
|
|
18687
|
-
Defined in: [lib/undici.ts:
|
|
18685
|
+
Defined in: [lib/undici.ts:737](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L737)
|
|
18688
18686
|
|
|
18689
18687
|
秒数
|
|
18690
18688
|
|
|
@@ -19075,7 +19073,7 @@ Defined in: [lib/undici/response.ts:32](https://github.com/maiyunnet/kebab/blob/
|
|
|
19075
19073
|
|
|
19076
19074
|
Defined in: [lib/undici/response.ts:63](https://github.com/maiyunnet/kebab/blob/master/lib/undici/response.ts#L63)
|
|
19077
19075
|
|
|
19078
|
-
读取所有内容为 JSON
|
|
19076
|
+
读取所有内容为 JSON,失败返回 null
|
|
19079
19077
|
|
|
19080
19078
|
#### Returns
|
|
19081
19079
|
|
|
@@ -19173,7 +19171,7 @@ lib/undici/type-aliases/THttpHeaders.md
|
|
|
19173
19171
|
|
|
19174
19172
|
> **THttpHeaders** = `http.IncomingHttpHeaders` & `object`
|
|
19175
19173
|
|
|
19176
|
-
Defined in: [lib/undici.ts:
|
|
19174
|
+
Defined in: [lib/undici.ts:759](https://github.com/maiyunnet/kebab/blob/master/lib/undici.ts#L759)
|
|
19177
19175
|
|
|
19178
19176
|
http headers
|
|
19179
19177
|
|
|
@@ -21918,7 +21916,7 @@ Defined in: [sys/ctr.ts:50](https://github.com/maiyunnet/kebab/blob/master/sys/c
|
|
|
21918
21916
|
|
|
21919
21917
|
Defined in: [sys/ctr.ts:80](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L80)
|
|
21920
21918
|
|
|
21921
|
-
|
|
21919
|
+
页面浏览器客户端缓存(单位:秒)
|
|
21922
21920
|
|
|
21923
21921
|
***
|
|
21924
21922
|
|
|
@@ -22208,7 +22206,7 @@ Defined in: [sys/ctr.ts:173](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22208
22206
|
|
|
22209
22207
|
> `protected` **\_checkInput**(`input`, `rule`, `rtn`): `boolean`
|
|
22210
22208
|
|
|
22211
|
-
Defined in: [sys/ctr.ts:
|
|
22209
|
+
Defined in: [sys/ctr.ts:571](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L571)
|
|
22212
22210
|
|
|
22213
22211
|
检测提交的数据类型
|
|
22214
22212
|
|
|
@@ -22242,7 +22240,7 @@ Defined in: [sys/ctr.ts:568](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22242
22240
|
|
|
22243
22241
|
> `protected` **\_checkXInput**(`input`, `rule`, `rtn`): `boolean`
|
|
22244
22242
|
|
|
22245
|
-
Defined in: [sys/ctr.ts:
|
|
22243
|
+
Defined in: [sys/ctr.ts:749](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L749)
|
|
22246
22244
|
|
|
22247
22245
|
检测提交的数据类型(会检测 XSRF)
|
|
22248
22246
|
|
|
@@ -22276,7 +22274,7 @@ Defined in: [sys/ctr.ts:746](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22276
22274
|
|
|
22277
22275
|
> `protected` **\_cross**(`opt?`): `boolean`
|
|
22278
22276
|
|
|
22279
|
-
Defined in: [sys/ctr.ts:
|
|
22277
|
+
Defined in: [sys/ctr.ts:978](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L978)
|
|
22280
22278
|
|
|
22281
22279
|
开启跨域请求
|
|
22282
22280
|
|
|
@@ -22321,7 +22319,7 @@ Defined in: [sys/ctr.ts:975](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22321
22319
|
|
|
22322
22320
|
> `protected` **\_device**(): `"unknown"` \| `"android"` \| `"linux"` \| `"windows"` \| `"macintosh"` \| `"ipad"`
|
|
22323
22321
|
|
|
22324
|
-
Defined in: [sys/ctr.ts:
|
|
22322
|
+
Defined in: [sys/ctr.ts:791](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L791)
|
|
22325
22323
|
|
|
22326
22324
|
根据用户 ua 获取当前用户的设备类型
|
|
22327
22325
|
|
|
@@ -22335,7 +22333,7 @@ Defined in: [sys/ctr.ts:788](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22335
22333
|
|
|
22336
22334
|
> `protected` **\_enabledXsrf**(`opt?`): `void`
|
|
22337
22335
|
|
|
22338
|
-
Defined in: [sys/ctr.ts:
|
|
22336
|
+
Defined in: [sys/ctr.ts:760](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L760)
|
|
22339
22337
|
|
|
22340
22338
|
当前页面开启 XSRF 支持(主要检测 cookie 是否存在)
|
|
22341
22339
|
如果当前页面有 CDN,请不要使用
|
|
@@ -22358,7 +22356,7 @@ Defined in: [sys/ctr.ts:757](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22358
22356
|
|
|
22359
22357
|
> `protected` **\_end**(): `void`
|
|
22360
22358
|
|
|
22361
|
-
Defined in: [sys/ctr.ts:
|
|
22359
|
+
Defined in: [sys/ctr.ts:1086](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1086)
|
|
22362
22360
|
|
|
22363
22361
|
主动关闭当前 socket 连接
|
|
22364
22362
|
|
|
@@ -22372,7 +22370,7 @@ Defined in: [sys/ctr.ts:1083](https://github.com/maiyunnet/kebab/blob/master/sys
|
|
|
22372
22370
|
|
|
22373
22371
|
> `protected` **\_getBasicAuth**(`user`, `pwd`): `string`
|
|
22374
22372
|
|
|
22375
|
-
Defined in: [sys/ctr.ts:
|
|
22373
|
+
Defined in: [sys/ctr.ts:784](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L784)
|
|
22376
22374
|
|
|
22377
22375
|
获取 Auth 字符串,用于客户端提交
|
|
22378
22376
|
|
|
@@ -22400,7 +22398,7 @@ Defined in: [sys/ctr.ts:781](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22400
22398
|
|
|
22401
22399
|
> `protected` **\_getLocale**(): `string`
|
|
22402
22400
|
|
|
22403
|
-
Defined in: [sys/ctr.ts:
|
|
22401
|
+
Defined in: [sys/ctr.ts:969](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L969)
|
|
22404
22402
|
|
|
22405
22403
|
获取当前语言名
|
|
22406
22404
|
|
|
@@ -22414,7 +22412,7 @@ Defined in: [sys/ctr.ts:966](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22414
22412
|
|
|
22415
22413
|
> `protected` **\_getLocaleJsonString**(): `string`
|
|
22416
22414
|
|
|
22417
|
-
Defined in: [sys/ctr.ts:
|
|
22415
|
+
Defined in: [sys/ctr.ts:957](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L957)
|
|
22418
22416
|
|
|
22419
22417
|
根据当前后台语言包设置情况获取 JSON 字符串传输到前台
|
|
22420
22418
|
|
|
@@ -22466,7 +22464,7 @@ Defined in: [sys/ctr.ts:315](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22466
22464
|
|
|
22467
22465
|
> `protected` **\_handleFormData**(`events?`, `limits?`): `Promise`\<`boolean`\>
|
|
22468
22466
|
|
|
22469
|
-
Defined in: [sys/ctr.ts:
|
|
22467
|
+
Defined in: [sys/ctr.ts:1095](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1095)
|
|
22470
22468
|
|
|
22471
22469
|
获取 formdata 的信息
|
|
22472
22470
|
|
|
@@ -22514,7 +22512,7 @@ Defined in: [sys/ctr.ts:1092](https://github.com/maiyunnet/kebab/blob/master/sys
|
|
|
22514
22512
|
|
|
22515
22513
|
> **\_l**(`key`, `data?`): `string`
|
|
22516
22514
|
|
|
22517
|
-
Defined in: [sys/ctr.ts:
|
|
22515
|
+
Defined in: [sys/ctr.ts:1021](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1021)
|
|
22518
22516
|
|
|
22519
22517
|
获取语言包值
|
|
22520
22518
|
|
|
@@ -22540,7 +22538,7 @@ Defined in: [sys/ctr.ts:1018](https://github.com/maiyunnet/kebab/blob/master/sys
|
|
|
22540
22538
|
|
|
22541
22539
|
> `protected` **\_loadData**(`path`): `Promise`\<`Record`\<`string`, `string`\> \| `null`\>
|
|
22542
22540
|
|
|
22543
|
-
Defined in: [sys/ctr.ts:
|
|
22541
|
+
Defined in: [sys/ctr.ts:860](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L860)
|
|
22544
22542
|
|
|
22545
22543
|
获取 data 数据
|
|
22546
22544
|
|
|
@@ -22562,7 +22560,7 @@ Defined in: [sys/ctr.ts:857](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22562
22560
|
|
|
22563
22561
|
> `protected` **\_loadLocale**(`loc`, `pkg?`): `Promise`\<`boolean`\>
|
|
22564
22562
|
|
|
22565
|
-
Defined in: [sys/ctr.ts:
|
|
22563
|
+
Defined in: [sys/ctr.ts:908](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L908)
|
|
22566
22564
|
|
|
22567
22565
|
设定语言并加载语言包
|
|
22568
22566
|
|
|
@@ -22683,7 +22681,7 @@ Defined in: [sys/ctr.ts:332](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22683
22681
|
|
|
22684
22682
|
> `protected` **\_location**(`location`): `false`
|
|
22685
22683
|
|
|
22686
|
-
Defined in: [sys/ctr.ts:
|
|
22684
|
+
Defined in: [sys/ctr.ts:878](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L878)
|
|
22687
22685
|
|
|
22688
22686
|
跳转(302临时跳转),支持相对本项目根路径的路径或绝对路径
|
|
22689
22687
|
|
|
@@ -22705,7 +22703,7 @@ Defined in: [sys/ctr.ts:875](https://github.com/maiyunnet/kebab/blob/master/sys/
|
|
|
22705
22703
|
|
|
22706
22704
|
> `protected` **\_ping**(`data?`): `boolean`
|
|
22707
22705
|
|
|
22708
|
-
Defined in: [sys/ctr.ts:
|
|
22706
|
+
Defined in: [sys/ctr.ts:1071](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1071)
|
|
22709
22707
|
|
|
22710
22708
|
发送 socket ping
|
|
22711
22709
|
|
|
@@ -22727,7 +22725,7 @@ Defined in: [sys/ctr.ts:1068](https://github.com/maiyunnet/kebab/blob/master/sys
|
|
|
22727
22725
|
|
|
22728
22726
|
> `protected` **\_pong**(`data?`): `boolean`
|
|
22729
22727
|
|
|
22730
|
-
Defined in: [sys/ctr.ts:
|
|
22728
|
+
Defined in: [sys/ctr.ts:1079](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1079)
|
|
22731
22729
|
|
|
22732
22730
|
发送 socket pong
|
|
22733
22731
|
|
|
@@ -22749,7 +22747,7 @@ Defined in: [sys/ctr.ts:1076](https://github.com/maiyunnet/kebab/blob/master/sys
|
|
|
22749
22747
|
|
|
22750
22748
|
> `protected` **\_startSession**(`link`, `auth?`, `opt?`): `Promise`\<`boolean`\>
|
|
22751
22749
|
|
|
22752
|
-
Defined in: [sys/ctr.ts:
|
|
22750
|
+
Defined in: [sys/ctr.ts:892](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L892)
|
|
22753
22751
|
|
|
22754
22752
|
开启 Session
|
|
22755
22753
|
|
|
@@ -22783,7 +22781,7 @@ Kv 或 Db 实例
|
|
|
22783
22781
|
|
|
22784
22782
|
> `protected` **\_writeBinary**(`data`): `boolean`
|
|
22785
22783
|
|
|
22786
|
-
Defined in: [sys/ctr.ts:
|
|
22784
|
+
Defined in: [sys/ctr.ts:1063](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1063)
|
|
22787
22785
|
|
|
22788
22786
|
发送 socket 二进制
|
|
22789
22787
|
|
|
@@ -22805,7 +22803,7 @@ Defined in: [sys/ctr.ts:1060](https://github.com/maiyunnet/kebab/blob/master/sys
|
|
|
22805
22803
|
|
|
22806
22804
|
> `protected` **\_writeResult**(`data`): `boolean`
|
|
22807
22805
|
|
|
22808
|
-
Defined in: [sys/ctr.ts:
|
|
22806
|
+
Defined in: [sys/ctr.ts:1055](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1055)
|
|
22809
22807
|
|
|
22810
22808
|
发送结果对象文本
|
|
22811
22809
|
|
|
@@ -22827,7 +22825,7 @@ Defined in: [sys/ctr.ts:1052](https://github.com/maiyunnet/kebab/blob/master/sys
|
|
|
22827
22825
|
|
|
22828
22826
|
> `protected` **\_writeText**(`data`): `boolean`
|
|
22829
22827
|
|
|
22830
|
-
Defined in: [sys/ctr.ts:
|
|
22828
|
+
Defined in: [sys/ctr.ts:1047](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L1047)
|
|
22831
22829
|
|
|
22832
22830
|
发送 socket 文本
|
|
22833
22831
|
|
|
@@ -22849,7 +22847,7 @@ Defined in: [sys/ctr.ts:1044](https://github.com/maiyunnet/kebab/blob/master/sys
|
|
|
22849
22847
|
|
|
22850
22848
|
> **getAuthorization**(): `false` \| \{ `pwd`: `string`; `type`: `"basic"`; `user`: `string`; \} \| \{ `token`: `string`; `type`: `"bearer"`; \}
|
|
22851
22849
|
|
|
22852
|
-
Defined in: [sys/ctr.ts:
|
|
22850
|
+
Defined in: [sys/ctr.ts:812](https://github.com/maiyunnet/kebab/blob/master/sys/ctr.ts#L812)
|
|
22853
22851
|
|
|
22854
22852
|
通过 header 或 _auth 获取鉴权信息,支持 Basic Auth 和 Bearer Token
|
|
22855
22853
|
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '9.3.
|
|
9
|
+
export const VER = '9.3.4';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/undici/response.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare class Response {
|
|
|
21
21
|
getContent(): Promise<Buffer | null>;
|
|
22
22
|
/** --- 读取所有内容为文本 --- */
|
|
23
23
|
getText(): Promise<string | null>;
|
|
24
|
-
/** --- 读取所有内容为 JSON --- */
|
|
24
|
+
/** --- 读取所有内容为 JSON,失败返回 null --- */
|
|
25
25
|
getJson(): Promise<any>;
|
|
26
26
|
/**
|
|
27
27
|
* --- 用户自定义的 content 内容 ---
|
|
@@ -31,7 +31,7 @@ export declare class Response {
|
|
|
31
31
|
/**
|
|
32
32
|
* --- 获取响应读取流对象 ---
|
|
33
33
|
*/
|
|
34
|
-
getStream():
|
|
34
|
+
getStream(): (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | zlib.Gunzip | zlib.Inflate | zlib.BrotliDecompress | null;
|
|
35
35
|
/**
|
|
36
36
|
* --- 获取原生响应读取流对象 ---
|
|
37
37
|
*/
|
package/lib/undici/response.js
CHANGED
package/lib/undici.d.ts
CHANGED
|
@@ -36,11 +36,10 @@ export declare function post(u: string, data: Record<string, kebab.Json> | Buffe
|
|
|
36
36
|
*/
|
|
37
37
|
export declare function postJson(u: string, data: kebab.Json[] | Record<string, kebab.Json>, opt?: IRequestOptions): Promise<lResponse.Response>;
|
|
38
38
|
/**
|
|
39
|
-
* --- 发起 JSON 请求并解析 JSON
|
|
39
|
+
* --- 发起 JSON 请求并解析 JSON 响应,失败时返回 null ---
|
|
40
40
|
* @param u 网址
|
|
41
41
|
* @param data 数据
|
|
42
42
|
* @param opt 选项
|
|
43
|
-
* @returns JSON 数据,失败时返回 null
|
|
44
43
|
*/
|
|
45
44
|
export declare function postJsonResponseJson(u: string, data: kebab.Json[] | Record<string, kebab.Json>, opt?: IRequestOptions): Promise<kebab.Json | null>;
|
|
46
45
|
/**
|
package/lib/undici.js
CHANGED
|
@@ -95,11 +95,10 @@ export async function postJson(u, data, opt = {}) {
|
|
|
95
95
|
return request(u, data, opt);
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
* --- 发起 JSON 请求并解析 JSON
|
|
98
|
+
* --- 发起 JSON 请求并解析 JSON 响应,失败时返回 null ---
|
|
99
99
|
* @param u 网址
|
|
100
100
|
* @param data 数据
|
|
101
101
|
* @param opt 选项
|
|
102
|
-
* @returns JSON 数据,失败时返回 null
|
|
103
102
|
*/
|
|
104
103
|
export async function postJsonResponseJson(u, data, opt = {}) {
|
|
105
104
|
opt.method = 'POST';
|
package/package.json
CHANGED
package/sys/ctr.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare class Ctr {
|
|
|
32
32
|
protected _session: Record<string, any>;
|
|
33
33
|
/** --- Session --- 对象 */
|
|
34
34
|
protected _sess: lSession.Session | null;
|
|
35
|
-
/** ---
|
|
35
|
+
/** --- 页面浏览器客户端缓存(单位:秒) --- */
|
|
36
36
|
protected _cacheTTL: number;
|
|
37
37
|
/** --- XSRF TOKEN 值 --- */
|
|
38
38
|
protected _xsrf: string;
|
package/sys/ctr.js
CHANGED
|
@@ -47,7 +47,7 @@ export class Ctr {
|
|
|
47
47
|
_session = {};
|
|
48
48
|
/** --- Session --- 对象 */
|
|
49
49
|
_sess = null;
|
|
50
|
-
/** ---
|
|
50
|
+
/** --- 页面浏览器客户端缓存(单位:秒) --- */
|
|
51
51
|
_cacheTTL;
|
|
52
52
|
/** --- XSRF TOKEN 值 --- */
|
|
53
53
|
_xsrf = '';
|
|
@@ -253,6 +253,8 @@ export class Ctr {
|
|
|
253
253
|
// --- 组件 JS 从 stc 目录读取,浏览器同样通过 staticPath(支持 CDN)下载 ---
|
|
254
254
|
const componentPath = this._config.const.rootPath + 'stc/' + path + '.page.js';
|
|
255
255
|
if (!await lFs.isFile(componentPath)) {
|
|
256
|
+
lCore.debug(`[CTR][_loadReactPage] componentPath ${componentPath} is not a file`);
|
|
257
|
+
lCore.log(this, `[CTR][_loadReactPage] componentPath ${componentPath} is not a file`, '-error');
|
|
256
258
|
return '';
|
|
257
259
|
}
|
|
258
260
|
try {
|
|
@@ -365,6 +367,7 @@ export class Ctr {
|
|
|
365
367
|
}
|
|
366
368
|
catch (e) {
|
|
367
369
|
lCore.debug(`[CTR][_loadReactPage] ${e.message ?? ''}`);
|
|
370
|
+
lCore.log(this, '[CTR][_loadReactPage] ' + lText.stringifyJson(e.stack).slice(1, -1), '-error');
|
|
368
371
|
return '';
|
|
369
372
|
}
|
|
370
373
|
}
|
package/sys/master.js
CHANGED
|
@@ -238,14 +238,39 @@ function createRpcListener() {
|
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
240
|
const ls = await zip.getList();
|
|
241
|
+
// --- 预扫描:收集 .cga 锁定目录和 kebab 子项目目录 ---
|
|
242
|
+
/** --- .cga 锁定的目录集合,key 格式为"父路径/目录名/"(不含开头/,含尾部/),例如 "www/pika/" --- */
|
|
243
|
+
const cgaLockedDirs = new Set();
|
|
244
|
+
/** --- 含有 kebab.json 的目录路径集合(不含开头/,含尾部/,根目录为空字符串) --- */
|
|
245
|
+
const kebabProjectDirs = new Set();
|
|
246
|
+
for (const scanPath in ls) {
|
|
247
|
+
/** --- 带 / 开头的 zip 中文件完整路径,例如 "/www/pika/stc/index.ts" --- */
|
|
248
|
+
const scanFpath = scanPath.startsWith('/') ? scanPath : '/' + scanPath;
|
|
249
|
+
/** --- 纯路径中最后一个 / 的位置索引 --- */
|
|
250
|
+
const scanLio = scanFpath.lastIndexOf('/');
|
|
251
|
+
/** --- 纯路径,不以 / 开头,以 / 结尾,若是根路径就是空字符串,例如 "www/pika/" --- */
|
|
252
|
+
const scanPat = scanFpath.slice(1, scanLio + 1);
|
|
253
|
+
/** --- 纯文件名,例如 "index.ts" 或 "pika.cga" --- */
|
|
254
|
+
const scanFname = scanFpath.slice(scanLio + 1);
|
|
255
|
+
if (scanFname.endsWith('.cga')) {
|
|
256
|
+
// --- 记录 .cga 锁定的同级目录(去掉 .cga 后缀的名字即为被锁定的目录名)---
|
|
257
|
+
cgaLockedDirs.add(scanPat + scanFname.slice(0, -4) + '/');
|
|
258
|
+
}
|
|
259
|
+
if (scanFname === 'kebab.json') {
|
|
260
|
+
// --- 记录含有 kebab.json 的目录(即 kebab 子项目根目录)---
|
|
261
|
+
kebabProjectDirs.add(scanPat);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/** --- kebab 子项目中仅允许部署的子文件夹名集合 --- */
|
|
265
|
+
const KEBAB_ALLOWED_DIRS = new Set(['ctr', 'data', 'stc', 'view', 'lib']);
|
|
241
266
|
for (const path in ls) {
|
|
242
|
-
/** --- 带 / 开头的 zip
|
|
267
|
+
/** --- 带 / 开头的 zip 中文件完整路径,例如 "/www/pika/ctr/api.js" --- */
|
|
243
268
|
const fpath = path.startsWith('/') ? path : '/' + path;
|
|
244
|
-
/** ---
|
|
269
|
+
/** --- 纯路径中最后一个 / 的位置索引 --- */
|
|
245
270
|
const lio = fpath.lastIndexOf('/');
|
|
246
|
-
/** --- 纯路径,不以 / 开头,以 /
|
|
271
|
+
/** --- 纯路径,不以 / 开头,以 / 结尾,若是根路径就是空字符串,例如 "www/pika/ctr/" --- */
|
|
247
272
|
const pat = fpath.slice(1, lio + 1);
|
|
248
|
-
/** ---
|
|
273
|
+
/** --- 纯文件名,例如 "api.js" --- */
|
|
249
274
|
const fname = fpath.slice(lio + 1);
|
|
250
275
|
if ((pat === 'conf/' && fname === 'config.json') || fname === 'kebab.json') {
|
|
251
276
|
// --- 特殊文件不能覆盖 ---
|
|
@@ -255,6 +280,49 @@ function createRpcListener() {
|
|
|
255
280
|
// --- 测试或开发文件不覆盖 ---
|
|
256
281
|
continue;
|
|
257
282
|
}
|
|
283
|
+
// --- 规则 1:若同级目录存在 xxx.cga,则 xxx 目录下所有内容不部署 ---
|
|
284
|
+
if (pat) {
|
|
285
|
+
/** --- 是否被 .cga 文件锁定阻止 --- */
|
|
286
|
+
let cgaBlocked = false;
|
|
287
|
+
/** --- 累积路径,逐级拼接,用于逐级检查是否命中 cgaLockedDirs,例如 "a/" -> "a/b/" -> "a/b/c/" --- */
|
|
288
|
+
let accumulated = '';
|
|
289
|
+
for (const seg of pat.split('/').filter(Boolean)) {
|
|
290
|
+
accumulated += seg + '/';
|
|
291
|
+
if (cgaLockedDirs.has(accumulated)) {
|
|
292
|
+
cgaBlocked = true;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (cgaBlocked) {
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
// --- 规则 2:kebab 子项目目录中,仅允许部署 ctr/data/stc/view/lib 子文件夹内的内容 ---
|
|
301
|
+
// --- 快速跳过:zip 中没有 kebab.json 时整个规则无需执行 ---
|
|
302
|
+
if (kebabProjectDirs.size > 0) {
|
|
303
|
+
// --- 找最长(最精确)匹配的 kebab 项目目录,避免父子项目互相干扰 ---
|
|
304
|
+
/** --- 当前文件所属的 kebab 子项目目录,例如 pat 为 "www/pika/ctr/" 时值为 "www/pika/";无匹配则为 null --- */
|
|
305
|
+
let longestMatch = null;
|
|
306
|
+
for (const kdir of kebabProjectDirs) {
|
|
307
|
+
/** --- 当前 kdir 是否比已有的 longestMatch 更精确(路径更深)--- */
|
|
308
|
+
const isDeeper = longestMatch === null || kdir.length > longestMatch.length;
|
|
309
|
+
if (pat.startsWith(kdir) && isDeeper) {
|
|
310
|
+
longestMatch = kdir;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (longestMatch !== null) {
|
|
314
|
+
// --- 取相对于 kebab 项目目录的路径,检查第一级子目录 ---
|
|
315
|
+
/** --- 相对路径,例如若 pat 为 "www/pika/ctr/" 且 longestMatch 为 "www/pika/",则 relPath 为 "ctr/" --- */
|
|
316
|
+
const relPath = pat.slice(longestMatch.length);
|
|
317
|
+
if (relPath) {
|
|
318
|
+
/** --- 路径的第一级子目录名,例如 "ctr" 或 "data",用于判断是否在允许列表中 --- */
|
|
319
|
+
const firstSeg = relPath.split('/')[0];
|
|
320
|
+
if (!KEBAB_ALLOWED_DIRS.has(firstSeg)) {
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
258
326
|
// --- 看文件夹是否存在 ---
|
|
259
327
|
if (pat && !await lFs.isDir(to + pat)) {
|
|
260
328
|
if (rtn.post['strict'] === '1') {
|