Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

some cleanup by hand

authored by

nekomimi.pet and committed by
Tangled
9aaa585e 6310df6d

+36 -47
+11 -15
apps/main-app/src/lib/dns-verify.ts
··· 158 158 const records: string[][] = [] 159 159 for (const answer of response.answers ?? []) { 160 160 if (answer.type === 'TXT' && 'data' in answer) { 161 - const data = answer.data as Buffer | Buffer[] | string | string[] 162 - if (Array.isArray(data)) { 163 - records.push(data.map((d) => (Buffer.isBuffer(d) ? d.toString('utf-8') : String(d)))) 164 - } else if (Buffer.isBuffer(data)) { 165 - records.push([data.toString('utf-8')]) 166 - } else { 167 - records.push([String(data)]) 168 - } 161 + const chunks = Array.isArray(answer.data) ? answer.data : [answer.data] 162 + records.push(chunks.map((d) => (Buffer.isBuffer(d) ? d.toString('utf-8') : String(d)))) 169 163 } 170 164 } 171 165 return records ··· 212 206 const foundTxtValues = records.map((r) => r.join('')) 213 207 console.log(`[DNS Verify] Found TXT records:`, foundTxtValues) 214 208 215 - if (foundTxtValues.find((v) => v === expectedDid)) { 209 + if (foundTxtValues.some((v) => v === expectedDid)) { 216 210 console.log(`[DNS Verify] ✓ TXT record matches`) 217 211 const extras = foundTxtValues.filter((v) => v !== expectedDid) 218 212 const warning = ··· 229 223 error: `TXT record at ${txtDomain} does not match expected DID. Expected: ${expectedDid}`, 230 224 found: { txt: foundTxtValues }, 231 225 } 232 - } catch (err: any) { 233 - console.log(`[DNS Verify] ✗ TXT lookup error:`, err.message) 226 + } catch (err) { 227 + const message = err instanceof Error ? err.message : String(err) 228 + console.log(`[DNS Verify] ✗ TXT lookup error:`, message) 234 229 return { 235 230 verified: false, 236 - error: `DNS lookup failed: ${err.message}`, 231 + error: `DNS lookup failed: ${message}`, 237 232 found: { txt: [] }, 238 233 } 239 234 } ··· 266 261 error: `CNAME for ${domain} points to ${foundCname}, expected ${expectedTarget}`, 267 262 found: { cname: foundCname }, 268 263 } 269 - } catch (err: any) { 270 - console.log(`[DNS Verify] ✗ CNAME lookup error:`, err.message) 264 + } catch (err) { 265 + const message = err instanceof Error ? err.message : String(err) 266 + console.log(`[DNS Verify] ✗ CNAME lookup error:`, message) 271 267 return { 272 268 verified: false, 273 - error: `DNS lookup failed: ${err.message}`, 269 + error: `DNS lookup failed: ${message}`, 274 270 found: { cname: '' }, 275 271 } 276 272 }
+25 -32
apps/main-app/src/routes/xrpc.ts
··· 112 112 domain: string 113 113 verified?: boolean 114 114 }>, 115 - ) => { 115 + ): PlaceWispV2SiteGetDomains.SiteDomain[] => { 116 116 return mappedDomains 117 - .map((entry) => ({ 118 - domain: entry.domain, 119 - kind: entry.type, 120 - status: 121 - entry.type === 'wisp' 122 - ? ('verified' as const) 123 - : entry.verified 124 - ? ('verified' as const) 125 - : ('pendingVerification' as const), 126 - verified: entry.type === 'wisp' ? true : Boolean(entry.verified), 127 - })) 117 + .map((entry) => { 118 + const verified = entry.type === 'wisp' || Boolean(entry.verified) 119 + return { 120 + domain: entry.domain, 121 + kind: entry.type, 122 + status: verified ? ('verified' as const) : ('pendingVerification' as const), 123 + verified, 124 + } 125 + }) 128 126 .sort((a, b) => a.domain.localeCompare(b.domain)) 129 127 } 130 128 ··· 491 489 492 490 const mappedDomains = await getDomainsBySite(did, siteRkey) 493 491 494 - const unmappedDomains: Array<{ 495 - domain: string 496 - kind: 'wisp' | 'custom' 497 - status: 'pendingVerification' | 'verified' 498 - }> = [] 492 + const unmappedDomains: PlaceWispV2SiteDelete.UnmappedDomain[] = [] 499 493 500 494 for (const mapped of mappedDomains as Array<{ 501 495 type: 'wisp' | 'custom' ··· 505 499 }>) { 506 500 if (mapped.type === 'wisp') { 507 501 await updateWispDomainSite(mapped.domain, null) 508 - unmappedDomains.push({ 509 - domain: mapped.domain, 510 - kind: 'wisp', 511 - status: 'verified', 512 - }) 502 + unmappedDomains.push({ domain: mapped.domain, kind: 'wisp', status: 'verified' }) 513 503 continue 514 504 } 515 505 ··· 640 630 641 631 const [wispDomains, customDomains] = await Promise.all([getAllWispDomains(did), getCustomDomainsByDid(did)]) 642 632 643 - const domains = [ 633 + const domains: PlaceWispV2DomainGetList.DomainSummary[] = [ 644 634 ...wispDomains.map((entry: { domain: string; rkey: string | null }) => ({ 645 - domain: entry.domain as string, 635 + domain: entry.domain, 646 636 kind: 'wisp' as const, 647 637 status: 'verified' as const, 648 638 verified: true, ··· 654 644 verified: boolean 655 645 rkey: string | null 656 646 last_verified_at?: number | string | null 657 - }) => ({ 658 - domain: entry.domain as string, 659 - kind: 'custom' as const, 660 - status: entry.verified ? ('verified' as const) : ('pendingVerification' as const), 661 - verified: Boolean(entry.verified), 662 - siteRkey: entry.rkey ?? undefined, 663 - lastCheckedAt: toIsoFromEpoch(entry.last_verified_at), 664 - }), 647 + }) => { 648 + const verified = Boolean(entry.verified) 649 + return { 650 + domain: entry.domain, 651 + kind: 'custom' as const, 652 + status: verified ? ('verified' as const) : ('pendingVerification' as const), 653 + verified, 654 + siteRkey: entry.rkey ?? undefined, 655 + lastCheckedAt: toIsoFromEpoch(entry.last_verified_at), 656 + } 657 + }, 665 658 ), 666 659 ].sort((a, b) => a.domain.localeCompare(b.domain)) 667 660