mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-02 16:29:39 +00:00
Update PluginManager to singleton, update PluginContext, support prompt object in plugin extension
This commit is contained in:
parent
a762e6ca03
commit
50e84fc2d5
14 changed files with 121 additions and 45 deletions
|
|
@ -940,7 +940,17 @@ class Auth {
|
|||
userDefaultLibraryId: user.getDefaultLibraryId(libraryIds),
|
||||
serverSettings: Database.serverSettings.toJSONForBrowser(),
|
||||
ereaderDevices: Database.emailSettings.getEReaderDevices(user),
|
||||
plugins: this.pluginManifests,
|
||||
// TODO: Should be better handled by the PluginManager
|
||||
// restrict plugin extensions that are not allowed for the user type
|
||||
plugins: this.pluginManifests.map((manifest) => {
|
||||
const manifestExtensions = (manifest.extensions || []).filter((ext) => {
|
||||
if (ext.restrictToAccountTypes?.length) {
|
||||
return ext.restrictToAccountTypes.includes(user.type)
|
||||
}
|
||||
return true
|
||||
})
|
||||
return { ...manifest, extensions: manifestExtensions }
|
||||
}),
|
||||
Source: global.Source
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue