feat: Revamp EPUB import process with batch upload support and enhanced API integration
Build and Push Reader Image / docker (push) Failing after 22s
Build and Push Reader Image / docker (push) Failing after 22s
- Introduced a new batch import client for handling multiple EPUB files simultaneously. - Updated API routes for previewing and importing EPUB files, improving error handling and response management. - Enhanced genre management during import, allowing for dynamic creation and association of genres. - Implemented long-fetch handling to accommodate lengthy processing times for large EPUB files. - Refined UI components for better user experience in the import workflow.
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import { NextRequest, NextResponse } from "next/server"
|
||||
import { AUTH_COOKIE_NAME } from "@/lib/auth-cookie"
|
||||
import { readerApiLongFetch } from "@/lib/reader-api-long-fetch"
|
||||
|
||||
export const runtime = "nodejs"
|
||||
export const dynamic = "force-dynamic"
|
||||
/** Import EPUB nhiều chương + ghi NAS chậm có thể kéo dài nhiều phút (đặc biệt khi Next làm proxy BFF). */
|
||||
export const maxDuration = 900
|
||||
|
||||
const readerApiOrigin = (process.env.READER_API_ORIGIN || "http://localhost:8000").replace(/\/+$/, "")
|
||||
|
||||
@@ -21,13 +24,13 @@ async function proxyToReaderApi(req: NextRequest, path: string[]) {
|
||||
}
|
||||
|
||||
const isBodyMethod = req.method !== "GET" && req.method !== "HEAD"
|
||||
const upstream = await fetch(targetUrl, {
|
||||
const upstream = await readerApiLongFetch(targetUrl, {
|
||||
method: req.method,
|
||||
headers,
|
||||
body: isBodyMethod ? req.body : undefined,
|
||||
cache: "no-store",
|
||||
duplex: "half",
|
||||
} as any)
|
||||
})
|
||||
|
||||
return new NextResponse(upstream.body, {
|
||||
status: upstream.status,
|
||||
|
||||
Reference in New Issue
Block a user