1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Add plugin table migration table

This commit is contained in:
Chocobozzz 2019-07-22 11:18:22 +02:00 committed by Chocobozzz
parent 6691c52280
commit 587568e1cc
6 changed files with 51 additions and 4 deletions

View file

@ -9,7 +9,7 @@ type RawFunction <U, T> = (params: U) => T
// Helpers to run hooks
const Hooks = {
wrapObject: <T, U extends ServerFilterHookName>(result: T, hookName: U) => {
return PluginManager.Instance.runHook(hookName, result) as Promise<T>
return PluginManager.Instance.runHook(hookName, result)
},
wrapPromiseFun: async <U, T, V extends ServerFilterHookName>(fun: PromiseFunction<U, T>, params: U, hookName: V) => {

View file

@ -125,6 +125,13 @@ export class PluginManager implements ServerHook {
try {
await this.registerPluginOrTheme(plugin)
} catch (err) {
// Try to unregister the plugin
try {
await this.unregister(PluginModel.buildNpmName(plugin.name, plugin.type))
} catch {
// we don't care if we cannot unregister it
}
logger.error('Cannot register plugin %s, skipping.', plugin.name, { err })
}
}