Something went wrong. Try again.
hogwarts.dev pds dashboard
Something went wrong. Try again.
2.5 kB · 86 lines · Created 10mo ago
HTML
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hogwarts PDS</title> <style> body { display: flex; flex-direction: column; align-items: center; padding: 2rem; } ul { list-style: none; padding: 0; } li { text-align: center; margin: 0.5rem 0; } </style></head><body> <h1>The Hogwarts PDS</h1> <ul id="users"></ul>
<script> const PDS_URL = "https://pds.hogwarts.dev";
async function fetchAllRepos() { const dids = []; let cursor;
do { const url = new URL(`${PDS_URL}/xrpc/com.atproto.sync.listRepos`); if (cursor) url.searchParams.set("cursor", cursor);
const res = await fetch(url); const data = await res.json();
dids.push(...data.repos.map(r => r.did)); cursor = data.cursor; } while (cursor);
return dids; }
async function fetchProfile(did) { try { const url = `${PDS_URL}/xrpc/com.atproto.repo.describeRepo?repo=${did}`; const res = await fetch(url); const data = await res.json(); return { did, handle: data.handle || did }; } catch { return { did, handle: did }; } }
async function loadUsers() { const usersEl = document.getElementById('users');
try { const dids = await fetchAllRepos();
if (dids.length === 0) { usersEl.innerHTML = '<li>No users found</li>'; } else { const profiles = await Promise.all(dids.map(fetchProfile));
profiles.forEach(profile => { const li = document.createElement('li'); li.innerHTML = `<a href="https://bsky.app/profile/${profile.handle}" target="_blank">@${profile.handle}</a>`; usersEl.appendChild(li); }); } } catch (error) { usersEl.innerHTML = '<li>Error loading users</li>'; console.error(error); } }
loadUsers(); </script></body></html>