@maiyunnet/kebab 9.3.11 → 9.3.12
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 +13 -13
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/session.js +15 -3
- package/package.json +1 -1
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.12"` = `'9.3.12'`
|
|
1364
1364
|
|
|
1365
1365
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1366
1366
|
|
|
@@ -13247,7 +13247,7 @@ lib/session/classes/Session.md
|
|
|
13247
13247
|
|
|
13248
13248
|
# Class: Session
|
|
13249
13249
|
|
|
13250
|
-
Defined in: [lib/session.ts:
|
|
13250
|
+
Defined in: [lib/session.ts:51](https://github.com/maiyunnet/kebab/blob/master/lib/session.ts#L51)
|
|
13251
13251
|
|
|
13252
13252
|
## Constructors
|
|
13253
13253
|
|
|
@@ -13265,7 +13265,7 @@ Defined in: [lib/session.ts:39](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
13265
13265
|
|
|
13266
13266
|
> **getName**(): `string`
|
|
13267
13267
|
|
|
13268
|
-
Defined in: [lib/session.ts:
|
|
13268
|
+
Defined in: [lib/session.ts:224](https://github.com/maiyunnet/kebab/blob/master/lib/session.ts#L224)
|
|
13269
13269
|
|
|
13270
13270
|
获取当前的 cookie 的 name 值
|
|
13271
13271
|
|
|
@@ -13279,7 +13279,7 @@ Defined in: [lib/session.ts:212](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
13279
13279
|
|
|
13280
13280
|
> **getToken**(): `string`
|
|
13281
13281
|
|
|
13282
|
-
Defined in: [lib/session.ts:
|
|
13282
|
+
Defined in: [lib/session.ts:217](https://github.com/maiyunnet/kebab/blob/master/lib/session.ts#L217)
|
|
13283
13283
|
|
|
13284
13284
|
获取当前的 token 值
|
|
13285
13285
|
|
|
@@ -13293,7 +13293,7 @@ Defined in: [lib/session.ts:205](https://github.com/maiyunnet/kebab/blob/master/
|
|
|
13293
13293
|
|
|
13294
13294
|
> **init**(`ctr`, `link`, `auth?`, `opt?`): `Promise`\<`boolean`\>
|
|
13295
13295
|
|
|
13296
|
-
Defined in: [lib/session.ts:
|
|
13296
|
+
Defined in: [lib/session.ts:79](https://github.com/maiyunnet/kebab/blob/master/lib/session.ts#L79)
|
|
13297
13297
|
|
|
13298
13298
|
初始化函数,相当于 construct
|
|
13299
13299
|
|
|
@@ -13335,7 +13335,7 @@ false 表示系统错误
|
|
|
13335
13335
|
|
|
13336
13336
|
> **update**(): `Promise`\<`void`\>
|
|
13337
13337
|
|
|
13338
|
-
Defined in: [lib/session.ts:
|
|
13338
|
+
Defined in: [lib/session.ts:231](https://github.com/maiyunnet/kebab/blob/master/lib/session.ts#L231)
|
|
13339
13339
|
|
|
13340
13340
|
页面整体结束时,要写入到 Kv 或 数据库
|
|
13341
13341
|
|
|
@@ -13373,7 +13373,7 @@ lib/session/interfaces/IOptions.md
|
|
|
13373
13373
|
|
|
13374
13374
|
# Interface: IOptions
|
|
13375
13375
|
|
|
13376
|
-
Defined in: [lib/session.ts:
|
|
13376
|
+
Defined in: [lib/session.ts:42](https://github.com/maiyunnet/kebab/blob/master/lib/session.ts#L42)
|
|
13377
13377
|
|
|
13378
13378
|
## Properties
|
|
13379
13379
|
|
|
@@ -13381,7 +13381,7 @@ Defined in: [lib/session.ts:30](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
13381
13381
|
|
|
13382
13382
|
> `optional` **domain?**: `string`
|
|
13383
13383
|
|
|
13384
|
-
Defined in: [lib/session.ts:
|
|
13384
|
+
Defined in: [lib/session.ts:46](https://github.com/maiyunnet/kebab/blob/master/lib/session.ts#L46)
|
|
13385
13385
|
|
|
13386
13386
|
***
|
|
13387
13387
|
|
|
@@ -13389,7 +13389,7 @@ Defined in: [lib/session.ts:34](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
13389
13389
|
|
|
13390
13390
|
> `optional` **name?**: `string`
|
|
13391
13391
|
|
|
13392
|
-
Defined in: [lib/session.ts:
|
|
13392
|
+
Defined in: [lib/session.ts:43](https://github.com/maiyunnet/kebab/blob/master/lib/session.ts#L43)
|
|
13393
13393
|
|
|
13394
13394
|
***
|
|
13395
13395
|
|
|
@@ -13397,7 +13397,7 @@ Defined in: [lib/session.ts:31](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
13397
13397
|
|
|
13398
13398
|
> `optional` **sqlPre?**: `string`
|
|
13399
13399
|
|
|
13400
|
-
Defined in: [lib/session.ts:
|
|
13400
|
+
Defined in: [lib/session.ts:47](https://github.com/maiyunnet/kebab/blob/master/lib/session.ts#L47)
|
|
13401
13401
|
|
|
13402
13402
|
***
|
|
13403
13403
|
|
|
@@ -13405,7 +13405,7 @@ Defined in: [lib/session.ts:35](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
13405
13405
|
|
|
13406
13406
|
> `optional` **ssl?**: `boolean`
|
|
13407
13407
|
|
|
13408
|
-
Defined in: [lib/session.ts:
|
|
13408
|
+
Defined in: [lib/session.ts:45](https://github.com/maiyunnet/kebab/blob/master/lib/session.ts#L45)
|
|
13409
13409
|
|
|
13410
13410
|
***
|
|
13411
13411
|
|
|
@@ -13413,7 +13413,7 @@ Defined in: [lib/session.ts:33](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
13413
13413
|
|
|
13414
13414
|
> `optional` **token?**: `string`
|
|
13415
13415
|
|
|
13416
|
-
Defined in: [lib/session.ts:
|
|
13416
|
+
Defined in: [lib/session.ts:48](https://github.com/maiyunnet/kebab/blob/master/lib/session.ts#L48)
|
|
13417
13417
|
|
|
13418
13418
|
***
|
|
13419
13419
|
|
|
@@ -13421,7 +13421,7 @@ Defined in: [lib/session.ts:36](https://github.com/maiyunnet/kebab/blob/master/l
|
|
|
13421
13421
|
|
|
13422
13422
|
> `optional` **ttl?**: `number`
|
|
13423
13423
|
|
|
13424
|
-
Defined in: [lib/session.ts:
|
|
13424
|
+
Defined in: [lib/session.ts:44](https://github.com/maiyunnet/kebab/blob/master/lib/session.ts#L44)
|
|
13425
13425
|
|
|
13426
13426
|
lib/socket/functions/rwebsocket.md
|
|
13427
13427
|
---
|
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.12';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/session.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* --- Mysql ---
|
|
8
8
|
CREATE TABLE `session` (
|
|
9
9
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
|
10
|
-
`token` char(
|
|
10
|
+
`token` char(32) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
|
|
11
11
|
`data` text NOT NULL,
|
|
12
12
|
`time_update` bigint NOT NULL,
|
|
13
13
|
`time_add` bigint NOT NULL,
|
|
@@ -15,6 +15,18 @@ CREATE TABLE `session` (
|
|
|
15
15
|
UNIQUE KEY `token` (`token`),
|
|
16
16
|
KEY `time_update` (`time_update`)
|
|
17
17
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
|
|
18
|
+
|
|
19
|
+
--- Pgsql ---
|
|
20
|
+
CREATE TABLE "session" (
|
|
21
|
+
"id" BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY,
|
|
22
|
+
"token" char(32) NOT NULL,
|
|
23
|
+
"data" text NOT NULL,
|
|
24
|
+
"time_update" bigint NOT NULL,
|
|
25
|
+
"time_add" bigint NOT NULL,
|
|
26
|
+
PRIMARY KEY ("id")
|
|
27
|
+
);
|
|
28
|
+
CREATE UNIQUE INDEX "session_token" ON "session" ("token");
|
|
29
|
+
CREATE INDEX "session_time_update" ON "session" ("time_update");
|
|
18
30
|
*/
|
|
19
31
|
// --- 库和定义 ---
|
|
20
32
|
import * as lCore from '#kebab/lib/core.js';
|
|
@@ -131,7 +143,7 @@ export class Session {
|
|
|
131
143
|
if (count === 5) {
|
|
132
144
|
return false;
|
|
133
145
|
}
|
|
134
|
-
this._token = lCore.random(
|
|
146
|
+
this._token = lCore.random(32, lCore.RANDOM_LUN);
|
|
135
147
|
++count;
|
|
136
148
|
} while (!await this._link.set(this._name + '_' + this._token, {}, this._ttl, 'nx'));
|
|
137
149
|
}
|
|
@@ -141,7 +153,7 @@ export class Session {
|
|
|
141
153
|
if (count === 5) {
|
|
142
154
|
return false;
|
|
143
155
|
}
|
|
144
|
-
this._token = lCore.random(
|
|
156
|
+
this._token = lCore.random(32, lCore.RANDOM_LUN);
|
|
145
157
|
this._sql.insert('session').values({
|
|
146
158
|
'token': this._token,
|
|
147
159
|
'data': '{}',
|