mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-27 03:31:46 +00:00
69 lines
No EOL
1.7 KiB
JavaScript
69 lines
No EOL
1.7 KiB
JavaScript
const { CoverDestination, BookCoverAspectRatio, BookshelfView } = require('../utils/constants')
|
|
const Logger = require('../Logger')
|
|
const User = require('./User')
|
|
|
|
const defaultSettings = {
|
|
oidc: {
|
|
issuer: process.env.OIDC_ISSUER || '',
|
|
authorizationURL: process.env.OIDC_AUTHORIZATION_URL || '',
|
|
tokenURL: process.env.OIDC_TOKEN_URL || '',
|
|
userInfoURL: process.env.OIDC_USER_INFO_URL || '',
|
|
clientID: process.env.OIDC_CLIENT_ID || '',
|
|
clientSecret: process.env.OIDC_CLIENT_SECRET || '',
|
|
callbackURL: "/oidc/callback",
|
|
scope: "openid email profile"
|
|
},
|
|
user: {
|
|
createNewUser: false,
|
|
isActive: true,
|
|
userSettings: {
|
|
mobileOrderBy: 'recent',
|
|
mobileOrderDesc: true,
|
|
mobileFilterBy: 'all',
|
|
orderBy: 'book.title',
|
|
orderDesc: false,
|
|
filterBy: 'all',
|
|
playbackRate: 1,
|
|
bookshelfCoverSize: 120,
|
|
collapseSeries: false
|
|
},
|
|
permissions: {
|
|
download: false,
|
|
update: false,
|
|
delete: false,
|
|
upload: false,
|
|
accessAllLibraries: false
|
|
}
|
|
}
|
|
}
|
|
|
|
class SSOSettings {
|
|
constructor(settings = defaultSettings) {
|
|
this.id = 'sso-settings'
|
|
this.oidc = { ...settings.oidc }
|
|
this.user = { ...settings.user }
|
|
}
|
|
|
|
toJSON() {
|
|
return {
|
|
id: this.id,
|
|
oidc: { ...this.oidc },
|
|
user: { ...this.user }
|
|
}
|
|
}
|
|
|
|
update(payload) {
|
|
let hasUpdates = false
|
|
for (const key in payload) {
|
|
for (const setting in payload) {
|
|
if (!this[key] || this[key][setting] === payload[key][setting]) {
|
|
continue
|
|
}
|
|
this[key][setting] = payload[key][setting]
|
|
hasUpdates = true
|
|
}
|
|
}
|
|
return hasUpdates
|
|
}
|
|
}
|
|
module.exports = SSOSettings |