diff options
Diffstat (limited to 'server/lib/plugins/plugin-manager.ts')
-rw-r--r-- | server/lib/plugins/plugin-manager.ts | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index 6b9a255a4..6599bccca 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts | |||
@@ -304,22 +304,28 @@ export class PluginManager implements ServerHook { | |||
304 | uninstalled: false, | 304 | uninstalled: false, |
305 | peertubeEngine: packageJSON.engine.peertube | 305 | peertubeEngine: packageJSON.engine.peertube |
306 | }, { returning: true }) | 306 | }, { returning: true }) |
307 | } catch (err) { | 307 | |
308 | logger.error('Cannot install plugin %s, removing it...', toInstall, { err }) | 308 | logger.info('Successful installation of plugin %s.', toInstall) |
309 | |||
310 | await this.registerPluginOrTheme(plugin) | ||
311 | } catch (rootErr) { | ||
312 | logger.error('Cannot install plugin %s, removing it...', toInstall, { err: rootErr }) | ||
309 | 313 | ||
310 | try { | 314 | try { |
311 | await removeNpmPlugin(npmName) | 315 | await this.uninstall(npmName) |
312 | } catch (err) { | 316 | } catch (err) { |
313 | logger.error('Cannot remove plugin %s after failed installation.', toInstall, { err }) | 317 | logger.error('Cannot uninstall plugin %s after failed installation.', toInstall, { err }) |
318 | |||
319 | try { | ||
320 | await removeNpmPlugin(npmName) | ||
321 | } catch (err) { | ||
322 | logger.error('Cannot remove plugin %s after failed installation.', toInstall, { err }) | ||
323 | } | ||
314 | } | 324 | } |
315 | 325 | ||
316 | throw err | 326 | throw rootErr |
317 | } | 327 | } |
318 | 328 | ||
319 | logger.info('Successful installation of plugin %s.', toInstall) | ||
320 | |||
321 | await this.registerPluginOrTheme(plugin) | ||
322 | |||
323 | return plugin | 329 | return plugin |
324 | } | 330 | } |
325 | 331 | ||
@@ -425,8 +431,7 @@ export class PluginManager implements ServerHook { | |||
425 | 431 | ||
426 | await ensureDir(registerOptions.peertubeHelpers.plugin.getDataDirectoryPath()) | 432 | await ensureDir(registerOptions.peertubeHelpers.plugin.getDataDirectoryPath()) |
427 | 433 | ||
428 | library.register(registerOptions) | 434 | await library.register(registerOptions) |
429 | .catch(err => logger.error('Cannot register plugin %s.', npmName, { err })) | ||
430 | 435 | ||
431 | logger.info('Add plugin %s CSS to global file.', npmName) | 436 | logger.info('Add plugin %s CSS to global file.', npmName) |
432 | 437 | ||