hifun-tools 1.3.20 → 1.3.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.
- package/dist/init/index.js +2 -2
- package/dist/init/utils.js +1 -7
- package/package.json +1 -1
package/dist/init/index.js
CHANGED
|
@@ -133,9 +133,9 @@ class InitCls {
|
|
|
133
133
|
const response = await fetch(`/lineAddress.txt?t=${Date.now()}`);
|
|
134
134
|
const configText = await response.text();
|
|
135
135
|
let baseUrl = JSON.parse(AesDecrypt(configText));
|
|
136
|
-
const
|
|
136
|
+
const { lineGroup, tenant } = this.getTenantDict();
|
|
137
137
|
const dictList = this.getTenantDictList();
|
|
138
|
-
baseUrl = filterSmartLines(dictList, baseUrl,
|
|
138
|
+
baseUrl = filterSmartLines(dictList, baseUrl, lineGroup, tenant);
|
|
139
139
|
if (Array.isArray(baseUrl)) {
|
|
140
140
|
try {
|
|
141
141
|
this.domainBaseUrl = toStandardUrl(await getOptimalDecodedString(baseUrl));
|
package/dist/init/utils.js
CHANGED
|
@@ -198,23 +198,17 @@ export function filterSmartLines(list1, list2, groupType, tenant) {
|
|
|
198
198
|
throw new Error("前两个参数必须是数组");
|
|
199
199
|
}
|
|
200
200
|
const currentBrowser = detectBrowser();
|
|
201
|
-
// 1. 浏览器过滤
|
|
202
201
|
let result = list1.filter((item) => {
|
|
203
202
|
const checks = item.browserCheck || [];
|
|
204
203
|
const blocked = checks.some((checkItem) => matchBrowser(checkItem, currentBrowser));
|
|
205
204
|
return !blocked;
|
|
206
205
|
});
|
|
207
|
-
// 2. tenant 过滤(如果有传值)
|
|
208
206
|
if (tenant) {
|
|
209
207
|
result = result.filter((item) => item.tenant === tenant);
|
|
210
208
|
}
|
|
211
|
-
// 3. 按 groupType 过滤
|
|
212
209
|
if (groupType) {
|
|
213
210
|
result = result.filter((item) => item.lineGroup === groupType);
|
|
214
211
|
}
|
|
215
|
-
// 4. 提取 lines
|
|
216
212
|
const lines = result.map((item) => toStandardUrl(item.line));
|
|
217
|
-
|
|
218
|
-
const set = new Set(lines);
|
|
219
|
-
return list2.map(toStandardUrl).filter((v) => set.has(toStandardUrl(v)));
|
|
213
|
+
return list2.map(toStandardUrl).filter((v) => isDomainMatch(lines, v)); // ✨ 使用域名匹配
|
|
220
214
|
}
|