fix lookup

This commit is contained in:
2026-03-07 00:39:06 +01:00
parent 56ed5909c7
commit 2f16721a93
3 changed files with 52 additions and 14 deletions
+5 -1
View File
@@ -1,13 +1,17 @@
export const DnsService = {
async resolve(hostname: string): Promise<string | null> {
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 5000);
const response = await fetch(
`https://cloudflare-dns.com/dns-query?name=${hostname}&type=A`,
{
headers: { accept: 'application/dns-json' },
credentials: 'omit'
credentials: 'omit',
signal: controller.signal,
}
);
clearTimeout(timeout);
if (!response.ok) return null;
+5 -1
View File
@@ -13,11 +13,15 @@ export const GeoService = {
if (cached) return cached;
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 5000);
const res = await fetch(`https://ip.albert.lol/${ip}`, {
method: 'GET',
cache: 'force-cache',
credentials: 'omit'
credentials: 'omit',
signal: controller.signal,
});
clearTimeout(timeout);
if (!res.ok) throw new Error(`API Error ${res.status}`);