diff options
author | John Livingston <38844060+JohnXLivingston@users.noreply.github.com> | 2021-12-03 10:14:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-03 10:14:01 +0100 |
commit | 3a1157a68a70e90df21f743ea15154805649b8e5 (patch) | |
tree | 16cf8151e6717f9025f53aec28c3a85c003377fb /server/controllers/api/plugins.ts | |
parent | 37cb07eae26b1b73b118e256df71243ae298fa72 (diff) | |
download | PeerTube-3a1157a68a70e90df21f743ea15154805649b8e5.tar.gz PeerTube-3a1157a68a70e90df21f743ea15154805649b8e5.tar.zst PeerTube-3a1157a68a70e90df21f743ea15154805649b8e5.zip |
CLI: plugins install command accept a --plugin-version parameter. (#4599)
* CLI: plugins install command accept a --plugin-version parameter.
* Unit tests for plugins install --plugin-version.
* Fix linting.
* Styling
Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'server/controllers/api/plugins.ts')
-rw-r--r-- | server/controllers/api/plugins.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/controllers/api/plugins.ts b/server/controllers/api/plugins.ts index 2de7fe41f..de9e055dc 100644 --- a/server/controllers/api/plugins.ts +++ b/server/controllers/api/plugins.ts | |||
@@ -144,8 +144,13 @@ async function installPlugin (req: express.Request, res: express.Response) { | |||
144 | 144 | ||
145 | const fromDisk = !!body.path | 145 | const fromDisk = !!body.path |
146 | const toInstall = body.npmName || body.path | 146 | const toInstall = body.npmName || body.path |
147 | |||
148 | const pluginVersion = body.pluginVersion && body.npmName | ||
149 | ? body.pluginVersion | ||
150 | : undefined | ||
151 | |||
147 | try { | 152 | try { |
148 | const plugin = await PluginManager.Instance.install(toInstall, undefined, fromDisk) | 153 | const plugin = await PluginManager.Instance.install(toInstall, pluginVersion, fromDisk) |
149 | 154 | ||
150 | return res.json(plugin.toFormattedJSON()) | 155 | return res.json(plugin.toFormattedJSON()) |
151 | } catch (err) { | 156 | } catch (err) { |