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 cff1e3ba..ebb34ff7 100644 --- a/apps/readest-app/src/app/api/opds/proxy/route.ts +++ b/apps/readest-app/src/app/api/opds/proxy/route.ts @@ -54,7 +54,6 @@ async function handleRequest(request: NextRequest, method: 'GET' | 'HEAD') { if (!response.ok) { console.error(`[OPDS Proxy] HTTP ${response.status} for ${url}`); if (method === 'HEAD') { - console.log(`[OPDS Proxy] Response headers:`, response.headers); if (response.status === 401) { return new NextResponse(null, { status: 403, diff --git a/apps/readest-app/src/app/opds/page.tsx b/apps/readest-app/src/app/opds/page.tsx index 2ef18182..b9b019cc 100644 --- a/apps/readest-app/src/app/opds/page.tsx +++ b/apps/readest-app/src/app/opds/page.tsx @@ -11,7 +11,6 @@ import { FeedView } from './FeedView'; import { PublicationView } from './PublicationView'; import { SearchView } from './SearchView'; import { Navigation } from './Navigation'; -import { getBaseFilename } from '@/utils/path'; import { downloadFile } from '@/libs/storage'; import { Toast } from '@/components/Toast'; import { useTranslation } from '@/hooks/useTranslation'; @@ -284,7 +283,7 @@ export default function BrowserPage() { return; } else { const ext = parsed?.mediaType ? getFileExtFromMimeType(parsed.mediaType) : ''; - const basename = getBaseFilename(url); + const basename = new URL(url).pathname.replaceAll('/', '_'); const filename = ext ? `${basename}.${ext}` : basename; const dstFilePath = await appService?.resolveFilePath(filename, 'Cache'); if (dstFilePath) { @@ -292,7 +291,9 @@ export default function BrowserPage() { const password = passwordRef.current || ''; const useProxy = needsProxy(url); let downloadUrl = useProxy ? getProxiedURL(url, '', true) : url; - const headers: Record = {}; + const headers: Record = { + 'User-Agent': 'Readest/1.0 (OPDS Browser)', + }; if (username || password) { const authHeader = await probeAuth(url, username, password, useProxy); if (authHeader) {