this repo has no description
0
fork

Configure Feed

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

use edge runtime

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