diff --git a/apps/readest-app/src/app/api/opds/proxy/route.ts b/apps/readest-app/src/app/api/opds/proxy/route.ts index efeaabf7..c7b9b74b 100644 --- a/apps/readest-app/src/app/api/opds/proxy/route.ts +++ b/apps/readest-app/src/app/api/opds/proxy/route.ts @@ -134,11 +134,25 @@ async function handleRequest(request: NextRequest, method: 'GET' | 'HEAD') { const buf = await response.arrayBuffer(); const length = buf.byteLength; console.log(`[OPDS Proxy] Success: ${url} (${length} bytes)`); + const excludedHeaders = new Set([ + 'content-encoding', + 'content-length', + 'transfer-encoding', + 'connection', + 'keep-alive', + ]); + + const proxyHeaders: Record = {}; + for (const [key, value] of response.headers.entries()) { + if (!excludedHeaders.has(key.toLowerCase())) { + proxyHeaders[key] = value; + } + } return new NextResponse(buf, { status: 200, headers: { - ...Object.fromEntries(response.headers.entries()), + ...proxyHeaders, 'Content-Type': contentType, 'Content-Length': length.toString(), 'Cache-Control': 'public, max-age=300', diff --git a/apps/readest-app/src/app/opds/components/PublicationCard.tsx b/apps/readest-app/src/app/opds/components/PublicationCard.tsx index a536c9f5..3c6584f4 100644 --- a/apps/readest-app/src/app/opds/components/PublicationCard.tsx +++ b/apps/readest-app/src/app/opds/components/PublicationCard.tsx @@ -45,9 +45,12 @@ export function PublicationCard({ const imageUrl = imageLink ? resolveURL(imageLink.href, baseURL) : null; const authors = useMemo(() => { - return publication.metadata?.author - ?.map((author) => (typeof author === 'string' ? author : author.name)) - .join(', '); + const author = publication.metadata?.author; + if (!author) return undefined; + + const authorList = Array.isArray(author) ? author : [author]; + + return authorList.map((a) => (typeof a === 'string' ? a : a?.name)).filter(Boolean); }, [publication.metadata?.author]); const price = useMemo(() => { @@ -83,7 +86,9 @@ export function PublicationCard({

{publication.metadata?.title || 'Untitled'}

- {authors &&

{authors}

} + {authors && authors.length > 0 && ( +

{authors.join(', ')}

+ )} {price && (
{price}
diff --git a/apps/readest-app/src/app/opds/components/PublicationView.tsx b/apps/readest-app/src/app/opds/components/PublicationView.tsx index 435a77f2..3343693d 100644 --- a/apps/readest-app/src/app/opds/components/PublicationView.tsx +++ b/apps/readest-app/src/app/opds/components/PublicationView.tsx @@ -56,9 +56,12 @@ export function PublicationView({ const imageUrl = coverImage ? resolveURL(coverImage.href, baseURL) : null; const authors = useMemo(() => { - return publication.metadata?.author?.map((author) => - typeof author === 'string' ? author : author.name, - ); + const author = publication.metadata?.author; + if (!author) return undefined; + + const authorList = Array.isArray(author) ? author : [author]; + + return authorList.map((a) => (typeof a === 'string' ? a : a?.name)).filter(Boolean); }, [publication.metadata?.author]); const acquisitionLinks = useMemo(() => { @@ -162,9 +165,9 @@ export function PublicationView({ ) : (