From 41c1753db41ec5a69660c357f81c47ab38bbe2f6 Mon Sep 17 00:00:00 2001 From: eckartal Date: Tue, 31 Dec 2024 17:49:16 +0800 Subject: [PATCH] vercel deployment --- app/(post)/og/[id]/route.tsx | 41 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/app/(post)/og/[id]/route.tsx b/app/(post)/og/[id]/route.tsx index eef11fc..8dcdd5a 100644 --- a/app/(post)/og/[id]/route.tsx +++ b/app/(post)/og/[id]/route.tsx @@ -7,27 +7,16 @@ import { join } from "path"; export const revalidate = 60; export async function generateStaticParams() { - return (await getPosts()).map(post => ({ id: post.id })); + return (await getPosts()).map((post) => ({ id: post.id })); } -// fonts +// Fonts const fontsDir = join(process.cwd(), "fonts"); -const inter300 = readFileSync( - join(fontsDir, "inter-latin-300-normal.woff") -); - -const inter500 = readFileSync( - join(fontsDir, "inter-latin-500-normal.woff") -); - -const inter600 = readFileSync( - join(fontsDir, "inter-latin-600-normal.woff") -); - -const robotoMono400 = readFileSync( - join(fontsDir, "roboto-mono-latin-400-normal.woff") -); +const inter300 = readFileSync(join(fontsDir, "inter-latin-300-normal.woff")); +const inter500 = readFileSync(join(fontsDir, "inter-latin-500-normal.woff")); +const inter600 = readFileSync(join(fontsDir, "inter-latin-600-normal.woff")); +const robotoMono400 = readFileSync(join(fontsDir, "roboto-mono-latin-400-normal.woff")); export async function GET(req: Request) { const { searchParams } = new URL(req.url); @@ -38,7 +27,8 @@ export async function GET(req: Request) { } const posts = await getPosts(); - const post = posts.find(p => p.id === id); + const post = posts.find((p) => p.id === id); + if (!post) { return new Response("Not Found", { status: 404 }); } @@ -79,4 +69,17 @@ export async function GET(req: Request) { { width: 1200, height: 630, - fonts: + fonts: [ + { name: "Inter 300", data: inter300 }, + { name: "Inter 500", data: inter500 }, + { name: "Inter 600", data: inter600 }, + { name: "Roboto Mono 400", data: robotoMono400 }, + ], + } + ); +} + +// Helper function for styles +function font(fontFamily: string) { + return { fontFamily }; +}