aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/plugins.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/plugins.ts')
-rw-r--r--server/helpers/custom-validators/plugins.ts6
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'
4import { CONSTRAINTS_FIELDS } from '../../initializers/constants' 4import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
5import { PluginPackageJson } from '../../../shared/models/plugins/plugin-package-json.model' 5import { PluginPackageJson } from '../../../shared/models/plugins/plugin-package-json.model'
6import { isUrlValid } from './activitypub/misc' 6import { isUrlValid } from './activitypub/misc'
7import { isThemeRegistered } from '../../lib/plugins/theme-utils'
7 8
8const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS 9const 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
65function isThemeValid (name: string) {
66 return isPluginNameValid(name) && isThemeRegistered(name)
67}
68
64function isPackageJSONValid (packageJSON: PluginPackageJson, pluginType: PluginType) { 69function 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) {
82export { 87export {
83 isPluginTypeValid, 88 isPluginTypeValid,
84 isPackageJSONValid, 89 isPackageJSONValid,
90 isThemeValid,
85 isPluginVersionValid, 91 isPluginVersionValid,
86 isPluginNameValid, 92 isPluginNameValid,
87 isPluginDescriptionValid, 93 isPluginDescriptionValid,