this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

back to node runtime

+11 -12
+5 -4
src/app/opengraph-image.tsx
··· 1 + import { readFile } from "node:fs/promises"; 2 + import { join } from "node:path"; 1 3 import { ImageResponse } from "next/og"; 2 4 3 - export const runtime = "edge"; 4 5 export const size = { 5 6 width: 1200, 6 7 height: 630, ··· 8 9 export const contentType = "image/png"; 9 10 10 11 export default async function OpenGraphImage() { 11 - const fontData = await fetch( 12 - new URL("../assets/fonts/LibreBaskerville-Italic.ttf", import.meta.url), 13 - ).then((res) => res.arrayBuffer()); 12 + const fontData = await readFile( 13 + join(process.cwd(), "./src/assets/fonts/LibreBaskerville-Italic.ttf"), 14 + ).then((res) => Uint8Array.from(res).buffer); 14 15 15 16 return new ImageResponse( 16 17 (
+6 -8
src/app/post/[rkey]/opengraph-image.tsx
··· 1 + import { readFile } from "node:fs/promises"; 2 + import { join } from "node:path"; 1 3 import { ImageResponse } from "next/og"; 2 4 3 5 import { getPost } from "#/lib/api"; 4 6 5 - export const runtime = "edge"; 6 7 export const size = { 7 8 width: 1200, 8 9 height: 630, ··· 16 17 }) { 17 18 const { rkey } = await params; 18 19 19 - const post = await getPost(rkey); 20 + const fontData = await readFile( 21 + join(process.cwd(), "./src/assets/fonts/LibreBaskerville-Italic.ttf"), 22 + ).then((res) => Uint8Array.from(res).buffer); 20 23 21 - const fontData = await fetch( 22 - new URL( 23 - "../../../assets/fonts/LibreBaskerville-Italic.ttf", 24 - import.meta.url, 25 - ), 26 - ).then((res) => res.arrayBuffer()); 24 + const post = await getPost(rkey); 27 25 28 26 return new ImageResponse( 29 27 (