diff --git a/server/core/opds/BookPage.js b/server/core/opds/BookPage.js index 7ec2b31..72ea59e 100644 --- a/server/core/opds/BookPage.js +++ b/server/core/opds/BookPage.js @@ -130,15 +130,15 @@ class BookPage extends BasePage { //format const ext = bookInfo.book.ext; - let fileFormat = `${ext}+zip`; - let downHref = bookInfo.link; + const formats = { + [`${ext}+zip`]: `${bookInfo.link}/zip`, + [ext]: bookInfo.link, + }; if (ext === 'mobi') { - fileFormat = 'x-mobipocket-ebook'; + formats['x-mobipocket-ebook'] = bookInfo.link; } else if (ext == 'epub') { - // - } else { - downHref = `${bookInfo.link}/zip`; + formats[`${ext}+zip`] = bookInfo.link; } //entry @@ -153,7 +153,7 @@ class BookPage extends BasePage { } e['dc:language'] = bookInfo.book.lang; - e['dc:format'] = fileFormat; + e['dc:format'] = ext; //genre const genre = bookInfo.book.genre.split(','); @@ -200,7 +200,10 @@ class BookPage extends BasePage { } //links - e.link = [ this.downLink({href: downHref, type: `application/${fileFormat}`}) ]; + e.link = []; + for (const [fileFormat, downHref] of Object.entries(formats)) + e.link.push(this.downLink({href: downHref, type: `application/${fileFormat}`})); + if (bookInfo.cover) { let coverType = 'image/jpeg'; if (path.extname(bookInfo.cover) == '.png')