Graphical PDS migrator for AT Protocol
1import { resolver } from "../../lib/id-resolver.ts"; 2import { define } from "../../utils.ts"; 3 4export const handler = define.handlers({ 5 async GET(ctx) { 6 const url = new URL(ctx.req.url); 7 const did = url.searchParams.get("did"); 8 9 if (!did) { 10 return new Response(JSON.stringify({ error: "DID parameter is required" }), { 11 status: 400, 12 headers: { "Content-Type": "application/json" } 13 }); 14 } 15 16 try { 17 const pds = await resolver.resolveDidToPdsUrl(did); 18 return new Response(JSON.stringify({ pds }), { 19 status: 200, 20 headers: { "Content-Type": "application/json" } 21 }); 22 } catch (error) { 23 console.error("Failed to resolve PDS:", error); 24 return new Response(JSON.stringify({ error: "Failed to resolve PDS" }), { 25 status: 500, 26 headers: { "Content-Type": "application/json" } 27 }); 28 } 29 } 30});