@maiyunnet/kebab 3.1.10 → 3.1.11

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 CHANGED
@@ -8,7 +8,7 @@
8
8
  * ------------------------
9
9
  */
10
10
  /** --- 当前系统版本号 --- */
11
- export declare const VER = "3.1.10";
11
+ export declare const VER = "3.1.11";
12
12
  /** --- 框架根目录,以 / 结尾 --- */
13
13
  export declare const ROOT_PATH: string;
14
14
  export declare const LIB_PATH: string;
package/index.js CHANGED
@@ -9,7 +9,7 @@
9
9
  * ------------------------
10
10
  */
11
11
  /** --- 当前系统版本号 --- */
12
- export const VER = '3.1.10';
12
+ export const VER = '3.1.11';
13
13
  // --- 服务端用的路径 ---
14
14
  const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
15
15
  /** --- /xxx/xxx --- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiyunnet/kebab",
3
- "version": "3.1.10",
3
+ "version": "3.1.11",
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/child.js CHANGED
@@ -573,7 +573,7 @@ process.on('message', function (msg) {
573
573
  });
574
574
  /**
575
575
  * --- 获取匹配的 vhost 对象 ---
576
- * --- 如果有精准匹配,以精准匹配为准,否则为 2 级泛匹配(vSub),最后全局泛匹配(vGlobal) ---
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
- // --- 2 级泛匹配 ---
589
- domain = domain.replace(/\*/, '^.+?').replace(/\./, '\\.');
590
- if (new RegExp(domain + '$').test(hostname)) {
588
+ // --- 通配符匹配 ---
589
+ domain = domain.replace(/\*/, '.+?').replace(/\./, '\\.');
590
+ if (new RegExp(`^${domain}$`).test(hostname)) {
591
591
  vSub = vhost;
592
592
  }
593
593
  }