diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-12 10:10:48 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-12 10:10:48 +0200 |
commit | 8280d0c22797c72978f698dc2deaa8ef569a9d15 (patch) | |
tree | 8136abd28c9aa0c5050bb66e2f6f7451117b57f2 /server/lib/plugins/plugin-manager.ts | |
parent | 90aa0a74e95d390d62942aa72d481d5aa7b5ac23 (diff) | |
download | PeerTube-8280d0c22797c72978f698dc2deaa8ef569a9d15.tar.gz PeerTube-8280d0c22797c72978f698dc2deaa8ef569a9d15.tar.zst PeerTube-8280d0c22797c72978f698dc2deaa8ef569a9d15.zip |
Ensure to install supported plugins
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 | ||