import { ImageResponse, NextRequest } from 'next/server'; export const config = { runtime: 'edge', }; const CARD_OFFSET_TOP = 152; const CARD_OFFSET_LEFT = 350; const CARD_WIDTH = 500; const CARD_HEIGHT = 250; export default async function handler(req: NextRequest) { const { searchParams } = new URL(req.url); const signature = searchParams.get('signature') || 'Timur'; const [interSemiBold, interRegular, caveatRegular, shareFrameImage] = await Promise.all([ fetch(new URL('./../../../assets/inter-semibold.ttf', import.meta.url)).then(async (res) => res.arrayBuffer(), ), fetch(new URL('./../../../assets/inter-regular.ttf', import.meta.url)).then(async (res) => res.arrayBuffer(), ), fetch(new URL('./../../../assets/caveat-regular.ttf', import.meta.url)).then(async (res) => res.arrayBuffer(), ), fetch(new URL('./../../../assets/og-share-frame.png', import.meta.url)).then(async (res) => res.arrayBuffer(), ), ]); return new ImageResponse( (
{/* @ts-expect-error Lack of typing from ImageResponse */} og-share-frame

{signature}

I just signed with Documenso

), { width: 1200, height: 630, fonts: [ { name: 'Caveat', data: caveatRegular, style: 'italic', }, { name: 'Inter', data: interRegular, style: 'normal', weight: 400, }, { name: 'Inter', data: interSemiBold, style: 'normal', weight: 600, }, ], }, ); }