mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-12-09 10:52:32 -05:00
make seed phrase optional
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user