diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-22 09:41:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-22 10:33:56 +0200 |
commit | 485b2fb2cca2bed57034f89316d2735919f4982d (patch) | |
tree | df0f42955fd8a1c9064b477e4360434aba745e9b /server/helpers/custom-validators | |
parent | 14cc552b79f8386efc83716392b4cc6d523185c5 (diff) | |
download | PeerTube-485b2fb2cca2bed57034f89316d2735919f4982d.tar.gz PeerTube-485b2fb2cca2bed57034f89316d2735919f4982d.tar.zst PeerTube-485b2fb2cca2bed57034f89316d2735919f4982d.zip |
Relax plugin package.json validation
Diffstat (limited to 'server/helpers/custom-validators')
-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) && |