diff options
Diffstat (limited to 'server/helpers/custom-validators/plugins.ts')
-rw-r--r-- | server/helpers/custom-validators/plugins.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/plugins.ts b/server/helpers/custom-validators/plugins.ts index 2fcdc581f..4ab5f9ce8 100644 --- a/server/helpers/custom-validators/plugins.ts +++ b/server/helpers/custom-validators/plugins.ts | |||
@@ -4,6 +4,7 @@ import { PluginType } from '../../../shared/models/plugins/plugin.type' | |||
4 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | 4 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' |
5 | import { PluginPackageJson } from '../../../shared/models/plugins/plugin-package-json.model' | 5 | import { PluginPackageJson } from '../../../shared/models/plugins/plugin-package-json.model' |
6 | import { isUrlValid } from './activitypub/misc' | 6 | import { isUrlValid } from './activitypub/misc' |
7 | import { isThemeRegistered } from '../../lib/plugins/theme-utils' | ||
7 | 8 | ||
8 | const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS | 9 | const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS |
9 | 10 | ||
@@ -61,6 +62,10 @@ function isCSSPathsValid (css: any[]) { | |||
61 | return isArray(css) && css.every(c => isSafePath(c)) | 62 | return isArray(css) && css.every(c => isSafePath(c)) |
62 | } | 63 | } |
63 | 64 | ||
65 | function isThemeValid (name: string) { | ||
66 | return isPluginNameValid(name) && isThemeRegistered(name) | ||
67 | } | ||
68 | |||
64 | function isPackageJSONValid (packageJSON: PluginPackageJson, pluginType: PluginType) { | 69 | function isPackageJSONValid (packageJSON: PluginPackageJson, pluginType: PluginType) { |
65 | return isNpmPluginNameValid(packageJSON.name) && | 70 | return isNpmPluginNameValid(packageJSON.name) && |
66 | isPluginDescriptionValid(packageJSON.description) && | 71 | isPluginDescriptionValid(packageJSON.description) && |
@@ -82,6 +87,7 @@ function isLibraryCodeValid (library: any) { | |||
82 | export { | 87 | export { |
83 | isPluginTypeValid, | 88 | isPluginTypeValid, |
84 | isPackageJSONValid, | 89 | isPackageJSONValid, |
90 | isThemeValid, | ||
85 | isPluginVersionValid, | 91 | isPluginVersionValid, |
86 | isPluginNameValid, | 92 | isPluginNameValid, |
87 | isPluginDescriptionValid, | 93 | isPluginDescriptionValid, |