1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

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>
This commit is contained in:
John Livingston 2021-12-03 10:14:01 +01:00 committed by GitHub
parent 37cb07eae2
commit 3a1157a68a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 37 additions and 4 deletions

View file

@ -116,6 +116,9 @@ const installOrUpdatePluginValidator = [
body('npmName')
.optional()
.custom(isNpmPluginNameValid).withMessage('Should have a valid npm name'),
body('pluginVersion')
.optional()
.custom(isPluginVersionValid).withMessage('Should have a valid plugin version'),
body('path')
.optional()
.custom(isSafePath).withMessage('Should have a valid safe path'),
@ -129,6 +132,9 @@ const installOrUpdatePluginValidator = [
if (!body.path && !body.npmName) {
return res.fail({ message: 'Should have either a npmName or a path' })
}
if (body.pluginVersion && !body.npmName) {
return res.fail({ message: 'Should have a npmName when specifying a pluginVersion' })
}
return next()
}