a tool for shared writing and social publishing
0
fork

Configure Feed

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

support alt pds hosts when resolving images

+17 -1
+16
app/api/atproto_images/route.ts
··· 1 + import { IdResolver } from "@atproto/identity"; 2 + import { NextRequest, NextResponse } from "next/server"; 3 + let idResolver = new IdResolver(); 4 + 5 + export async function GET( 6 + req: NextRequest, 7 + props: { params: Promise<{ did: string; cid?: string }> }, 8 + ) { 9 + let params = await props.params; 10 + let identity = await idResolver.did.resolve(params.did); 11 + let service = identity?.service?.find((f) => f.type === "atproto_pds"); 12 + if (!service) return new NextResponse(null, { status: 404 }); 13 + return fetch( 14 + `${service.serviceEndpoint}/xrpc/com.atproto.sync.getBlob?did=${params.did}&cid=${params.cid}`, 15 + ); 16 + }
+1 -1
app/lish/[did]/[publication]/[rkey]/page.tsx
··· 168 168 height={b.block.aspectRatio?.height} 169 169 width={b.block.aspectRatio?.width} 170 170 className={`!pt-3 sm:!pt-4 ${className}`} 171 - src={`https://bsky.social/xrpc/com.atproto.sync.getBlob?did=${did}&cid=${(b.block.image.ref as unknown as { $link: string })["$link"]}`} 171 + src={`/api/atproto_images?did=${did}&cid=${(b.block.image.ref as unknown as { $link: string })["$link"]}`} 172 172 /> 173 173 ); 174 174 }