From dba85a1e9e9f603ba52e1ea42deaf3fdd799b1d8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 11 Jul 2019 14:40:19 +0200 Subject: WIP plugins: add plugin settings/uninstall in client --- server/middlewares/validators/plugins.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'server/middlewares') 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 = [ body('npmName').custom(isNpmPluginNameValid).withMessage('Should have a valid npm name'), (req: express.Request, res: express.Response, next: express.NextFunction) => { - logger.debug('Checking managePluginValidator parameters', { parameters: req.body }) + logger.debug('Checking uninstallPluginValidator parameters', { parameters: req.body }) if (areValidationErrors(req, res)) return @@ -71,15 +71,15 @@ const uninstallPluginValidator = [ } ] -const enabledPluginValidator = [ - body('name').custom(isPluginNameValid).withMessage('Should have a valid plugin name'), +const existingPluginValidator = [ + param('npmName').custom(isPluginNameValid).withMessage('Should have a valid plugin name'), async (req: express.Request, res: express.Response, next: express.NextFunction) => { - logger.debug('Checking enabledPluginValidator parameters', { parameters: req.body }) + logger.debug('Checking enabledPluginValidator parameters', { parameters: req.params }) if (areValidationErrors(req, res)) return - const plugin = await PluginModel.load(req.body.name) + const plugin = await PluginModel.loadByNpmName(req.params.npmName) if (!plugin) { return res.status(404) .json({ error: 'Plugin not found' }) @@ -110,7 +110,7 @@ export { servePluginStaticDirectoryValidator, updatePluginSettingsValidator, uninstallPluginValidator, - enabledPluginValidator, + existingPluginValidator, installPluginValidator, listPluginsValidator } -- cgit v1.2.3