a tool for shared writing and social publishing
0
fork

Configure Feed

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

fix image route

+12 -6
+12 -6
app/api/atproto_images/route.ts
··· 2 2 import { NextRequest, NextResponse } from "next/server"; 3 3 let idResolver = new IdResolver(); 4 4 5 - export async function GET( 6 - req: NextRequest, 7 - props: { params: Promise<{ did: string; cid?: string }> }, 8 - ) { 9 - let params = await props.params; 5 + export async function GET(req: NextRequest) { 6 + const url = new URL(req.url); 7 + const params = { 8 + did: url.searchParams.get("did") ?? "", 9 + cid: url.searchParams.get("cid") ?? "", 10 + }; 11 + console.log(params); 12 + if (!params.did || !params.cid) 13 + return new NextResponse(null, { status: 404 }); 14 + 10 15 let identity = await idResolver.did.resolve(params.did); 11 - let service = identity?.service?.find((f) => f.type === "atproto_pds"); 16 + let service = identity?.service?.find((f) => f.id === "#atproto_pds"); 17 + console.log(identity); 12 18 if (!service) return new NextResponse(null, { status: 404 }); 13 19 return fetch( 14 20 `${service.serviceEndpoint}/xrpc/com.atproto.sync.getBlob?did=${params.did}&cid=${params.cid}`,