hifun-tools 1.3.11 → 1.3.13
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/dist/init/index.d.ts +3 -1
- package/dist/init/index.js +12 -5
- package/package.json +1 -1
package/dist/init/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ declare class InitCls {
|
|
|
11
11
|
private initialized;
|
|
12
12
|
private tenant;
|
|
13
13
|
private defaultBaseUrl;
|
|
14
|
+
private localPath;
|
|
14
15
|
getBaseUrl(): string;
|
|
15
16
|
/** 获取配置 */
|
|
16
17
|
getTenantConfig(): TenantConfig | null;
|
|
@@ -21,9 +22,10 @@ declare class InitCls {
|
|
|
21
22
|
private getTenantInfoStrictSync;
|
|
22
23
|
/** 严格初始化(必须在应用启动时调用) */
|
|
23
24
|
private initialize;
|
|
24
|
-
InitConfig({ fileType, defaultBaseUrl, }: {
|
|
25
|
+
InitConfig({ fileType, defaultBaseUrl, localPath, }: {
|
|
25
26
|
fileType: string[];
|
|
26
27
|
defaultBaseUrl?: string;
|
|
28
|
+
localPath?: string;
|
|
27
29
|
}): Promise<any[]>;
|
|
28
30
|
private LoadGatewayConfig;
|
|
29
31
|
AesEncrypt: typeof AesEncrypt;
|
package/dist/init/index.js
CHANGED
|
@@ -7,8 +7,8 @@ class InitCls {
|
|
|
7
7
|
initialized = false;
|
|
8
8
|
tenant = "";
|
|
9
9
|
defaultBaseUrl = "";
|
|
10
|
+
localPath = "";
|
|
10
11
|
getBaseUrl() {
|
|
11
|
-
console.log("this.domainBaseUrl", this.domainBaseUrl);
|
|
12
12
|
if (!this.domainBaseUrl) {
|
|
13
13
|
throw new Error("域名尚未初始化或初始化失败");
|
|
14
14
|
}
|
|
@@ -67,7 +67,9 @@ class InitCls {
|
|
|
67
67
|
catch (error) {
|
|
68
68
|
console.error("解析 lineTenants.txt 失败:", error);
|
|
69
69
|
const host = location.host;
|
|
70
|
-
if (host.includes("iggame") ||
|
|
70
|
+
if (host.includes("iggame") ||
|
|
71
|
+
host.includes("localhost") ||
|
|
72
|
+
location.origin.includes(this.localPath.replace(/\/+$/, ""))) {
|
|
71
73
|
console.info(`🏠 iggame匹配到默认租户`);
|
|
72
74
|
return { tenant: "iggame" };
|
|
73
75
|
}
|
|
@@ -91,10 +93,13 @@ class InitCls {
|
|
|
91
93
|
throw error;
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
|
-
async InitConfig({ fileType, defaultBaseUrl, }) {
|
|
96
|
+
async InitConfig({ fileType, defaultBaseUrl, localPath, }) {
|
|
95
97
|
if (defaultBaseUrl) {
|
|
96
98
|
this.defaultBaseUrl = defaultBaseUrl;
|
|
97
99
|
}
|
|
100
|
+
if (localPath) {
|
|
101
|
+
this.localPath = localPath;
|
|
102
|
+
}
|
|
98
103
|
console.log("加载类型:", fileType);
|
|
99
104
|
const tasks = [];
|
|
100
105
|
if (fileType.includes("lineAddress")) {
|
|
@@ -134,11 +139,13 @@ class InitCls {
|
|
|
134
139
|
return this.domainBaseUrl;
|
|
135
140
|
}
|
|
136
141
|
catch (error) {
|
|
137
|
-
if (this.defaultBaseUrl &&
|
|
142
|
+
if ((this.defaultBaseUrl &&
|
|
138
143
|
(location.host.includes("iggame") ||
|
|
139
|
-
location.host.includes("localhost")))
|
|
144
|
+
location.host.includes("localhost"))) ||
|
|
145
|
+
location.origin.includes(this.localPath.replace(/\/+$/, ""))) {
|
|
140
146
|
console.info(`🏠 iggame匹配到默认链接`, this.defaultBaseUrl);
|
|
141
147
|
this.domainBaseUrl = this.defaultBaseUrl;
|
|
148
|
+
return this.domainBaseUrl;
|
|
142
149
|
}
|
|
143
150
|
else {
|
|
144
151
|
console.warn("⚠️ 加载 lineAddress.txt 失败:", error);
|