mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-04-24 22:47:09 -04:00
Moving settings to be user specific, adding playbackRate setting, update playbackRate picker to go up to 3x
This commit is contained in:
parent
2548aba840
commit
f83c5dd440
22 changed files with 247 additions and 103 deletions
|
@ -1,5 +1,6 @@
|
|||
const express = require('express')
|
||||
const Logger = require('./Logger')
|
||||
const { isObject } = require('./utils/index')
|
||||
|
||||
class ApiController {
|
||||
constructor(db, scanner, auth, streamManager, rssFeeds, emitter) {
|
||||
|
@ -32,6 +33,7 @@ class ApiController {
|
|||
this.router.get('/users', this.getUsers.bind(this))
|
||||
this.router.delete('/user/audiobook/:id', this.resetUserAudiobookProgress.bind(this))
|
||||
this.router.patch('/user/password', this.userChangePassword.bind(this))
|
||||
this.router.patch('/user/settings', this.userUpdateSettings.bind(this))
|
||||
|
||||
this.router.post('/authorize', this.authorize.bind(this))
|
||||
|
||||
|
@ -185,6 +187,21 @@ class ApiController {
|
|||
res.json(feed)
|
||||
}
|
||||
|
||||
async userUpdateSettings(req, res) {
|
||||
var settingsUpdate = req.body
|
||||
if (!settingsUpdate || !isObject(settingsUpdate)) {
|
||||
return res.sendStatus(500)
|
||||
}
|
||||
var madeUpdates = req.user.updateSettings(settingsUpdate)
|
||||
if (madeUpdates) {
|
||||
await this.db.updateEntity('user', req.user)
|
||||
}
|
||||
return res.json({
|
||||
success: true,
|
||||
settings: req.user.settings
|
||||
})
|
||||
}
|
||||
|
||||
getGenres(req, res) {
|
||||
res.json({
|
||||
genres: this.db.getGenres()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue