diff --git a/app/[id]/opengraph-image.tsx b/app/[id]/opengraph-image.tsx index a393c11..e24953f 100644 --- a/app/[id]/opengraph-image.tsx +++ b/app/[id]/opengraph-image.tsx @@ -4,6 +4,8 @@ import { getPoem, splitPoemText } from "libs/utils"; import { SiteInfo } from "data/site"; +import { Poem } from "types/poem"; + export const runtime = "edge"; export const alt = SiteInfo.description; @@ -22,17 +24,19 @@ export default async function Image({ params }: { params: { id: string } }) { }); } - const kiwiMaru = fetch( - new URL( - "https://fonts.bunny.net/kiwi-maru/files/kiwi-maru-japanese-400-normal.woff" - ) - ).then((res) => res.arrayBuffer()); + const kiwiMaru = await fetchFont(poem); + if (!kiwiMaru) { + return new Response("Failed to fetch font", { + status: 500 + }); + } const lines = splitPoemText(poem.text); return new ImageResponse( (