mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-13 17:50:34 +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')
|
||||
.then(res => res.json() as Promise<SpeedTestServer[]>)
|
||||
.then((data) => data.reduce<string[]>((prev, cur) => {
|
||||
const hn = tldts.getHostname(cur.host || cur.url, { detectIp: false, validateHostname: true });
|
||||
if (hn) {
|
||||
prev.push(hn);
|
||||
let hn: string | null = null;
|
||||
if (cur.host) {
|
||||
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;
|
||||
}, []));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user