diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-22 09:41:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-22 09:41:49 +0200 |
commit | d1c0a964a214e861f1106e69c62b1aec1b3d55a9 (patch) | |
tree | 86a9947bea1700d1ef5e40a4bcb4ba062104ce04 /server/helpers/custom-validators/plugins.ts | |
parent | c9917782ea9a90d685b0ba70b9c72971b221e5d9 (diff) | |
download | PeerTube-d1c0a964a214e861f1106e69c62b1aec1b3d55a9.tar.gz PeerTube-d1c0a964a214e861f1106e69c62b1aec1b3d55a9.tar.zst PeerTube-d1c0a964a214e861f1106e69c62b1aec1b3d55a9.zip |
Relax plugin package.json validation
Diffstat (limited to 'server/helpers/custom-validators/plugins.ts')
-rw-r--r-- | server/helpers/custom-validators/plugins.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/server/helpers/custom-validators/plugins.ts b/server/helpers/custom-validators/plugins.ts index b5e32abc2..63af91a44 100644 --- a/server/helpers/custom-validators/plugins.ts +++ b/server/helpers/custom-validators/plugins.ts | |||
@@ -41,7 +41,11 @@ function isPluginEngineValid (engine: any) { | |||
41 | } | 41 | } |
42 | 42 | ||
43 | function isPluginHomepage (value: string) { | 43 | function isPluginHomepage (value: string) { |
44 | return isUrlValid(value) | 44 | return exists(value) && (!value || isUrlValid(value)) |
45 | } | ||
46 | |||
47 | function isPluginBugs (value: string) { | ||
48 | return exists(value) && (!value || isUrlValid(value)) | ||
45 | } | 49 | } |
46 | 50 | ||
47 | function areStaticDirectoriesValid (staticDirs: any) { | 51 | function areStaticDirectoriesValid (staticDirs: any) { |
@@ -85,7 +89,7 @@ function isPackageJSONValid (packageJSON: PluginPackageJson, pluginType: PluginT | |||
85 | isPluginEngineValid(packageJSON.engine) && | 89 | isPluginEngineValid(packageJSON.engine) && |
86 | isPluginHomepage(packageJSON.homepage) && | 90 | isPluginHomepage(packageJSON.homepage) && |
87 | exists(packageJSON.author) && | 91 | exists(packageJSON.author) && |
88 | isUrlValid(packageJSON.bugs) && | 92 | isPluginBugs(packageJSON.bugs) && |
89 | (pluginType === PluginType.THEME || isSafePath(packageJSON.library)) && | 93 | (pluginType === PluginType.THEME || isSafePath(packageJSON.library)) && |
90 | areStaticDirectoriesValid(packageJSON.staticDirs) && | 94 | areStaticDirectoriesValid(packageJSON.staticDirs) && |
91 | areCSSPathsValid(packageJSON.css) && | 95 | areCSSPathsValid(packageJSON.css) && |