mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-28 11:40:32 +02:00
Merge branch 'master' into server/respond-with-objects
This commit is contained in:
commit
5c31687a0f
36 changed files with 322 additions and 247 deletions
|
@ -1,3 +1,4 @@
|
|||
const fs = require('../libs/fsExtra')
|
||||
const Logger = require('../Logger')
|
||||
const SocketAuthority = require('../SocketAuthority')
|
||||
|
||||
|
@ -178,7 +179,15 @@ class LibraryItemController {
|
|||
|
||||
// GET api/items/:id/cover
|
||||
async getCover(req, res) {
|
||||
let { query: { width, height, format }, libraryItem } = req
|
||||
const { query: { width, height, format, raw }, libraryItem } = req
|
||||
|
||||
if (raw) { // any value
|
||||
if (!libraryItem.media.coverPath || !await fs.pathExists(libraryItem.media.coverPath)) {
|
||||
return res.sendStatus(404)
|
||||
}
|
||||
|
||||
return res.sendFile(libraryItem.media.coverPath)
|
||||
}
|
||||
|
||||
const options = {
|
||||
format: format || (reqSupportsWebp(req) ? 'webp' : 'jpeg'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue