make seed phrase optional

This commit is contained in:
lucas-neynar
2025-03-13 14:58:32 -07:00
parent 3186cb7fc8
commit b88e72524a
7 changed files with 183 additions and 50 deletions

View File

@@ -1,34 +1,12 @@
import { readFileSync } from 'fs';
import { join } from 'path';
import { NextResponse } from 'next/server';
import { generateFarcasterMetadata } from '../../../lib/utils';
export async function GET() {
const appUrl = process.env.NEXT_PUBLIC_URL;
const splashImageUrl = process.env.NEXT_PUBLIC_FRAME_SPLASH_IMAGE_URL || `${appUrl}/splash.png`;
let accountAssociation; // TODO: add type
try {
const manifestPath = join(process.cwd(), 'public/manifest.json');
const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
accountAssociation = manifest;
const config = await generateFarcasterMetadata();
return NextResponse.json(config);
} catch (error) {
console.warn('Warning: manifest.json not found or invalid. Frame will not be associated with an account.');
accountAssociation = null;
console.error('Error generating metadata:', error);
return NextResponse.json({ error: error.message }, { status: 500 });
}
const config = {
...(accountAssociation && { accountAssociation }),
frame: {
version: "1",
name: process.env.NEXT_PUBLIC_FRAME_NAME || "Frames v2 Demo",
iconUrl: `${appUrl}/icon.png`,
homeUrl: appUrl,
imageUrl: `${appUrl}/frames/hello/opengraph-image`,
buttonTitle: process.env.NEXT_PUBLIC_FRAME_BUTTON_TEXT || "Launch Frame",
splashImageUrl,
splashBackgroundColor: "#f7f7f7",
webhookUrl: `${appUrl}/api/webhook`,
},
};
return Response.json(config);
}

View File

@@ -9,7 +9,7 @@ const Demo = dynamic(() => import("~/components/Demo"), {
});
export default function App(
{ title }: { title?: string } = { title: "Frames v2 Demo" }
{ title }: { title?: string } = { title: process.env.NEXT_PUBLIC_FRAME_NAME || "Frames v2 Demo" }
) {
return <Demo title={title} />;
}