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

42 lines
980 B
TypeScript

import { prisma } from "@/lib/db";
import { withGuards } from "@/lib/api-guards";
export const GET = withGuards(
{ rateLimit: { key: "manga-list", limit: 30, windowMs: 60_000 } },
async () => {
const manga = await prisma.manga.findMany({
orderBy: { updatedAt: "desc" },
include: {
_count: { select: { chapters: true } },
},
});
return Response.json(manga);
}
);
export const POST = withGuards({}, async (request) => {
const body = await request.json();
const { title, description, coverUrl, slug, status } = body;
if (!title || !description || !coverUrl || !slug) {
return Response.json(
{ error: "Missing required fields: title, description, coverUrl, slug" },
{ status: 400 }
);
}
const manga = await prisma.manga.create({
data: {
title,
description,
coverUrl,
slug,
status: status || "PUBLISHED",
},
});
return Response.json(manga, { status: 201 });
});