diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/plugins/plugin-manager.ts | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index 2fa80e878..7576b284c 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts | |||
@@ -13,6 +13,7 @@ import { outputFile } from 'fs-extra' | |||
13 | import { RegisterSettingOptions } from '../../../shared/models/plugins/register-setting.model' | 13 | import { RegisterSettingOptions } from '../../../shared/models/plugins/register-setting.model' |
14 | import { RegisterHookOptions } from '../../../shared/models/plugins/register-hook.model' | 14 | import { RegisterHookOptions } from '../../../shared/models/plugins/register-hook.model' |
15 | import { PluginSettingsManager } from '../../../shared/models/plugins/plugin-settings-manager.model' | 15 | import { PluginSettingsManager } from '../../../shared/models/plugins/plugin-settings-manager.model' |
16 | import { PluginStorageManager } from '../../../shared/models/plugins/plugin-storage-manager.model' | ||
16 | 17 | ||
17 | export interface RegisteredPlugin { | 18 | export interface RegisteredPlugin { |
18 | npmName: string | 19 | npmName: string |
@@ -307,13 +308,24 @@ export class PluginManager { | |||
307 | setSetting: (name: string, value: string) => PluginModel.setSetting(plugin.name, plugin.type, name, value) | 308 | setSetting: (name: string, value: string) => PluginModel.setSetting(plugin.name, plugin.type, name, value) |
308 | } | 309 | } |
309 | 310 | ||
311 | const storageManager: PluginStorageManager = { | ||
312 | getData: (key: string) => PluginModel.getData(plugin.name, plugin.type, key), | ||
313 | |||
314 | storeData: (key: string, data: any) => PluginModel.storeData(plugin.name, plugin.type, key, data) | ||
315 | } | ||
316 | |||
310 | const library: PluginLibrary = require(join(pluginPath, packageJSON.library)) | 317 | const library: PluginLibrary = require(join(pluginPath, packageJSON.library)) |
311 | 318 | ||
312 | if (!isLibraryCodeValid(library)) { | 319 | if (!isLibraryCodeValid(library)) { |
313 | throw new Error('Library code is not valid (miss register or unregister function)') | 320 | throw new Error('Library code is not valid (miss register or unregister function)') |
314 | } | 321 | } |
315 | 322 | ||
316 | library.register({ registerHook, registerSetting, settingsManager }) | 323 | library.register({ |
324 | registerHook, | ||
325 | registerSetting, | ||
326 | settingsManager, | ||
327 | storageManager | ||
328 | }) | ||
317 | 329 | ||
318 | logger.info('Add plugin %s CSS to global file.', npmName) | 330 | logger.info('Add plugin %s CSS to global file.', npmName) |
319 | 331 | ||