mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-03 00:39:39 +00:00
Example of potential plugin implementation
This commit is contained in:
parent
71b943f434
commit
62bd7e73f4
15 changed files with 347 additions and 7 deletions
|
|
@ -28,7 +28,8 @@ export const state = () => ({
|
|||
openModal: null,
|
||||
innerModalOpen: false,
|
||||
lastBookshelfScrollData: {},
|
||||
routerBasePath: '/'
|
||||
routerBasePath: '/',
|
||||
pluginExtensions: []
|
||||
})
|
||||
|
||||
export const getters = {
|
||||
|
|
@ -61,6 +62,19 @@ export const getters = {
|
|||
getHomeBookshelfView: (state) => {
|
||||
if (!state.serverSettings || isNaN(state.serverSettings.homeBookshelfView)) return Constants.BookshelfView.STANDARD
|
||||
return state.serverSettings.homeBookshelfView
|
||||
},
|
||||
getPluginExtensions: (state) => (target) => {
|
||||
return state.pluginExtensions
|
||||
.map((pext) => {
|
||||
const extensionsMatchingTarget = pext.extensions.filter((ext) => ext.target === target)
|
||||
if (!extensionsMatchingTarget.length) return null
|
||||
return {
|
||||
name: pext.name,
|
||||
slug: pext.slug,
|
||||
extensions: extensionsMatchingTarget
|
||||
}
|
||||
})
|
||||
.filter(Boolean)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -239,5 +253,8 @@ export const mutations = {
|
|||
},
|
||||
setInnerModalOpen(state, val) {
|
||||
state.innerModalOpen = val
|
||||
},
|
||||
setPluginExtensions(state, val) {
|
||||
state.pluginExtensions = val
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue