aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/plugins/yarn.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-04-12 10:10:48 +0200
committerChocobozzz <me@florianbigard.com>2021-04-12 10:10:48 +0200
commit8280d0c22797c72978f698dc2deaa8ef569a9d15 (patch)
tree8136abd28c9aa0c5050bb66e2f6f7451117b57f2 /server/lib/plugins/yarn.ts
parent90aa0a74e95d390d62942aa72d481d5aa7b5ac23 (diff)
downloadPeerTube-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.ts13
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 @@
1import { outputJSON, pathExists } from 'fs-extra'
2import { join } from 'path'
1import { execShell } from '../../helpers/core-utils' 3import { execShell } from '../../helpers/core-utils'
2import { logger } from '../../helpers/logger'
3import { isNpmPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins' 4import { isNpmPluginNameValid, isPluginVersionValid } from '../../helpers/custom-validators/plugins'
5import { logger } from '../../helpers/logger'
4import { CONFIG } from '../../initializers/config' 6import { CONFIG } from '../../initializers/config'
5import { outputJSON, pathExists } from 'fs-extra' 7import { getLatestPluginVersion } from './plugin-index'
6import { join } from 'path'
7 8
8async function installNpmPlugin (npmName: string, version?: string) { 9async 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}`