Something went wrong. Try again.
An easy to set up and operate PDS admin panel.
Something went wrong. Try again.
928 B · 27 lines
TypeScript
at main
12345678910111213141516171819202122232425262728export interface HostStatus { hostname: string; seq: number; accountCount: number; status: "active" | "idle" | "offline" | "throttled" | "banned";}
export class RelayClient { constructor(private hostname: string) {}
async getHostStatus(pdsHostname: string): Promise<HostStatus> { const res = await fetch( `https://${this.hostname}/xrpc/com.atproto.sync.getHostStatus?hostname=${encodeURIComponent(pdsHostname)}`, ); if (!res.ok) throw new Error(`relay getHostStatus failed: ${res.status}`); return res.json(); }
async requestCrawl(pdsHostname: string): Promise<void> { const res = await fetch(`https://${this.hostname}/xrpc/com.atproto.sync.requestCrawl`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ hostname: pdsHostname }), }); if (!res.ok) throw new Error(`relay requestCrawl failed: ${res.status}`); }}