some cleanup by hand
156 unmodified linesExpand all15715815916016116216316416516616716816116216316416516638 unmodified lines2052062072082152092102112122138 unmodified lines22222322422523223322622722822923023623123223323423524 unmodified lines26026126226326927026426526626726827326927027127227329 unmodified lines156 unmodified linesExpand all const response = await authoritativeResolve(domain, 'TXT') const records: string[][] = [] for (const answer of response.answers ?? []) { if (answer.type === 'TXT' && 'data' in answer) { const data = answer.data as Buffer | Buffer[] | string | string[] if (Array.isArray(data)) { records.push(data.map((d) => (Buffer.isBuffer(d) ? d.toString('utf-8') : String(d)))) } else if (Buffer.isBuffer(data)) { records.push([data.toString('utf-8')]) } else { records.push([String(data)]) } const chunks = Array.isArray(answer.data) ? answer.data : [answer.data] records.push(chunks.map((d) => (Buffer.isBuffer(d) ? d.toString('utf-8') : String(d)))) } } return records}38 unmodified lines const records = await authoritativeResolveTxt(txtDomain) const foundTxtValues = records.map((r) => r.join('')) console.log(`[DNS Verify] Found TXT records:`, foundTxtValues)
if (foundTxtValues.find((v) => v === expectedDid)) { if (foundTxtValues.some((v) => v === expectedDid)) { console.log(`[DNS Verify] ✓ TXT record matches`) const extras = foundTxtValues.filter((v) => v !== expectedDid) const warning = extras.length > 08 unmodified lines verified: false, error: `TXT record at ${txtDomain} does not match expected DID. Expected: ${expectedDid}`, found: { txt: foundTxtValues }, } } catch (err: any) { console.log(`[DNS Verify] ✗ TXT lookup error:`, err.message) } catch (err) { const message = err instanceof Error ? err.message : String(err) console.log(`[DNS Verify] ✗ TXT lookup error:`, message) return { verified: false, error: `DNS lookup failed: ${err.message}`, error: `DNS lookup failed: ${message}`, found: { txt: [] }, } }}24 unmodified lines verified: false, error: `CNAME for ${domain} points to ${foundCname}, expected ${expectedTarget}`, found: { cname: foundCname }, } } catch (err: any) { console.log(`[DNS Verify] ✗ CNAME lookup error:`, err.message) } catch (err) { const message = err instanceof Error ? err.message : String(err) console.log(`[DNS Verify] ✗ CNAME lookup error:`, message) return { verified: false, error: `DNS lookup failed: ${err.message}`, error: `DNS lookup failed: ${message}`, found: { cname: '' }, } }}29 unmodified lines110 unmodified linesExpand all111112113114115115116117118119120121122123124125126127117118119120121122123124125126127128129358 unmodified linesExpand all4884894904914944954964974984924934944954961 unmodified line498499500501508509510511512502503504505506122 unmodified linesExpand all6296306316326436336346456356366376386393 unmodified lines643644645646647648657658659660661662663664649650651652653654655656657658659660661260 unmodified linesExpand all110 unmodified linesExpand all type: 'wisp' | 'custom' domain: string verified?: boolean }>,) => {): PlaceWispV2SiteGetDomains.SiteDomain[] => { return mappedDomains .map((entry) => ({ domain: entry.domain, kind: entry.type, status: entry.type === 'wisp' ? ('verified' as const) : entry.verified ? ('verified' as const) : ('pendingVerification' as const), verified: entry.type === 'wisp' ? true : Boolean(entry.verified), })) .map((entry) => { const verified = entry.type === 'wisp' || Boolean(entry.verified) return { domain: entry.domain, kind: entry.type, status: verified ? ('verified' as const) : ('pendingVerification' as const), verified, } }) .sort((a, b) => a.domain.localeCompare(b.domain))}
type DidString = `did:${string}:${string}`358 unmodified linesExpand all }
const mappedDomains = await getDomainsBySite(did, siteRkey)
const unmappedDomains: Array<{ domain: string kind: 'wisp' | 'custom' status: 'pendingVerification' | 'verified' }> = [] const unmappedDomains: PlaceWispV2SiteDelete.UnmappedDomain[] = []
for (const mapped of mappedDomains as Array<{ type: 'wisp' | 'custom' domain: string1 unmodified line verified?: boolean }>) { if (mapped.type === 'wisp') { await updateWispDomainSite(mapped.domain, null) unmappedDomains.push({ domain: mapped.domain, kind: 'wisp', status: 'verified', }) unmappedDomains.push({ domain: mapped.domain, kind: 'wisp', status: 'verified' }) continue }
if (mapped.id) {122 unmodified linesExpand all const did = auth.did as DidString
const [wispDomains, customDomains] = await Promise.all([getAllWispDomains(did), getCustomDomainsByDid(did)])
const domains = [ const domains: PlaceWispV2DomainGetList.DomainSummary[] = [ ...wispDomains.map((entry: { domain: string; rkey: string | null }) => ({ domain: entry.domain as string, domain: entry.domain, kind: 'wisp' as const, status: 'verified' as const, verified: true, siteRkey: entry.rkey ?? undefined,3 unmodified lines domain: string verified: boolean rkey: string | null last_verified_at?: number | string | null }) => { const verified = Boolean(entry.verified) }) => ({ domain: entry.domain as string, kind: 'custom' as const, status: entry.verified ? ('verified' as const) : ('pendingVerification' as const), verified: Boolean(entry.verified), siteRkey: entry.rkey ?? undefined, lastCheckedAt: toIsoFromEpoch(entry.last_verified_at), }), return { domain: entry.domain, kind: 'custom' as const, status: verified ? ('verified' as const) : ('pendingVerification' as const), verified, siteRkey: entry.rkey ?? undefined, lastCheckedAt: toIsoFromEpoch(entry.last_verified_at), } }, ), ].sort((a, b) => a.domain.localeCompare(b.domain))
return json({ domains })260 unmodified linesExpand all