mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-27 03:31:46 +00:00
Move server settings and SSO settings to settings.js module & cleanup sso.vue
This commit is contained in:
parent
5060e0b728
commit
c34a518754
21 changed files with 132 additions and 283 deletions
|
|
@ -56,7 +56,7 @@ export default {
|
||||||
return coverSize
|
return coverSize
|
||||||
},
|
},
|
||||||
coverAspectRatio() {
|
coverAspectRatio() {
|
||||||
return this.$store.getters['getServerSetting']('coverAspectRatio')
|
return this.$store.getters['settings/getServerSetting']('coverAspectRatio')
|
||||||
},
|
},
|
||||||
isCoverSquareAspectRatio() {
|
isCoverSquareAspectRatio() {
|
||||||
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE
|
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE
|
||||||
|
|
|
||||||
|
|
@ -109,10 +109,10 @@ export default {
|
||||||
return this.$store.getters['user/getUserSetting']('collapseSeries')
|
return this.$store.getters['user/getUserSetting']('collapseSeries')
|
||||||
},
|
},
|
||||||
coverAspectRatio() {
|
coverAspectRatio() {
|
||||||
return this.$store.getters['getServerSetting']('coverAspectRatio')
|
return this.$store.getters['settings/getServerSetting']('coverAspectRatio')
|
||||||
},
|
},
|
||||||
bookshelfView() {
|
bookshelfView() {
|
||||||
return this.$store.getters['getServerSetting']('bookshelfView')
|
return this.$store.getters['settings/getServerSetting']('bookshelfView')
|
||||||
},
|
},
|
||||||
isCoverSquareAspectRatio() {
|
isCoverSquareAspectRatio() {
|
||||||
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE
|
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
coverAspectRatio() {
|
coverAspectRatio() {
|
||||||
return this.$store.getters['getServerSetting']('coverAspectRatio')
|
return this.$store.getters['settings/getServerSetting']('coverAspectRatio')
|
||||||
},
|
},
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
return this.$store.getters['getBookCoverAspectRatio']
|
return this.$store.getters['settings/getBookCoverAspectRatio']
|
||||||
},
|
},
|
||||||
coverWidth() {
|
coverWidth() {
|
||||||
if (this.bookCoverAspectRatio === 1) return 50 * 1.2
|
if (this.bookCoverAspectRatio === 1) return 50 * 1.2
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
return this.$store.getters['getBookCoverAspectRatio']
|
return this.$store.getters['settings/getBookCoverAspectRatio']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {},
|
methods: {},
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
return this.$store.getters['getBookCoverAspectRatio']
|
return this.$store.getters['settings/getBookCoverAspectRatio']
|
||||||
},
|
},
|
||||||
collection() {
|
collection() {
|
||||||
return this.$store.state.globals.selectedCollection || {}
|
return this.$store.state.globals.selectedCollection || {}
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
coverAspectRatio() {
|
coverAspectRatio() {
|
||||||
return this.$store.getters['getServerSetting']('coverAspectRatio')
|
return this.$store.getters['settings/getServerSetting']('coverAspectRatio')
|
||||||
},
|
},
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
return this.$store.getters['getBookCoverAspectRatio']
|
return this.$store.getters['settings/getBookCoverAspectRatio']
|
||||||
},
|
},
|
||||||
providers() {
|
providers() {
|
||||||
return this.$store.state.scanners.providers
|
return this.$store.state.scanners.providers
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
coverAspectRatio() {
|
coverAspectRatio() {
|
||||||
return this.$store.getters['getServerSetting']('coverAspectRatio')
|
return this.$store.getters['settings/getServerSetting']('coverAspectRatio')
|
||||||
},
|
},
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
||||||
|
|
|
||||||
|
|
@ -110,10 +110,10 @@ export default {
|
||||||
this.$store.commit('user/setSettings', payload.user.settings)
|
this.$store.commit('user/setSettings', payload.user.settings)
|
||||||
}
|
}
|
||||||
if (payload.serverSettings) {
|
if (payload.serverSettings) {
|
||||||
this.$store.commit('setServerSettings', payload.serverSettings)
|
this.$store.commit('settings/setServerSettings', payload.serverSettings)
|
||||||
}
|
}
|
||||||
if (payload.SSOSettings) {
|
if (payload.SSOSettings) {
|
||||||
this.$store.commit('sso/setSSOSettings', payload.SSOSettings)
|
this.$store.commit('settings/setSSOSettings', payload.SSOSettings)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start scans currently running
|
// Start scans currently running
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
coverAspectRatio() {
|
coverAspectRatio() {
|
||||||
return this.$store.getters['getServerSetting']('coverAspectRatio')
|
return this.$store.getters['settings/getServerSetting']('coverAspectRatio')
|
||||||
},
|
},
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
coverAspectRatio() {
|
coverAspectRatio() {
|
||||||
return this.$store.getters['getServerSetting']('coverAspectRatio')
|
return this.$store.getters['settings/getServerSetting']('coverAspectRatio')
|
||||||
},
|
},
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
return this.$store.getters['getBookCoverAspectRatio']
|
return this.$store.getters['settings/getBookCoverAspectRatio']
|
||||||
},
|
},
|
||||||
streamAudiobook() {
|
streamAudiobook() {
|
||||||
return this.$store.state.streamAudiobook
|
return this.$store.state.streamAudiobook
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ export default {
|
||||||
return 'Runs at 1am every day (your server time). Saved in /metadata/backups.'
|
return 'Runs at 1am every day (your server time). Saved in /metadata/backups.'
|
||||||
},
|
},
|
||||||
serverSettings() {
|
serverSettings() {
|
||||||
return this.$store.state.serverSettings
|
return this.$store.state.settings.serverSettings
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -66,7 +66,7 @@ export default {
|
||||||
updateServerSettings(payload) {
|
updateServerSettings(payload) {
|
||||||
this.updatingServerSettings = true
|
this.updatingServerSettings = true
|
||||||
this.$store
|
this.$store
|
||||||
.dispatch('updateServerSettings', payload)
|
.dispatch('settings/updateServerSettings', payload)
|
||||||
.then((success) => {
|
.then((success) => {
|
||||||
console.log('Updated Server Settings', success)
|
console.log('Updated Server Settings', success)
|
||||||
this.updatingServerSettings = false
|
this.updatingServerSettings = false
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
serverSettings() {
|
||||||
|
return this.$store.state.settings.serverSettings
|
||||||
|
},
|
||||||
scannerPreferAudioMetaTooltip() {
|
scannerPreferAudioMetaTooltip() {
|
||||||
return 'Audio file ID3 meta tags will be used for book details over folder names'
|
return 'Audio file ID3 meta tags will be used for book details over folder names'
|
||||||
},
|
},
|
||||||
|
|
@ -135,9 +138,6 @@ export default {
|
||||||
experimentalFeaturesTooltip() {
|
experimentalFeaturesTooltip() {
|
||||||
return 'Features in development that could use your feedback and help testing.'
|
return 'Features in development that could use your feedback and help testing.'
|
||||||
},
|
},
|
||||||
serverSettings() {
|
|
||||||
return this.$store.state.serverSettings
|
|
||||||
},
|
|
||||||
parseSubtitleTooltip() {
|
parseSubtitleTooltip() {
|
||||||
return 'Extract subtitles from audiobook directory names.<br>Subtitle must be seperated by " - "<br>i.e. "Book Title - A Subtitle Here" has the subtitle "A Subtitle Here"'
|
return 'Extract subtitles from audiobook directory names.<br>Subtitle must be seperated by " - "<br>i.e. "Book Title - A Subtitle Here" has the subtitle "A Subtitle Here"'
|
||||||
},
|
},
|
||||||
|
|
@ -210,7 +210,7 @@ export default {
|
||||||
updateServerSettings(payload) {
|
updateServerSettings(payload) {
|
||||||
this.updatingServerSettings = true
|
this.updatingServerSettings = true
|
||||||
this.$store
|
this.$store
|
||||||
.dispatch('updateServerSettings', payload)
|
.dispatch('settings/updateServerSettings', payload)
|
||||||
.then((success) => {
|
.then((success) => {
|
||||||
console.log('Updated Server Settings', success)
|
console.log('Updated Server Settings', success)
|
||||||
this.updatingServerSettings = false
|
this.updatingServerSettings = false
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
serverSettings() {
|
serverSettings() {
|
||||||
return this.$store.state.serverSettings
|
return this.$store.state.settings.serverSettings
|
||||||
},
|
},
|
||||||
streamAudiobook() {
|
streamAudiobook() {
|
||||||
return this.$store.state.streamAudiobook
|
return this.$store.state.streamAudiobook
|
||||||
|
|
@ -124,7 +124,7 @@ export default {
|
||||||
},
|
},
|
||||||
updateServerSettings(payload) {
|
updateServerSettings(payload) {
|
||||||
this.$store
|
this.$store
|
||||||
.dispatch('updateServerSettings', payload)
|
.dispatch('settings/updateServerSettings', payload)
|
||||||
.then((success) => {
|
.then((success) => {
|
||||||
console.log('Updated Server Settings', success)
|
console.log('Updated Server Settings', success)
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!-- <div class="h-0.5 bg-primary bg-opacity-50 w-full" /> -->
|
|
||||||
|
|
||||||
<div class="bg-bg rounded-md shadow-lg border border-white border-opacity-5 p-4 mb-8">
|
<div class="bg-bg rounded-md shadow-lg border border-white border-opacity-5 p-4 mb-8">
|
||||||
<div class="flex items-center mb-2">
|
<div class="flex items-center mb-2">
|
||||||
<h1 class="text-xl">SSO Provider Settings</h1>
|
<h1 class="text-xl">SSO Provider Settings</h1>
|
||||||
|
|
@ -9,32 +7,32 @@
|
||||||
|
|
||||||
<div class="flex items-center py-2">
|
<div class="flex items-center py-2">
|
||||||
<p class="pl-4 text-lg">Issuer </p>
|
<p class="pl-4 text-lg">Issuer </p>
|
||||||
<ui-text-input v-model="issuer" :disabled="updatingSSOSettings" />
|
<ui-text-input v-model="oidc.issuer" :disabled="updatingSSOSettings" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center py-2">
|
<div class="flex items-center py-2">
|
||||||
<p class="pl-4 text-lg">Authorization URL </p>
|
<p class="pl-4 text-lg">Authorization URL </p>
|
||||||
<ui-text-input v-model="authorizationURL" :disabled="updatingSSOSettings" />
|
<ui-text-input v-model="oidc.authorizationURL" :disabled="updatingSSOSettings" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center py-2">
|
<div class="flex items-center py-2">
|
||||||
<p class="pl-4 text-lg">Token URL </p>
|
<p class="pl-4 text-lg">Token URL </p>
|
||||||
<ui-text-input v-model="tokenURL" :disabled="updatingSSOSettings" />
|
<ui-text-input v-model="oidc.tokenURL" :disabled="updatingSSOSettings" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center py-2">
|
<div class="flex items-center py-2">
|
||||||
<p class="pl-4 text-lg">User Info URL </p>
|
<p class="pl-4 text-lg">User Info URL </p>
|
||||||
<ui-text-input v-model="userInfoURL" :disabled="updatingSSOSettings" />
|
<ui-text-input v-model="oidc.userInfoURL" :disabled="updatingSSOSettings" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center py-2">
|
<div class="flex items-center py-2">
|
||||||
<p class="pl-4 text-lg">Client ID </p>
|
<p class="pl-4 text-lg">Client ID </p>
|
||||||
<ui-text-input v-model="clientID" :disabled="updatingSSOSettings" />
|
<ui-text-input v-model="oidc.clientID" :disabled="updatingSSOSettings" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center py-2">
|
<div class="flex items-center py-2">
|
||||||
<p class="pl-4 text-lg">Client Secret </p>
|
<p class="pl-4 text-lg">Client Secret </p>
|
||||||
<ui-text-input type="password" v-model="clientSecret" :disabled="updatingSSOSettings" />
|
<ui-text-input type="password" v-model="oidc.clientSecret" :disabled="updatingSSOSettings" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center mb-2">
|
<div class="flex items-center mb-2">
|
||||||
|
|
@ -42,32 +40,32 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center mb-2">
|
<div class="flex items-center mb-2">
|
||||||
<ui-toggle-switch v-model="createNewUser" :disabled="updatingSSOSettings" />
|
<ui-toggle-switch v-model="user.createNewUser" :disabled="updatingSSOSettings" />
|
||||||
<p class="pl-4 text-lg">Create a new user on first login</p>
|
<p class="pl-4 text-lg">Create a new user on first login</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center mb-2">
|
<div class="flex items-center mb-2">
|
||||||
<ui-toggle-switch v-model="permissionDownload" :disabled="updatingSSOSettings || !createNewUser" />
|
<ui-toggle-switch v-model="permissionDownload" :disabled="updatingSSOSettings || !user.createNewUser" />
|
||||||
<p class="pl-4 text-lg">The new user is allowed to download</p>
|
<p class="pl-4 text-lg">The new user is allowed to download</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center mb-2">
|
<div class="flex items-center mb-2">
|
||||||
<ui-toggle-switch v-model="permissionUpdate" :disabled="updatingSSOSettings || !createNewUser" />
|
<ui-toggle-switch v-model="permissionUpdate" :disabled="updatingSSOSettings || !user.createNewUser" />
|
||||||
<p class="pl-4 text-lg">The new user is allowed to update</p>
|
<p class="pl-4 text-lg">The new user is allowed to update</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center mb-2">
|
<div class="flex items-center mb-2">
|
||||||
<ui-toggle-switch v-model="permissionDelete" :disabled="updatingSSOSettings || !createNewUser" />
|
<ui-toggle-switch v-model="permissionDelete" :disabled="updatingSSOSettings || !user.createNewUser" />
|
||||||
<p class="pl-4 text-lg">The new user is allowed to delete</p>
|
<p class="pl-4 text-lg">The new user is allowed to delete</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center mb-2">
|
<div class="flex items-center mb-2">
|
||||||
<ui-toggle-switch v-model="permissionUpload" :disabled="updatingSSOSettings || !createNewUser" />
|
<ui-toggle-switch v-model="permissionUpload" :disabled="updatingSSOSettings || !user.createNewUser" />
|
||||||
<p class="pl-4 text-lg">The new user is allowed to upload</p>
|
<p class="pl-4 text-lg">The new user is allowed to upload</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-center mb-2">
|
<div class="flex items-center mb-2">
|
||||||
<ui-toggle-switch v-model="permissionAccessAllLibraries" :disabled="updatingSSOSettings || !createNewUser" />
|
<ui-toggle-switch v-model="permissionAccessAllLibraries" :disabled="updatingSSOSettings || !user.createNewUser" />
|
||||||
<p class="pl-4 text-lg">The new user is allowed to access all libraries</p>
|
<p class="pl-4 text-lg">The new user is allowed to access all libraries</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -83,12 +81,12 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
oidc: {
|
oidc: {
|
||||||
issuer: "",
|
issuer: '',
|
||||||
authorizationURL: "",
|
authorizationURL: '',
|
||||||
tokenURL: "",
|
tokenURL: '',
|
||||||
userInfoURL: "",
|
userInfoURL: '',
|
||||||
clientID: "",
|
clientID: '',
|
||||||
clientSecret: "",
|
clientSecret: ''
|
||||||
},
|
},
|
||||||
user: {
|
user: {
|
||||||
createNewUser: false,
|
createNewUser: false,
|
||||||
|
|
@ -112,178 +110,103 @@ export default {
|
||||||
accessAllLibraries: false
|
accessAllLibraries: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updatingSSOSettings: false,
|
updatingSSOSettings: false
|
||||||
newSSOSettings: {}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
SSOSettings(newVal, oldVal) {
|
SSOSettings(newVal, oldVal) {
|
||||||
|
console.log('SSO Settings set', newVal, oldVal)
|
||||||
if (newVal && !oldVal) {
|
if (newVal && !oldVal) {
|
||||||
this.newSSOSettings = { ...this.SSOSettings }
|
|
||||||
this.initSSOSettings()
|
this.initSSOSettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
SSOSettings() {
|
SSOSettings() {
|
||||||
return this.$store.state.sso
|
return this.$store.state.settings.SSOSettings
|
||||||
},
|
|
||||||
|
|
||||||
issuer: {
|
|
||||||
get() {
|
|
||||||
return this.oidc.issuer
|
|
||||||
return this.$store.state.sso.oidc.issuer
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
this.oidc.issuer = val
|
|
||||||
// this.$store.state.sso.oidc.issuer = val
|
|
||||||
}
|
|
||||||
},
|
|
||||||
authorizationURL: {
|
|
||||||
get() {
|
|
||||||
return this.oidc.authorizationURL
|
|
||||||
return this.$store.state.sso.oidc.authorizationURL
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
this.oidc.authorizationURL = val
|
|
||||||
// this.$store.state.sso.oidc.authorizationURL = val
|
|
||||||
}
|
|
||||||
},
|
|
||||||
tokenURL: {
|
|
||||||
get() {
|
|
||||||
return this.oidc.tokenURL
|
|
||||||
return this.$store.state.sso.oidc.tokenURL
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
this.oidc.tokenURL = val
|
|
||||||
// this.$store.state.sso.oidc.tokenURL = val
|
|
||||||
}
|
|
||||||
},
|
|
||||||
userInfoURL: {
|
|
||||||
get() {
|
|
||||||
return this.oidc.userInfoURL
|
|
||||||
return this.$store.state.sso.oidc.userInfoURL
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
this.oidc.userInfoURL = val
|
|
||||||
// this.$store.state.sso.oidc.userInfoURL = val
|
|
||||||
},
|
|
||||||
},
|
|
||||||
clientID: {
|
|
||||||
get() {
|
|
||||||
return this.oidc.clientID
|
|
||||||
return this.$store.state.sso.oidc.clientID
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
this.oidc.clientID = val
|
|
||||||
// this.$store.state.sso.oidc.clientID = val
|
|
||||||
},
|
|
||||||
},
|
|
||||||
clientSecret: {
|
|
||||||
get() {
|
|
||||||
return this.oidc.clientSecret
|
|
||||||
return this.$store.state.sso.oidc.clientSecret
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
this.oidc.clientSecret = val
|
|
||||||
// this.$store.state.sso.oidc.clientSecret = val
|
|
||||||
},
|
|
||||||
},
|
|
||||||
createNewUser: {
|
|
||||||
get() {
|
|
||||||
return this.user.createNewUser
|
|
||||||
return this.$store.state.sso.createNewUser
|
|
||||||
},
|
|
||||||
set(val) {
|
|
||||||
this.user.createNewUser = val
|
|
||||||
// this.$store.state.sso.createNewUser = val
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
permissionDownload: {
|
permissionDownload: {
|
||||||
get() {
|
get() {
|
||||||
return this.user.permissions.download
|
return this.user.permissions.download
|
||||||
return this.$store.state.sso.permissions.download
|
|
||||||
},
|
},
|
||||||
set(val) {
|
set(val) {
|
||||||
this.user.permissions.download = val
|
this.user.permissions.download = val
|
||||||
// this.$store.state.sso.permissions.download = val
|
}
|
||||||
},
|
|
||||||
},
|
},
|
||||||
permissionUpdate: {
|
permissionUpdate: {
|
||||||
get() {
|
get() {
|
||||||
return this.user.permissions.update
|
return this.user.permissions.update
|
||||||
return this.$store.state.sso.permissions.update
|
|
||||||
},
|
},
|
||||||
set(val) {
|
set(val) {
|
||||||
this.user.permissions.update = val
|
this.user.permissions.update = val
|
||||||
// this.$store.state.sso.permissions.update = val
|
}
|
||||||
},
|
|
||||||
},
|
},
|
||||||
permissionDelete: {
|
permissionDelete: {
|
||||||
get() {
|
get() {
|
||||||
return this.user.permissions.delete
|
return this.user.permissions.delete
|
||||||
return this.$store.state.sso.permissions.delete
|
|
||||||
},
|
},
|
||||||
set(val) {
|
set(val) {
|
||||||
this.user.permissions.delete = val
|
this.user.permissions.delete = val
|
||||||
// this.$store.state.sso.permissions.delete = val
|
}
|
||||||
},
|
|
||||||
},
|
},
|
||||||
permissionUpload: {
|
permissionUpload: {
|
||||||
get() {
|
get() {
|
||||||
return this.user.permissions.upload
|
return this.user.permissions.upload
|
||||||
return this.$store.state.sso.permissions.upload
|
|
||||||
},
|
},
|
||||||
set(val) {
|
set(val) {
|
||||||
this.user.permissions.upload = val
|
this.user.permissions.upload = val
|
||||||
// this.$store.state.sso.permissions.upload = val
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
permissionAccessAllLibraries: {
|
permissionAccessAllLibraries: {
|
||||||
get() {
|
get() {
|
||||||
return this.user.permissions.accessAllLibraries
|
return this.user.permissions.accessAllLibraries
|
||||||
return this.$store.state.sso.permissions.accessAllLibraries
|
|
||||||
},
|
},
|
||||||
set(val) {
|
set(val) {
|
||||||
this.user.permissions.accessAllLibraries = val
|
this.user.permissions.accessAllLibraries = val
|
||||||
// this.$store.state.sso.permissions.accessAllLibraries = val
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
saveSSOSettings(payload) {
|
saveSSOSettings() {
|
||||||
this.updatingSSOSettings = true
|
this.updatingSSOSettings = true
|
||||||
this.$store
|
this.$store
|
||||||
.dispatch('sso/updateSSOSettings', {oidc: this.oidc, user: this.user})
|
.dispatch('settings/updateSSOSettings', { oidc: this.oidc, user: this.user })
|
||||||
.then((success) => {
|
.then((payload) => {
|
||||||
|
console.log('Update SSO settings success', payload)
|
||||||
this.updatingSSOSettings = false
|
this.updatingSSOSettings = false
|
||||||
|
this.$toast.success('SSO Settings Saved')
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Failed to update SSO settings', error)
|
console.error('Failed to update SSO settings', error)
|
||||||
this.updatingSSOSettings = false
|
this.updatingSSOSettings = false
|
||||||
|
this.$toast.error('Failed to save SSO Settings')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
initSSOSettings() {
|
initSSOSettings() {
|
||||||
for (const key in this.$store.state.sso.oidc) {
|
if (!this.SSOSettings || !this.SSOSettings.user || !this.SSOSettings.oidc) {
|
||||||
this.oidc[key] = this.$store.state.sso.oidc[key]
|
console.error('Invalid SSOSettings obj', this.SSOSettings)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key in this.$store.state.sso.user) {
|
for (const key in this.SSOSettings.oidc) {
|
||||||
if (typeof this.$store.state.sso.user[key] === "object" && typeof this.user[key] === "object") {
|
this.oidc[key] = this.SSOSettings.oidc[key]
|
||||||
for (const key2 in this.$store.state.sso.user[key]) {
|
}
|
||||||
this.user[key][key2] = this.$store.state.sso.user[key][key2]
|
|
||||||
|
for (const key in this.SSOSettings.user) {
|
||||||
|
if (typeof this.SSOSettings.user[key] === 'object' && typeof this.user[key] === 'object') {
|
||||||
|
for (const key2 in this.SSOSettings.user[key]) {
|
||||||
|
this.user[key][key2] = this.SSOSettings.user[key][key2]
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (this.user[key] !== undefined) {
|
if (this.user[key] !== undefined) {
|
||||||
this.user[key] = this.$store.state.sso.user[key]
|
this.user[key] = this.SSOSettings.user[key]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initSSOSettings()
|
if (this.SSOSettings) this.initSSOSettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
@ -88,7 +88,7 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
coverAspectRatio() {
|
coverAspectRatio() {
|
||||||
return this.$store.getters['getServerSetting']('coverAspectRatio')
|
return this.$store.getters['settings/getServerSetting']('coverAspectRatio')
|
||||||
},
|
},
|
||||||
bookCoverAspectRatio() {
|
bookCoverAspectRatio() {
|
||||||
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
return this.coverAspectRatio === this.$constants.BookCoverAspectRatio.SQUARE ? 1 : 1.6
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ import Vue from 'vue'
|
||||||
|
|
||||||
export const state = () => ({
|
export const state = () => ({
|
||||||
versionData: null,
|
versionData: null,
|
||||||
serverSettings: null,
|
|
||||||
streamAudiobook: null,
|
streamAudiobook: null,
|
||||||
editModalTab: 'details',
|
editModalTab: 'details',
|
||||||
showEditModal: false,
|
showEditModal: false,
|
||||||
|
|
@ -28,14 +27,6 @@ export const getters = {
|
||||||
getIsAudiobookSelected: state => audiobookId => {
|
getIsAudiobookSelected: state => audiobookId => {
|
||||||
return !!state.selectedAudiobooks.includes(audiobookId)
|
return !!state.selectedAudiobooks.includes(audiobookId)
|
||||||
},
|
},
|
||||||
getServerSetting: state => key => {
|
|
||||||
if (!state.serverSettings) return null
|
|
||||||
return state.serverSettings[key]
|
|
||||||
},
|
|
||||||
getBookCoverAspectRatio: state => {
|
|
||||||
if (!state.serverSettings || !state.serverSettings.coverAspectRatio) return 1.6
|
|
||||||
return state.serverSettings.coverAspectRatio === 0 ? 1.6 : 1
|
|
||||||
},
|
|
||||||
getNumAudiobooksSelected: state => state.selectedAudiobooks.length,
|
getNumAudiobooksSelected: state => state.selectedAudiobooks.length,
|
||||||
getAudiobookIdStreaming: state => {
|
getAudiobookIdStreaming: state => {
|
||||||
return state.streamAudiobook ? state.streamAudiobook.id : null
|
return state.streamAudiobook ? state.streamAudiobook.id : null
|
||||||
|
|
@ -43,22 +34,6 @@ export const getters = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
updateServerSettings({ commit }, payload) {
|
|
||||||
var updatePayload = {
|
|
||||||
...payload
|
|
||||||
}
|
|
||||||
return this.$axios.$patch('/api/serverSettings', updatePayload).then((result) => {
|
|
||||||
if (result.success) {
|
|
||||||
commit('setServerSettings', result.serverSettings)
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Failed to update server settings', error)
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
checkForUpdate({ commit }) {
|
checkForUpdate({ commit }) {
|
||||||
return checkForUpdate()
|
return checkForUpdate()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
@ -102,10 +77,6 @@ export const mutations = {
|
||||||
setVersionData(state, versionData) {
|
setVersionData(state, versionData) {
|
||||||
state.versionData = versionData
|
state.versionData = versionData
|
||||||
},
|
},
|
||||||
setServerSettings(state, settings) {
|
|
||||||
if (!settings) return
|
|
||||||
state.serverSettings = settings
|
|
||||||
},
|
|
||||||
setStreamAudiobook(state, audiobook) {
|
setStreamAudiobook(state, audiobook) {
|
||||||
state.playOnLoad = true
|
state.playOnLoad = true
|
||||||
state.streamAudiobook = audiobook
|
state.streamAudiobook = audiobook
|
||||||
|
|
|
||||||
63
client/store/settings.js
Normal file
63
client/store/settings.js
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
export const state = () => ({
|
||||||
|
SSOSettings: null,
|
||||||
|
serverSettings: null
|
||||||
|
})
|
||||||
|
|
||||||
|
export const getters = {
|
||||||
|
getServerSetting: state => key => {
|
||||||
|
if (!state.serverSettings) return null
|
||||||
|
return state.serverSettings[key]
|
||||||
|
},
|
||||||
|
getBookCoverAspectRatio: state => {
|
||||||
|
if (!state.serverSettings || !state.serverSettings.coverAspectRatio) return 1.6
|
||||||
|
return state.serverSettings.coverAspectRatio === 0 ? 1.6 : 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const actions = {
|
||||||
|
updateServerSettings({ commit }, payload) {
|
||||||
|
var updatePayload = {
|
||||||
|
...payload
|
||||||
|
}
|
||||||
|
return this.$axios.$patch('/api/serverSettings', updatePayload).then((result) => {
|
||||||
|
if (result.success) {
|
||||||
|
commit('setServerSettings', result.serverSettings)
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('Failed to update server settings', error)
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
updateSSOSettings({ commit }, payload) {
|
||||||
|
var updatePayload = {
|
||||||
|
...payload
|
||||||
|
}
|
||||||
|
// Immediately update
|
||||||
|
commit('setSSOSettings', updatePayload)
|
||||||
|
return this.$axios.$patch('/api/SSOSettings', updatePayload).then((result) => {
|
||||||
|
if (result.success) {
|
||||||
|
commit('setSSOSettings', result.settings)
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}).catch((error) => {
|
||||||
|
console.error('Failed to update sso settings', error)
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const mutations = {
|
||||||
|
setServerSettings(state, settings) {
|
||||||
|
if (!settings) return
|
||||||
|
state.serverSettings = settings
|
||||||
|
},
|
||||||
|
setSSOSettings(state, settings) {
|
||||||
|
if (!settings || !settings.oidc || !settings.user) return
|
||||||
|
state.SSOSettings = settings
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,108 +0,0 @@
|
||||||
const defaultSSOSettings = {
|
|
||||||
oidc: {
|
|
||||||
issuer: "",
|
|
||||||
authorizationURL: "",
|
|
||||||
tokenURL: "",
|
|
||||||
userInfoURL: "",
|
|
||||||
clientID: "",
|
|
||||||
clientSecret: "",
|
|
||||||
callbackURL: "/oidc/callback",
|
|
||||||
scope: "openid email profile"
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
createNewUser: false,
|
|
||||||
isActive: true,
|
|
||||||
settings: {
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const state = () => defaultSSOSettings
|
|
||||||
|
|
||||||
export const getters = {
|
|
||||||
getSSOIssuer: (state) => state.oidc.issuer,
|
|
||||||
getSSOAuthorizationURL: (state) => state.oidc.authorizationURL,
|
|
||||||
getSSOTokenURL: (state) => state.oidc.tokenURL,
|
|
||||||
getSSOUserInfoURL: (state) => state.oidc.userInfoURL,
|
|
||||||
getSSOClientID: (state) => state.oidc.clientID,
|
|
||||||
getSSOClientSecret: (state) => state.oidc.clientSecret,
|
|
||||||
getSSOCallbackURL: (state) => state.oidc.callbackURL,
|
|
||||||
getSSOScope: (state) => state.oidc.scope,
|
|
||||||
|
|
||||||
getUserCreateNewUser: (state) => state.user.createNewUser,
|
|
||||||
getUserIsActive: (state) => state.user.isActive,
|
|
||||||
getUserPermissionDownload: (state) => state.user.permissions.download,
|
|
||||||
getUserPermissionUpdate: (state) => state.user.permissions.update,
|
|
||||||
getUserPermissionDelete: (state) => state.user.permissions.delete,
|
|
||||||
getUserPermissionUpload: (state) => state.user.permissions.upload,
|
|
||||||
getUserPermissionAccessAllLibraries: (state) => state.user.permissions.accessAllLibraries,
|
|
||||||
}
|
|
||||||
|
|
||||||
export const actions = {
|
|
||||||
updateSSOSettings({ commit }, payload) {
|
|
||||||
var updatePayload = {
|
|
||||||
...payload
|
|
||||||
}
|
|
||||||
// Immediately update
|
|
||||||
commit('setSSOSettings', updatePayload)
|
|
||||||
return this.$axios.$patch('/api/SSOSettings', updatePayload).then((result) => {
|
|
||||||
if (result.success) {
|
|
||||||
commit('setSSOSettings', result.settings)
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Failed to update sso settings', error)
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
loadSSOSettings({ state, commit }) {
|
|
||||||
|
|
||||||
return this.$axios.$get('/api/collections').then((collections) => {
|
|
||||||
commit('setCollections', collections)
|
|
||||||
return collections
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error('Failed to get collections', error)
|
|
||||||
return []
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const mutations = {
|
|
||||||
setSSOSettings(state, settings) {
|
|
||||||
if (!settings || !settings.oidc || !settings.user) return
|
|
||||||
|
|
||||||
for (const key in settings.oidc) {
|
|
||||||
state.oidc[key] = settings.oidc[key]
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const key in settings.user) {
|
|
||||||
if (typeof settings.user[key] === "object" && typeof state.user[key] === "object") {
|
|
||||||
for (const key2 in settings.user[key]) {
|
|
||||||
state.user[key][key2] = settings.user[key][key2]
|
|
||||||
}
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if (state.user[key] !== undefined) {
|
|
||||||
state.user[key] = settings.user[key]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue