yiekheng dea57e6b28 Drop R2 URL signing; serve images via custom domain
Images now load direct from images.04080616.xyz. Removes read-side
signing (signUrl/signCoverUrls + callers), unlocking browser and
edge caching since URLs are stable. Presigned upload kept for /api/upload.
PageReader retries failed loads via onError as a safety net.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 19:29:11 +08:00

32 lines
731 B
TypeScript

import { prisma } from "@/lib/db";
import { withGuards } from "@/lib/api-guards";
export const GET = withGuards(
{ rateLimit: { key: "search", limit: 30, windowMs: 60_000 } },
async (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(results);
}
);