mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-21 10:18:01 -05:00
feat: add primary category and tags
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
export const APP_URL = process.env.NEXT_PUBLIC_URL!;
|
||||
export const APP_NAME = process.env.NEXT_PUBLIC_FRAME_NAME;
|
||||
export const APP_DESCRIPTION = process.env.NEXT_PUBLIC_FRAME_DESCRIPTION;
|
||||
export const APP_PRIMARY_CATEGORY = process.env.NEXT_PUBLIC_FRAME_PRIMARY_CATEGORY;
|
||||
export const APP_TAGS = process.env.NEXT_PUBLIC_FRAME_TAGS?.split(',');
|
||||
export const APP_ICON_URL = `${APP_URL}/icon.png`;
|
||||
export const APP_OG_IMAGE_URL = `${APP_URL}/api/opengraph-image`;
|
||||
export const APP_SPLASH_URL = `${APP_URL}/splash.png`;
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
import { type ClassValue, clsx } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
import { mnemonicToAccount } from 'viem/accounts';
|
||||
import { APP_BUTTON_TEXT, APP_ICON_URL, APP_NAME, APP_OG_IMAGE_URL, APP_SPLASH_BACKGROUND_COLOR, APP_URL, APP_WEBHOOK_URL } from './constants';
|
||||
import { APP_BUTTON_TEXT, APP_DESCRIPTION, APP_ICON_URL, APP_NAME, APP_OG_IMAGE_URL, APP_PRIMARY_CATEGORY, APP_SPLASH_BACKGROUND_COLOR, APP_TAGS, APP_URL, APP_WEBHOOK_URL } from './constants';
|
||||
import { APP_SPLASH_URL } from './constants';
|
||||
|
||||
interface FrameMetadata {
|
||||
version: string;
|
||||
name: string;
|
||||
iconUrl: string;
|
||||
homeUrl: string;
|
||||
imageUrl?: string;
|
||||
buttonTitle?: string;
|
||||
splashImageUrl?: string;
|
||||
splashBackgroundColor?: string;
|
||||
webhookUrl?: string;
|
||||
description?: string;
|
||||
primaryCategory?: string;
|
||||
tags?: string[];
|
||||
};
|
||||
|
||||
interface FrameManifest {
|
||||
accountAssociation?: {
|
||||
header: string;
|
||||
payload: string;
|
||||
signature: string;
|
||||
};
|
||||
frame: {
|
||||
version: string;
|
||||
name: string;
|
||||
iconUrl: string;
|
||||
homeUrl: string;
|
||||
imageUrl: string;
|
||||
buttonTitle: string;
|
||||
splashImageUrl: string;
|
||||
splashBackgroundColor: string;
|
||||
webhookUrl: string;
|
||||
};
|
||||
frame: FrameMetadata;
|
||||
}
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
@@ -51,12 +56,15 @@ export function getFrameEmbedMetadata(ogImageUrl?: string) {
|
||||
splashImageUrl: APP_SPLASH_URL,
|
||||
iconUrl: APP_ICON_URL,
|
||||
splashBackgroundColor: APP_SPLASH_BACKGROUND_COLOR,
|
||||
description: APP_DESCRIPTION,
|
||||
primaryCategory: APP_PRIMARY_CATEGORY,
|
||||
tags: APP_TAGS,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export async function getFarcasterMetadata(): Promise<FrameMetadata> {
|
||||
export async function getFarcasterMetadata(): Promise<FrameManifest> {
|
||||
// First check for FRAME_METADATA in .env and use that if it exists
|
||||
if (process.env.FRAME_METADATA) {
|
||||
try {
|
||||
@@ -123,6 +131,9 @@ export async function getFarcasterMetadata(): Promise<FrameMetadata> {
|
||||
splashImageUrl: APP_SPLASH_URL,
|
||||
splashBackgroundColor: APP_SPLASH_BACKGROUND_COLOR,
|
||||
webhookUrl: APP_WEBHOOK_URL,
|
||||
description: APP_DESCRIPTION,
|
||||
primaryCategory: APP_PRIMARY_CATEGORY,
|
||||
tags: APP_TAGS,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user