mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-07 16:04:54 +02:00
Add: api endpoint for starting streams for android auto support
This commit is contained in:
parent
2451861e0e
commit
663d02e9fe
5 changed files with 58 additions and 22 deletions
|
@ -57,6 +57,7 @@ class ApiController {
|
|||
this.router.post('/audiobook/:id/cover', this.uploadAudiobookCover.bind(this))
|
||||
this.router.patch('/audiobook/:id/coverfile', this.updateAudiobookCoverFromFile.bind(this))
|
||||
this.router.get('/audiobook/:id/match', this.matchAudiobookBook.bind(this))
|
||||
this.router.get('/audiobook/:id/stream', this.openAudiobookStream.bind(this))
|
||||
this.router.patch('/audiobook/:id', this.updateAudiobook.bind(this))
|
||||
|
||||
this.router.patch('/match/:id', this.match.bind(this))
|
||||
|
@ -541,6 +542,13 @@ class ApiController {
|
|||
res.json(results)
|
||||
}
|
||||
|
||||
async openAudiobookStream(req, res) {
|
||||
var audiobook = this.db.audiobooks.find(a => a.id === req.params.id)
|
||||
if (!audiobook) return res.sendStatus(404)
|
||||
|
||||
this.streamManager.openStreamApiRequest(res, req.user, audiobook)
|
||||
}
|
||||
|
||||
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