diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index b9bf3e2..130eb95 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -1,82 +1,101 @@ import { pb } from "@/lib/pocketbase"; import { Script } from "@/lib/types"; import { ImageResponse } from "next/og"; -import { NextRequest } from "next/server"; import { ClientResponseError } from 'pocketbase'; -export async function GET(req: NextRequest) { - const { searchParams } = new URL(req.url); - const title = searchParams.get("title"); +export const alt = "Dynamic Open Graph Image"; +export const size = { + width: 1200, + height: 630, +}; +export const contentType = "image/png"; + +export async function GET({ params }: { params: { title: string } }) { + const title = params.title; if (!title) { return new Response("Missing title parameter", { status: 400 }); } try { - const script: Script = await pb.collection('proxmox_scripts').getFirstListItem(`title="${title}"`, { - fields: "logo,id", - }); - + const item = await fetchScript(title); return new ImageResponse( (
*/}
- - {title} -
+
+