- Sign all image URLs server-side with 60s expiry presigned URLs - Add /api/pages endpoint for batched page fetching (7 per batch) - PageReader prefetches next batch when user scrolls to 3rd page - Move chapter count badge outside overflow-hidden for 3D effect - Fix missing URL signing on search and genre pages - Extract signCoverUrls helper to reduce duplication - Clamp API limit param to prevent abuse Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
629 B
TypeScript
29 lines
629 B
TypeScript
import { prisma } from "@/lib/db";
|
|
import { signCoverUrls } from "@/lib/r2";
|
|
|
|
export async function GET(request: Request) {
|
|
const { searchParams } = new URL(request.url);
|
|
const q = searchParams.get("q")?.trim();
|
|
|
|
if (!q || q.length < 2) {
|
|
return Response.json([]);
|
|
}
|
|
|
|
const results = await prisma.manga.findMany({
|
|
where: {
|
|
status: "PUBLISHED",
|
|
title: { contains: q, mode: "insensitive" },
|
|
},
|
|
select: {
|
|
id: true,
|
|
title: true,
|
|
slug: true,
|
|
coverUrl: true,
|
|
},
|
|
take: 8,
|
|
orderBy: { title: "asc" },
|
|
});
|
|
|
|
return Response.json(await signCoverUrls(results));
|
|
}
|