diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-22 16:31:47 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 7663e55a2cc46a413bceee2787d48902b15ae642 (patch) | |
tree | c54d620617040642d962f9b8c74c7b8e2d745692 /server | |
parent | e8f902c05cb35f6d5e9b75a23ddabd51c220a976 (diff) | |
download | PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.tar.gz PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.tar.zst PeerTube-7663e55a2cc46a413bceee2787d48902b15ae642.zip |
Log error on unknown hook
Diffstat (limited to 'server')
-rw-r--r-- | server/lib/plugins/plugin-manager.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index afc07a151..cfe63e50d 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts | |||
@@ -13,7 +13,7 @@ import { RegisterSettingOptions } from '../../../shared/models/plugins/register- | |||
13 | import { RegisterHookOptions } from '../../../shared/models/plugins/register-hook.model' | 13 | import { RegisterHookOptions } from '../../../shared/models/plugins/register-hook.model' |
14 | import { PluginSettingsManager } from '../../../shared/models/plugins/plugin-settings-manager.model' | 14 | import { PluginSettingsManager } from '../../../shared/models/plugins/plugin-settings-manager.model' |
15 | import { PluginStorageManager } from '../../../shared/models/plugins/plugin-storage-manager.model' | 15 | import { PluginStorageManager } from '../../../shared/models/plugins/plugin-storage-manager.model' |
16 | import { ServerHook, ServerHookName } from '../../../shared/models/plugins/server-hook.model' | 16 | import { ServerHook, ServerHookName, serverHookObject } from '../../../shared/models/plugins/server-hook.model' |
17 | import { getHookType, internalRunHook } from '../../../shared/core-utils/plugins/hooks' | 17 | import { getHookType, internalRunHook } from '../../../shared/core-utils/plugins/hooks' |
18 | import { RegisterOptions } from '../../typings/plugins/register-options.model' | 18 | import { RegisterOptions } from '../../typings/plugins/register-options.model' |
19 | import { PluginLibrary } from '../../typings/plugins' | 19 | import { PluginLibrary } from '../../typings/plugins' |
@@ -388,6 +388,11 @@ export class PluginManager implements ServerHook { | |||
388 | 388 | ||
389 | private getRegisterHelpers (npmName: string, plugin: PluginModel): RegisterOptions { | 389 | private getRegisterHelpers (npmName: string, plugin: PluginModel): RegisterOptions { |
390 | const registerHook = (options: RegisterHookOptions) => { | 390 | const registerHook = (options: RegisterHookOptions) => { |
391 | if (serverHookObject[options.target] !== true) { | ||
392 | logger.warn('Unknown hook %s of plugin %s. Skipping.', options.target, npmName) | ||
393 | return | ||
394 | } | ||
395 | |||
391 | if (!this.hooks[options.target]) this.hooks[options.target] = [] | 396 | if (!this.hooks[options.target]) this.hooks[options.target] = [] |
392 | 397 | ||
393 | this.hooks[options.target].push({ | 398 | this.hooks[options.target].push({ |