-import * as express from 'express'
+import express from 'express'
import { logger } from '@server/helpers/logger'
import { getFormattedObjects } from '@server/helpers/utils'
import { listAvailablePluginsFromIndex } from '@server/lib/plugins/plugin-index'
const fromDisk = !!body.path
const toInstall = body.npmName || body.path
+
+ const pluginVersion = body.pluginVersion && body.npmName
+ ? body.pluginVersion
+ : undefined
+
try {
- const plugin = await PluginManager.Instance.install(toInstall, undefined, fromDisk)
+ const plugin = await PluginManager.Instance.install({ toInstall, version: pluginVersion, fromDisk })
return res.json(plugin.toFormattedJSON())
} catch (err) {
async function uninstallPlugin (req: express.Request, res: express.Response) {
const body: ManagePlugin = req.body
- await PluginManager.Instance.uninstall(body.npmName)
+ await PluginManager.Instance.uninstall({ npmName: body.npmName })
return res.status(HttpStatusCode.NO_CONTENT_204).end()
}