diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-12 10:10:48 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-04-12 10:10:48 +0200 |
commit | 8280d0c22797c72978f698dc2deaa8ef569a9d15 (patch) | |
tree | 8136abd28c9aa0c5050bb66e2f6f7451117b57f2 /server/lib/plugins/yarn.ts | |
parent | 90aa0a74e95d390d62942aa72d481d5aa7b5ac23 (diff) | |
download | PeerTube-8280d0c22797c72978f698dc2deaa8ef569a9d15.tar.gz PeerTube-8280d0c22797c72978f698dc2deaa8ef569a9d15.tar.zst PeerTube-8280d0c22797c72978f698dc2deaa8ef569a9d15.zip |
Ensure to install supported plugins
Diffstat (limited to 'server/lib/plugins/yarn.ts')
-rw-r--r-- | server/lib/plugins/yarn.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/server/lib/plugins/yarn.ts b/server/lib/plugins/yarn.ts index e40351b6e..3f45681d3 100644 --- a/server/lib/plugins/yarn.ts +++ b/server/lib/plugins/yarn.ts | |||
@@ -1,14 +1,17 @@ | |||
1 | import { outputJSON, pathExists } from 'fs-extra' | ||
2 | import { join } from 'path' | ||
1 | import { execShell } from '../../helpers/core-utils' | 3 | import { execShell } from '../../helpers/core-utils' |
2 | import { logger } from '../../helpers/logger' | ||
3 | import { isNpmPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins' | 4 | import { isNpmPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins' |
5 | import { logger } from '../../helpers/logger' | ||
4 | import { CONFIG } from '../../initializers/config' | 6 | import { CONFIG } from '../../initializers/config' |
5 | import { outputJSON, pathExists } from 'fs-extra' | 7 | import { getLatestPluginVersion } from './plugin-index' |
6 | import { join } from 'path' | ||
7 | 8 | ||
8 | async function installNpmPlugin (npmName: string, version?: string) { | 9 | async function installNpmPlugin (npmName: string, versionArg?: string) { |
9 | // Security check | 10 | // Security check |
10 | checkNpmPluginNameOrThrow(npmName) | 11 | checkNpmPluginNameOrThrow(npmName) |
11 | if (version) checkPluginVersionOrThrow(version) | 12 | if (versionArg) checkPluginVersionOrThrow(versionArg) |
13 | |||
14 | const version = versionArg || await getLatestPluginVersion(npmName) | ||
12 | 15 | ||
13 | let toInstall = npmName | 16 | let toInstall = npmName |
14 | if (version) toInstall += `@${version}` | 17 | if (version) toInstall += `@${version}` |