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:
parent
37cb07eae2
commit
3a1157a68a
6 changed files with 37 additions and 4 deletions
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue