From: Chocobozzz Date: Thu, 22 Aug 2019 07:41:49 +0000 (+0200) Subject: Relax plugin package.json validation X-Git-Tag: v1.4.0~20 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d1c0a964a214e861f1106e69c62b1aec1b3d55a9;p=oweals%2Fpeertube.git Relax plugin package.json validation --- 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) { } function isPluginHomepage (value: string) { - return isUrlValid(value) + return exists(value) && (!value || isUrlValid(value)) +} + +function isPluginBugs (value: string) { + return exists(value) && (!value || isUrlValid(value)) } function areStaticDirectoriesValid (staticDirs: any) { @@ -85,7 +89,7 @@ function isPackageJSONValid (packageJSON: PluginPackageJson, pluginType: PluginT isPluginEngineValid(packageJSON.engine) && isPluginHomepage(packageJSON.homepage) && exists(packageJSON.author) && - isUrlValid(packageJSON.bugs) && + isPluginBugs(packageJSON.bugs) && (pluginType === PluginType.THEME || isSafePath(packageJSON.library)) && areStaticDirectoriesValid(packageJSON.staticDirs) && areCSSPathsValid(packageJSON.css) &&