// Plain URL reachability check for public pages (privacy policy, app-ads.txt). No credentials are ever sent. import type { UrlCheck } from './validate-rules'; export async function checkUrl(url: string, o: { body?: boolean; timeoutMs?: number } = {}): Promise { try { const r = await fetch(url, { redirect: 'follow', signal: AbortSignal.timeout(o.timeoutMs ?? 15_000), headers: { 'User-Agent': 'storebound-validate' } }); const body = o.body ? (await r.text()).slice(0, 200_000) : undefined; if (!o.body) await r.body?.cancel(); return { url, status: r.status, body }; } catch (e) { return { url, status: null, error: (e as Error).message }; } }