@maiyunnet/kebab 3.1.10 → 3.1.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/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/sys/child.js +4 -4
- package/sys/route.js +1 -1
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* ------------------------
|
|
10
10
|
*/
|
|
11
11
|
/** --- 当前系统版本号 --- */
|
|
12
|
-
export const VER = '3.1.
|
|
12
|
+
export const VER = '3.1.12';
|
|
13
13
|
// --- 服务端用的路径 ---
|
|
14
14
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
15
15
|
/** --- /xxx/xxx --- */
|
package/package.json
CHANGED
package/sys/child.js
CHANGED
|
@@ -573,7 +573,7 @@ process.on('message', function (msg) {
|
|
|
573
573
|
});
|
|
574
574
|
/**
|
|
575
575
|
* --- 获取匹配的 vhost 对象 ---
|
|
576
|
-
* ---
|
|
576
|
+
* --- 如果有精准匹配,以精准匹配为准,否则为通配符匹配(vSub),最后全局泛匹配(vGlobal) ---
|
|
577
577
|
* @param hostname 当前的 hostname,不带端口
|
|
578
578
|
*/
|
|
579
579
|
function getVhostByHostname(hostname) {
|
|
@@ -585,9 +585,9 @@ function getVhostByHostname(hostname) {
|
|
|
585
585
|
vGlobal = vhost;
|
|
586
586
|
}
|
|
587
587
|
else if (domain.includes('*')) {
|
|
588
|
-
// ---
|
|
589
|
-
domain = domain.replace(/\*/, '
|
|
590
|
-
if (new RegExp(domain
|
|
588
|
+
// --- 通配符匹配 ---
|
|
589
|
+
domain = domain.replace(/\*/, '.+?').replace(/\./, '\\.');
|
|
590
|
+
if (new RegExp(`^${domain}$`).test(hostname)) {
|
|
591
591
|
vSub = vhost;
|
|
592
592
|
}
|
|
593
593
|
}
|
package/sys/route.js
CHANGED
|
@@ -223,7 +223,7 @@ export async function run(data) {
|
|
|
223
223
|
let rtn;
|
|
224
224
|
if (data.socket && data.req instanceof http.IncomingMessage) {
|
|
225
225
|
// --- socket 模式,判断真实控制器文件是否存在 ---
|
|
226
|
-
const filePath = config.const.wsPath + pathLeft + '.js';
|
|
226
|
+
const filePath = config.const.wsPath + (pathLeft || 'root') + '.js';
|
|
227
227
|
if (!await lFs.isFile(filePath)) {
|
|
228
228
|
// --- 指定的控制器不存在 ---
|
|
229
229
|
data.socket?.destroy();
|