opds: улучшено скачивание для не-fb2 форматов файлов (djvu, pdf и пр.)
This commit is contained in:
@@ -130,15 +130,15 @@ class BookPage extends BasePage {
|
|||||||
|
|
||||||
//format
|
//format
|
||||||
const ext = bookInfo.book.ext;
|
const ext = bookInfo.book.ext;
|
||||||
let fileFormat = `${ext}+zip`;
|
const formats = {
|
||||||
let downHref = bookInfo.link;
|
[`${ext}+zip`]: `${bookInfo.link}/zip`,
|
||||||
|
[ext]: bookInfo.link,
|
||||||
|
};
|
||||||
|
|
||||||
if (ext === 'mobi') {
|
if (ext === 'mobi') {
|
||||||
fileFormat = 'x-mobipocket-ebook';
|
formats['x-mobipocket-ebook'] = bookInfo.link;
|
||||||
} else if (ext == 'epub') {
|
} else if (ext == 'epub') {
|
||||||
//
|
formats[`${ext}+zip`] = bookInfo.link;
|
||||||
} else {
|
|
||||||
downHref = `${bookInfo.link}/zip`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//entry
|
//entry
|
||||||
@@ -153,7 +153,7 @@ class BookPage extends BasePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
e['dc:language'] = bookInfo.book.lang;
|
e['dc:language'] = bookInfo.book.lang;
|
||||||
e['dc:format'] = fileFormat;
|
e['dc:format'] = ext;
|
||||||
|
|
||||||
//genre
|
//genre
|
||||||
const genre = bookInfo.book.genre.split(',');
|
const genre = bookInfo.book.genre.split(',');
|
||||||
@@ -200,7 +200,10 @@ class BookPage extends BasePage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//links
|
//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) {
|
if (bookInfo.cover) {
|
||||||
let coverType = 'image/jpeg';
|
let coverType = 'image/jpeg';
|
||||||
if (path.extname(bookInfo.cover) == '.png')
|
if (path.extname(bookInfo.cover) == '.png')
|
||||||
|
|||||||
Reference in New Issue
Block a user