aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-17 15:46:51 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit9fa6ca160a9dda057c3980c6ee19f0ee426fd0a0 (patch)
tree7a107a1abfc474e7590d3e64fac4b5b01c12c7f4 /server/lib
parent662e5d4fe4b0ac61867f3f4fa3bb38a8b8e5d0f5 (diff)
downloadPeerTube-9fa6ca160a9dda057c3980c6ee19f0ee426fd0a0.tar.gz
PeerTube-9fa6ca160a9dda057c3980c6ee19f0ee426fd0a0.tar.zst
PeerTube-9fa6ca160a9dda057c3980c6ee19f0ee426fd0a0.zip
Some plugins fixes and doc enhancements
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/plugins/plugin-manager.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts
index 9e4ec5adf..570b56193 100644
--- a/server/lib/plugins/plugin-manager.ts
+++ b/server/lib/plugins/plugin-manager.ts
@@ -104,10 +104,12 @@ export class PluginManager {
104 104
105 for (const hook of this.hooks[hookName]) { 105 for (const hook of this.hooks[hookName]) {
106 try { 106 try {
107 const p = hook.handler(param)
108
107 if (wait) { 109 if (wait) {
108 result = await hook.handler(param) 110 result = await p
109 } else { 111 } else if (p.catch) {
110 result = hook.handler() 112 p.catch(err => logger.warn('Hook %s of plugin %s thrown an error.', hookName, hook.pluginName, { err }))
111 } 113 }
112 } catch (err) { 114 } catch (err) {
113 logger.error('Cannot run hook %s of plugin %s.', hookName, hook.pluginName, { err }) 115 logger.error('Cannot run hook %s of plugin %s.', hookName, hook.pluginName, { err })
@@ -329,7 +331,7 @@ export class PluginManager {
329 registerSetting, 331 registerSetting,
330 settingsManager, 332 settingsManager,
331 storageManager 333 storageManager
332 }) 334 }).catch(err => logger.error('Cannot register plugin %s.', npmName, { err }))
333 335
334 logger.info('Add plugin %s CSS to global file.', npmName) 336 logger.info('Add plugin %s CSS to global file.', npmName)
335 337
@@ -365,7 +367,7 @@ export class PluginManager {
365 private async regeneratePluginGlobalCSS () { 367 private async regeneratePluginGlobalCSS () {
366 await this.resetCSSGlobalFile() 368 await this.resetCSSGlobalFile()
367 369
368 for (const key of Object.keys(this.registeredPlugins)) { 370 for (const key of Object.keys(this.getRegisteredPlugins())) {
369 const plugin = this.registeredPlugins[key] 371 const plugin = this.registeredPlugins[key]
370 372
371 await this.addCSSToGlobalFile(plugin.path, plugin.css) 373 await this.addCSSToGlobalFile(plugin.path, plugin.css)