/* eslint-disable @next/next/no-img-element */ import { ImageResponse } from "next/og"; import { OG_DESCRIPTION, TITLE } from "@/app/shared-metadata"; import { SIZE } from "./utils"; export const runtime = "edge"; const FOOTER = "openstatus.dev"; const CATEGORY = "product"; export async function GET(req: Request) { const fontMonoRegular = await fetch( new URL("../../../public/fonts/RobotoMono-Regular.ttf", import.meta.url), ).then((res) => res.arrayBuffer()); const fontMonoMedium = await fetch( new URL("../../../public/fonts/RobotoMono-Medium.ttf", import.meta.url), ).then((res) => res.arrayBuffer()); const fontMonoBold = await fetch( new URL("../../../public/fonts/RobotoMono-Bold.ttf", import.meta.url), ).then((res) => res.arrayBuffer()); const { searchParams } = new URL(req.url); const title = (searchParams.has("title") && searchParams.get("title")) || TITLE; const description = (searchParams.has("description") && searchParams.get("description")) || OG_DESCRIPTION; const footer = (searchParams.has("footer") && searchParams.get("footer")) || FOOTER; const category = (searchParams.has("category") && searchParams.get("category")) || CATEGORY; return new ImageResponse(

[{category.toLowerCase()}]

{title}

{description}

{footer}

, { ...SIZE, fonts: [ { name: "Font Mono", data: fontMonoRegular, style: "normal", weight: 400, }, { name: "Font Mono", data: fontMonoMedium, style: "normal", weight: 500, }, { name: "Font Mono", data: fontMonoBold, style: "normal", weight: 700, }, ], }, ); }