Skip to content

Commit

Permalink
Fix: add ookla both host and url
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Feb 8, 2025
1 parent b391de6 commit 339eecb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Build/build-speedtest-domainset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}, []));
Expand Down

0 comments on commit 339eecb

Please sign in to comment.