diff --git a/src/app/api/og/route.tsx b/src/app/api/og/route.tsx index 5ba9db5..db12209 100644 --- a/src/app/api/og/route.tsx +++ b/src/app/api/og/route.tsx @@ -2,85 +2,75 @@ import { pb } from "@/lib/pocketbase"; import { Script } from "@/lib/types"; import { ImageResponse } from "next/og"; import { NextRequest } from "next/server"; -import { ClientResponseError } from 'pocketbase'; - -const size = { - width: 1200, - height: 630, -}; +import { ClientResponseError } from "pocketbase"; export async function GET(req: NextRequest) { - const title = req.nextUrl.searchParams.get("title"); + const { searchParams } = new URL(req.url); + const title = searchParams.get("title"); if (!title) { return new Response("Missing title parameter", { status: 400 }); } try { - const item = await fetchScript(title); + const script: Script = await pb + .collection("proxmox_scripts") + .getFirstListItem(`title="${title}"`, { + fields: "logo,id", + }); + return new ImageResponse( (
-
-