diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-11 14:40:19 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | dba85a1e9e9f603ba52e1ea42deaf3fdd799b1d8 (patch) | |
tree | 7695023d90b78f972abafc718346c50264587ff5 /server/middlewares | |
parent | d00dc28dd73ad9dd419d5a5ac6ac747cefbc6e8b (diff) | |
download | PeerTube-dba85a1e9e9f603ba52e1ea42deaf3fdd799b1d8.tar.gz PeerTube-dba85a1e9e9f603ba52e1ea42deaf3fdd799b1d8.tar.zst PeerTube-dba85a1e9e9f603ba52e1ea42deaf3fdd799b1d8.zip |
WIP plugins: add plugin settings/uninstall in client
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/plugins.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/middlewares/validators/plugins.ts b/server/middlewares/validators/plugins.ts index 265ac7c17..a06add6b8 100644 --- a/server/middlewares/validators/plugins.ts +++ b/server/middlewares/validators/plugins.ts | |||
@@ -63,7 +63,7 @@ const uninstallPluginValidator = [ | |||
63 | body('npmName').custom(isNpmPluginNameValid).withMessage('Should have a valid npm name'), | 63 | body('npmName').custom(isNpmPluginNameValid).withMessage('Should have a valid npm name'), |
64 | 64 | ||
65 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 65 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
66 | logger.debug('Checking managePluginValidator parameters', { parameters: req.body }) | 66 | logger.debug('Checking uninstallPluginValidator parameters', { parameters: req.body }) |
67 | 67 | ||
68 | if (areValidationErrors(req, res)) return | 68 | if (areValidationErrors(req, res)) return |
69 | 69 | ||
@@ -71,15 +71,15 @@ const uninstallPluginValidator = [ | |||
71 | } | 71 | } |
72 | ] | 72 | ] |
73 | 73 | ||
74 | const enabledPluginValidator = [ | 74 | const existingPluginValidator = [ |
75 | body('name').custom(isPluginNameValid).withMessage('Should have a valid plugin name'), | 75 | param('npmName').custom(isPluginNameValid).withMessage('Should have a valid plugin name'), |
76 | 76 | ||
77 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 77 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
78 | logger.debug('Checking enabledPluginValidator parameters', { parameters: req.body }) | 78 | logger.debug('Checking enabledPluginValidator parameters', { parameters: req.params }) |
79 | 79 | ||
80 | if (areValidationErrors(req, res)) return | 80 | if (areValidationErrors(req, res)) return |
81 | 81 | ||
82 | const plugin = await PluginModel.load(req.body.name) | 82 | const plugin = await PluginModel.loadByNpmName(req.params.npmName) |
83 | if (!plugin) { | 83 | if (!plugin) { |
84 | return res.status(404) | 84 | return res.status(404) |
85 | .json({ error: 'Plugin not found' }) | 85 | .json({ error: 'Plugin not found' }) |
@@ -110,7 +110,7 @@ export { | |||
110 | servePluginStaticDirectoryValidator, | 110 | servePluginStaticDirectoryValidator, |
111 | updatePluginSettingsValidator, | 111 | updatePluginSettingsValidator, |
112 | uninstallPluginValidator, | 112 | uninstallPluginValidator, |
113 | enabledPluginValidator, | 113 | existingPluginValidator, |
114 | installPluginValidator, | 114 | installPluginValidator, |
115 | listPluginsValidator | 115 | listPluginsValidator |
116 | } | 116 | } |