Remove sharp in favor of ffmpeg, fallback to cover

This commit is contained in:
Keagan Hilliard 2021-12-13 11:29:31 -08:00
parent 9452d0eca9
commit d6ae50f89a
5 changed files with 42 additions and 34 deletions

View file

@ -234,7 +234,7 @@ class BookController {
async getCover(req, res) {
let { query: { width, height, format }, params: { id } } = req
var audiobook = this.db.audiobooks.find(a => a.id === id)
if (!audiobook || !audiobook.book.coverFullPath) return res.sendStatus(404)
if (!audiobook || (!audiobook.book.coverFullPath && !audiobook.book.cover)) return res.sendStatus(404)
// Check user can access this audiobooks library
if (!req.user.checkCanAccessLibrary(audiobook.libraryId)) {
@ -242,7 +242,7 @@ class BookController {
}
const options = {
format: format || (reqSupportsWebp(req) ? 'webp' : 'jpg'),
format: format || (reqSupportsWebp(req) ? 'webp' : 'jpeg'),
height: height ? parseInt(height) : null,
width: width ? parseInt(width) : null
}