mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-07 16:04:54 +02:00
change color of book read icon #105, basic .pdf reader #107, fix: cover path updating properly #102, step forward/backward from book edit modal #100, add all files tab to edit modal #99, select input auto submit on blur #98
This commit is contained in:
parent
315592efe5
commit
03963aa9a1
27 changed files with 545 additions and 54 deletions
|
@ -47,6 +47,7 @@ class ApiController {
|
|||
this.router.delete('/audiobook/:id', this.deleteAudiobook.bind(this))
|
||||
this.router.patch('/audiobook/:id/tracks', this.updateAudiobookTracks.bind(this))
|
||||
this.router.post('/audiobook/:id/cover', this.uploadAudiobookCover.bind(this))
|
||||
this.router.patch('/audiobook/:id/coverfile', this.updateAudiobookCoverFromFile.bind(this))
|
||||
this.router.patch('/audiobook/:id', this.updateAudiobook.bind(this))
|
||||
|
||||
this.router.patch('/match/:id', this.match.bind(this))
|
||||
|
@ -445,6 +446,26 @@ class ApiController {
|
|||
})
|
||||
}
|
||||
|
||||
async updateAudiobookCoverFromFile(req, res) {
|
||||
if (!req.user.canUpdate) {
|
||||
Logger.warn('User attempted to update without permission', req.user)
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
var audiobook = this.db.audiobooks.find(a => a.id === req.params.id)
|
||||
if (!audiobook) return res.sendStatus(404)
|
||||
|
||||
var coverFile = req.body
|
||||
var updated = await audiobook.setCoverFromFile(coverFile)
|
||||
|
||||
if (updated) {
|
||||
await this.db.updateAudiobook(audiobook)
|
||||
this.emitter('audiobook_updated', audiobook.toJSONMinified())
|
||||
}
|
||||
|
||||
if (updated) res.status(200).send('Cover updated successfully')
|
||||
else res.status(200).send('No update was made to cover')
|
||||
}
|
||||
|
||||
async updateAudiobook(req, res) {
|
||||
if (!req.user.canUpdate) {
|
||||
Logger.warn('User attempted to update without permission', req.user)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue