hifun-tools 1.4.21 → 1.4.22

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.
@@ -14,6 +14,7 @@ declare class InitCls {
14
14
  private initialized;
15
15
  isRefreshNow: boolean;
16
16
  private localPath;
17
+ private onlyBackUp;
17
18
  private OriginBaseUrl;
18
19
  private tenant;
19
20
  private tenantConfig;
@@ -29,6 +30,8 @@ declare class InitCls {
29
30
  appGateway?: string;
30
31
  backupAddress?: string[];
31
32
  }): Promise<(string | null)[]>;
33
+ getOnlyBackup(): boolean;
34
+ setOnlyBackup(value: boolean): void;
32
35
  /** 是否 App 环境 */
33
36
  getIsApp(): boolean;
34
37
  /** 获取租户名 */
@@ -19,6 +19,7 @@ class InitCls {
19
19
  initialized = false;
20
20
  isRefreshNow = false;
21
21
  localPath = "";
22
+ onlyBackUp = false;
22
23
  OriginBaseUrl = [];
23
24
  tenant = "";
24
25
  tenantConfig = null;
@@ -52,6 +53,12 @@ class InitCls {
52
53
  console.info("✅ 所有初始化完成:", results);
53
54
  return results;
54
55
  }
56
+ getOnlyBackup() {
57
+ return this.onlyBackUp;
58
+ }
59
+ setOnlyBackup(value) {
60
+ this.onlyBackUp = value;
61
+ }
55
62
  /** 是否 App 环境 */
56
63
  getIsApp() {
57
64
  return !!this.appTenant && !!this.appLine;
@@ -160,9 +167,13 @@ class InitCls {
160
167
  }
161
168
  async retryHttp() {
162
169
  try {
170
+ if (this.onlyBackUp)
171
+ return;
163
172
  await getOptimalDecodedString([this.getBaseUrl()]);
164
173
  }
165
174
  catch (error) {
175
+ if (this.onlyBackUp)
176
+ return;
166
177
  await this._loadGatewayConfig(true);
167
178
  }
168
179
  }
@@ -295,6 +306,7 @@ class InitCls {
295
306
  await setBaseUrl(this.backupAddressList);
296
307
  console.info("✅ 备用远程Address配置成功:", this.domainBaseUrl);
297
308
  };
309
+ this.onlyBackUp = false;
298
310
  try {
299
311
  /** 1️⃣ 读取主配置 */
300
312
  const response = await fetch(`/lineAddress.txt?t=${Date.now()}`);
@@ -328,6 +340,7 @@ class InitCls {
328
340
  catch {
329
341
  this.domainBaseUrl = toStandardUrl(originBaseUrl[0]);
330
342
  console.warn("⚠️ 备选测速失败,使用备用配置:", this.domainBaseUrl);
343
+ this.onlyBackUp = true;
331
344
  }
332
345
  }
333
346
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.4.20";
1
+ export declare const VERSION = "1.4.21";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.4.20";
1
+ export const VERSION = "1.4.21";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hifun-tools",
3
- "version": "1.4.21",
3
+ "version": "1.4.22",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",