Example of potential plugin implementation

This commit is contained in:
advplyr 2024-12-19 17:48:18 -06:00
parent 71b943f434
commit 62bd7e73f4
15 changed files with 347 additions and 7 deletions

View file

@ -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
}
}