diff --git a/package.json b/package.json index 4dba629..88e56ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@neynar/create-farcaster-mini-app", - "version": "1.2.21", + "version": "1.2.22", "type": "module", "private": false, "access": "public", diff --git a/scripts/build.js b/scripts/build.js index e00c77c..9d98ba1 100755 --- a/scripts/build.js +++ b/scripts/build.js @@ -172,7 +172,7 @@ async function generateFarcasterMetadata(domain, fid, accountAddress, seedPhrase name: process.env.NEXT_PUBLIC_FRAME_NAME, iconUrl: `https://${domain}/icon.png`, homeUrl: `https://${domain}`, - imageUrl: `https://${domain}/opengraph-image`, + imageUrl: `https://${domain}/api/opengraph-image`, buttonTitle: process.env.NEXT_PUBLIC_FRAME_BUTTON_TEXT, splashImageUrl: `https://${domain}/splash.png`, splashBackgroundColor: "#f7f7f7", diff --git a/scripts/deploy.js b/scripts/deploy.js index 4f60879..b5bbabd 100755 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -83,7 +83,7 @@ async function generateFarcasterMetadata(domain, fid, accountAddress, seedPhrase name: process.env.NEXT_PUBLIC_FRAME_NAME?.trim(), iconUrl: `https://${trimmedDomain}/icon.png`, homeUrl: `https://${trimmedDomain}`, - imageUrl: `https://${trimmedDomain}/opengraph-image`, + imageUrl: `https://${trimmedDomain}/api/opengraph-image`, buttonTitle: process.env.NEXT_PUBLIC_FRAME_BUTTON_TEXT?.trim(), splashImageUrl: `https://${trimmedDomain}/splash.png`, splashBackgroundColor: "#f7f7f7", diff --git a/src/app/api/opengraph-image/route.tsx b/src/app/api/opengraph-image/route.tsx new file mode 100644 index 0000000..37aa1e8 --- /dev/null +++ b/src/app/api/opengraph-image/route.tsx @@ -0,0 +1,30 @@ +import { ImageResponse } from "next/og"; +import { NextRequest } from "next/server"; +import { getNeynarUser } from "~/lib/neynar"; + +export const dynamic = 'force-dynamic'; + +export async function GET(request: NextRequest) { + const { searchParams } = new URL(request.url); + const fid = searchParams.get('fid'); + + const user = await getNeynarUser(Number(fid)); + + return new ImageResponse( + ( +
Powered by Neynar 🪐
+