hifun-tools 1.3.31 → 1.4.1

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.
@@ -41,7 +41,7 @@ declare class InitCls {
41
41
  private _getTenantInfoStrictSync;
42
42
  /** 匹配默认租户 */
43
43
  private _matchDefaultTenant;
44
- refreshHttp(): void;
44
+ refreshHttp(): Promise<void>;
45
45
  /** 获取 lineDict.txt 内容 */
46
46
  private _fetchLineDict;
47
47
  /** 获取并处理 lineAddress.txt */
@@ -143,9 +143,9 @@ class InitCls {
143
143
  }
144
144
  throw new Error("无法获取有效的租户信息");
145
145
  }
146
- refreshHttp() {
146
+ async refreshHttp() {
147
147
  try {
148
- getOptimalDecodedString([this.getBaseUrl()]);
148
+ await getOptimalDecodedString([this.getBaseUrl()]);
149
149
  }
150
150
  catch (error) {
151
151
  rewardMsg({
@@ -186,10 +186,12 @@ class InitCls {
186
186
  // 备用策略
187
187
  let allBaseUrl = filterSmartLines(dictList, OriginBaseUrl);
188
188
  try {
189
- this.domainBaseUrl = toStandardUrl(await getOptimalDecodedString(difArr(allBaseUrl, baseUrl)));
189
+ this.domainBaseUrl = toStandardUrl(await getOptimalDecodedString(difArr(allBaseUrl, baseUrl), {
190
+ filterIp: false,
191
+ }));
190
192
  console.info("✅ 备用配置成功:", this.domainBaseUrl);
191
193
  }
192
- catch {
194
+ catch (err) {
193
195
  this.domainBaseUrl = toStandardUrl(allBaseUrl[0]);
194
196
  console.warn("⚠️ 备选测速失败,使用备用配置:", allBaseUrl);
195
197
  }
@@ -136,8 +136,6 @@ export async function getOptimalDecodedString(arr, options) {
136
136
  ? targetArr.filter(isIPv4)
137
137
  : targetArr.filter((v) => !isIPv4(v));
138
138
  }
139
- if (!targetArr.length)
140
- throw new Error("无可用地址");
141
139
  const failedUrls = [];
142
140
  const controllerMap = {};
143
141
  return new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hifun-tools",
3
- "version": "1.3.31",
3
+ "version": "1.4.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",