mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-16 19:30:28 +08:00
Fix: add ookla both host and url
This commit is contained in:
parent
b391de6521
commit
339eecb39b
@ -27,9 +27,18 @@ interface SpeedTestServer {
|
|||||||
const getSpeedtestHostsGroupsPromise = $$fetch('https://speedtest-net-servers.cdn.skk.moe/servers.json')
|
const getSpeedtestHostsGroupsPromise = $$fetch('https://speedtest-net-servers.cdn.skk.moe/servers.json')
|
||||||
.then(res => res.json() as Promise<SpeedTestServer[]>)
|
.then(res => res.json() as Promise<SpeedTestServer[]>)
|
||||||
.then((data) => data.reduce<string[]>((prev, cur) => {
|
.then((data) => data.reduce<string[]>((prev, cur) => {
|
||||||
const hn = tldts.getHostname(cur.host || cur.url, { detectIp: false, validateHostname: true });
|
let hn: string | null = null;
|
||||||
if (hn) {
|
if (cur.host) {
|
||||||
prev.push(hn);
|
hn = tldts.getHostname(cur.host, { detectIp: false, validateHostname: true });
|
||||||
|
if (hn) {
|
||||||
|
prev.push(hn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (cur.url) {
|
||||||
|
hn = tldts.getHostname(cur.url, { detectIp: false, validateHostname: true });
|
||||||
|
if (hn) {
|
||||||
|
prev.push(hn);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return prev;
|
return prev;
|
||||||
}, []));
|
}, []));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user