import { readJSON, writeJSON } from 'fs-extra'
import { join } from 'path'
-import { root } from '@server/helpers/core-utils'
-import { HttpStatusCode } from '@shared/core-utils'
+import { root } from '@shared/core-utils'
import {
+ HttpStatusCode,
PeerTubePlugin,
PeerTubePluginIndex,
PeertubePluginIndexList,
RegisteredServerSettings,
ResultList
} from '@shared/models'
-import { buildServerDirectory } from '../miscs'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class PluginsCommand extends AbstractCommand {
install (options: OverrideCommandOptions & {
path?: string
npmName?: string
+ pluginVersion?: string
}) {
- const { npmName, path } = options
+ const { npmName, path, pluginVersion } = options
const apiPath = '/api/v1/plugins/install'
return this.postBodyRequest({
...options,
path: apiPath,
- fields: { npmName, path },
+ fields: { npmName, path, pluginVersion },
implicitToken: true,
defaultExpectedStatus: HttpStatusCode.OK_200
})
}
private getPackageJSONPath (npmName: string) {
- return buildServerDirectory(this.server, join('plugins', 'node_modules', npmName, 'package.json'))
+ return this.server.servers.buildDirectory(join('plugins', 'node_modules', npmName, 'package.json'))
}
}