@maiyunnet/kebab 3.2.23 → 3.2.24
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 +1 -1
- package/index.js +1 -1
- package/lib/kv.d.ts +1 -0
- package/lib/kv.js +1 -0
- package/package.json +1 -1
- package/sys/child.js +4 -2
- package/sys/mod.d.ts +4 -0
- package/sys/mod.js +8 -1
- package/sys/route.d.ts +1 -1
- package/sys/route.js +2 -3
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '3.2.
|
|
9
|
+
export const VER = '3.2.24';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/kv.d.ts
CHANGED
package/lib/kv.js
CHANGED
package/package.json
CHANGED
package/sys/child.js
CHANGED
|
@@ -90,7 +90,7 @@ async function run() {
|
|
|
90
90
|
const host = (req.headers[':authority'] ?? req.headers['host'] ?? '');
|
|
91
91
|
if (!host) {
|
|
92
92
|
lCore.writeHead(res, 403);
|
|
93
|
-
res.end();
|
|
93
|
+
res.end('403 Forbidden');
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
const key = host + req.url;
|
|
@@ -141,6 +141,7 @@ async function run() {
|
|
|
141
141
|
httpServer = http.createServer(function (req, res) {
|
|
142
142
|
const host = (req.headers['host'] ?? '');
|
|
143
143
|
if (!host) {
|
|
144
|
+
res.setHeader('x-kebab-error', '0');
|
|
144
145
|
lCore.writeHead(res, 403);
|
|
145
146
|
res.end();
|
|
146
147
|
return;
|
|
@@ -233,6 +234,7 @@ async function requestHandler(req, res, https) {
|
|
|
233
234
|
/** --- 当前的 vhost 配置文件 --- */
|
|
234
235
|
const vhost = await getVhostByHostname(uri.hostname ?? '');
|
|
235
236
|
if (!vhost) {
|
|
237
|
+
res.setHeader('x-kebab-error', '1');
|
|
236
238
|
lCore.writeHead(res, 403);
|
|
237
239
|
res.end();
|
|
238
240
|
return;
|
|
@@ -553,7 +555,7 @@ process.on('message', function (msg) {
|
|
|
553
555
|
for (const key in linkCount) {
|
|
554
556
|
str.push(key + ':' + linkCount[key].toString());
|
|
555
557
|
}
|
|
556
|
-
lCore.
|
|
558
|
+
lCore.debug(`[CHILD] Worker ${process.pid} busy: ${str.join(',')}.`);
|
|
557
559
|
lCore.log({}, `[CHILD] Worker ${process.pid} busy: ${str.join(',')}.`, '-warning');
|
|
558
560
|
await lCore.sleep(30_000);
|
|
559
561
|
waiting += 30_000;
|
package/sys/mod.d.ts
CHANGED
package/sys/mod.js
CHANGED
|
@@ -1184,7 +1184,7 @@ class Mod {
|
|
|
1184
1184
|
* --- 根据当前条件,筛选出当前条目该有的数据条数 ---
|
|
1185
1185
|
*/
|
|
1186
1186
|
async count() {
|
|
1187
|
-
const sql = this._sql.getSql().replace(/SELECT .+? FROM/, 'SELECT COUNT(
|
|
1187
|
+
const sql = this._sql.getSql().replace(/SELECT .+? FROM/, 'SELECT COUNT(0) AS `count` FROM');
|
|
1188
1188
|
const r = await this._db.query(sql, this._sql.getData());
|
|
1189
1189
|
if (r.rows === null) {
|
|
1190
1190
|
lCore.log(this._ctr ?? {}, '[count, mod] ' + lText.stringifyJson(r.error?.message ?? '').slice(1, -1).replace(/"/g, '""'), '-error');
|
|
@@ -1196,6 +1196,13 @@ class Mod {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
return count;
|
|
1198
1198
|
}
|
|
1199
|
+
/**
|
|
1200
|
+
* --- 获取当前条件下的 count 的 SQL 语句 ---
|
|
1201
|
+
*/
|
|
1202
|
+
countSql() {
|
|
1203
|
+
const sql = this._sql.getSql().replace(/SELECT .+? FROM/, 'SELECT COUNT(0) AS `count` FROM');
|
|
1204
|
+
return this._sql.format(sql, this._sql.getData());
|
|
1205
|
+
}
|
|
1199
1206
|
/**
|
|
1200
1207
|
* @param f 表名
|
|
1201
1208
|
* @param s ON 信息
|
package/sys/route.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project: Kebab, User: JianSuoQiYue
|
|
3
3
|
* Date: 2019-4-15 13:40
|
|
4
|
-
* Last: 2020-4-14 13:52:00, 2022-09-07 01:43:31, 2023-12-29 17:24:03, 2024-2-7 00:28:50, 2024-6-6 15:15:54, 2025-6-13 19:23:53, 2025-9-22 15:48:53, 2025-9-23 11:26:50
|
|
4
|
+
* Last: 2020-4-14 13:52:00, 2022-09-07 01:43:31, 2023-12-29 17:24:03, 2024-2-7 00:28:50, 2024-6-6 15:15:54, 2025-6-13 19:23:53, 2025-9-22 15:48:53, 2025-9-23 11:26:50, 2025-10-30 17:44:41
|
|
5
5
|
*/
|
|
6
6
|
import * as http from 'http';
|
|
7
7
|
import * as http2 from 'http2';
|
package/sys/route.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Project: Kebab, User: JianSuoQiYue
|
|
3
3
|
* Date: 2019-4-15 13:40
|
|
4
|
-
* Last: 2020-4-14 13:52:00, 2022-09-07 01:43:31, 2023-12-29 17:24:03, 2024-2-7 00:28:50, 2024-6-6 15:15:54, 2025-6-13 19:23:53, 2025-9-22 15:48:53, 2025-9-23 11:26:50
|
|
4
|
+
* Last: 2020-4-14 13:52:00, 2022-09-07 01:43:31, 2023-12-29 17:24:03, 2024-2-7 00:28:50, 2024-6-6 15:15:54, 2025-6-13 19:23:53, 2025-9-22 15:48:53, 2025-9-23 11:26:50, 2025-10-30 17:44:41
|
|
5
5
|
*/
|
|
6
6
|
import * as http from 'http';
|
|
7
7
|
import * as stream from 'stream';
|
|
@@ -12,7 +12,6 @@ import * as lFs from '#kebab/lib/fs.js';
|
|
|
12
12
|
import * as lZlib from '#kebab/lib/zlib.js';
|
|
13
13
|
import * as lCore from '#kebab/lib/core.js';
|
|
14
14
|
import * as lText from '#kebab/lib/text.js';
|
|
15
|
-
import * as lTime from '#kebab/lib/time.js';
|
|
16
15
|
import * as lResponse from '#kebab/lib/net/response.js';
|
|
17
16
|
import * as lWs from '#kebab/lib/ws.js';
|
|
18
17
|
import * as lLang from '#kebab/lib/lang.js';
|
|
@@ -567,7 +566,7 @@ export async function run(data) {
|
|
|
567
566
|
}
|
|
568
567
|
// --- 设置缓存 ---
|
|
569
568
|
if (!data.res.headersSent && (cacheTTL > 0)) {
|
|
570
|
-
data.res.setHeader('expires',
|
|
569
|
+
data.res.setHeader('expires', new Date(Date.now() + cacheTTL * 1_000).toUTCString());
|
|
571
570
|
data.res.setHeader('cache-control', 'max-age=' + cacheTTL.toString());
|
|
572
571
|
}
|
|
573
572
|
// --- 设置自定义 hcode ---
|