diff options
Diffstat (limited to 'server/lib/plugins/plugin-manager.ts')
-rw-r--r-- | server/lib/plugins/plugin-manager.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index e3226a950..03ea48416 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts | |||
@@ -328,11 +328,18 @@ export class PluginManager implements ServerHook { | |||
328 | return plugin | 328 | return plugin |
329 | } | 329 | } |
330 | 330 | ||
331 | async update (toUpdate: string, version?: string, fromDisk = false) { | 331 | async update (toUpdate: string, fromDisk = false) { |
332 | const npmName = fromDisk ? basename(toUpdate) : toUpdate | 332 | const npmName = fromDisk ? basename(toUpdate) : toUpdate |
333 | 333 | ||
334 | logger.info('Updating plugin %s.', npmName) | 334 | logger.info('Updating plugin %s.', npmName) |
335 | 335 | ||
336 | // Use the latest version from DB, to not upgrade to a version that does not support our PeerTube version | ||
337 | let version: string | ||
338 | if (!fromDisk) { | ||
339 | const plugin = await PluginModel.loadByNpmName(toUpdate) | ||
340 | version = plugin.latestVersion | ||
341 | } | ||
342 | |||
336 | // Unregister old hooks | 343 | // Unregister old hooks |
337 | await this.unregister(npmName) | 344 | await this.unregister(npmName) |
338 | 345 | ||