A simple, clean, fast browser for the AtmosphereConf(2026) VODs
0
fork

Configure Feed

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

at main 58 lines 2.0 kB view raw
1const IONOSPHERE_DID = 'did:plc:lkeq4oghyhnztbu4dxr3joff' 2const PLC_URL = `https://plc.directory/${IONOSPHERE_DID}` 3 4async function fetchJson<T>(url: string): Promise<T> { 5 const response = await fetch(url) 6 if (!response.ok) { 7 throw new Error(`Request failed (${response.status}) for ${url}`) 8 } 9 return (await response.json()) as T 10} 11 12async function main() { 13 console.log('=== Ionosphere PLC document ===') 14 const plcDoc = await fetchJson<{ 15 service?: Array<{ id?: string; serviceEndpoint?: string }> 16 }>(PLC_URL) 17 console.log(JSON.stringify(plcDoc, null, 2)) 18 19 const pds = plcDoc.service?.find((entry) => entry.id === '#atproto_pds')?.serviceEndpoint 20 if (!pds) { 21 throw new Error('Could not resolve #atproto_pds service endpoint') 22 } 23 24 const basePds = pds.replace(/\/$/, '') 25 console.log('\n=== Resolved PDS endpoint ===') 26 console.log(basePds) 27 28 const describeUrl = `${basePds}/xrpc/com.atproto.repo.describeRepo?repo=${encodeURIComponent(IONOSPHERE_DID)}` 29 console.log('\n=== describeRepo JSON ===') 30 const describe = await fetchJson<{ 31 collections?: string[] 32 [key: string]: unknown 33 }>(describeUrl) 34 console.log(JSON.stringify(describe, null, 2)) 35 36 const collections = (describe.collections ?? []).filter((name) => name.startsWith('tv.ionosphere.')) 37 console.log('\n=== tv.ionosphere.* collections ===') 38 console.log(JSON.stringify(collections, null, 2)) 39 40 for (const collection of collections) { 41 const sampleUrl = 42 `${basePds}/xrpc/com.atproto.repo.listRecords?repo=${encodeURIComponent(IONOSPHERE_DID)}` + 43 `&collection=${encodeURIComponent(collection)}&limit=5` 44 45 console.log(`\n=== Sample records: ${collection} ===`) 46 try { 47 const sample = await fetchJson<Record<string, unknown>>(sampleUrl) 48 console.log(JSON.stringify(sample, null, 2)) 49 } catch (error) { 50 console.log(JSON.stringify({ collection, error: error instanceof Error ? error.message : 'unknown' }, null, 2)) 51 } 52 } 53} 54 55main().catch((error) => { 56 console.error(error) 57 process.exit(1) 58})