import { fetchUrlMeta } from "#server/service/collection"; import { z } from "zod"; const fetchSchema = z.object({ url: z.string().url() }); export default defineWrappedResponseHandler({ auth: "required" }, async (event) => { const body = await readBody(event); const parsed = fetchSchema.safeParse(body); if (!parsed.success) return R.error("请输入有效的 URL", null); const meta = await fetchUrlMeta(parsed.data.url); return R.success(meta); });