From 7cd4d2ba10106c10602c86f74f55743ded588896 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 9 Jul 2019 11:45:19 +0200 Subject: WIP plugins: add theme support --- server/helpers/custom-validators/plugins.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'server/helpers') 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' import { CONSTRAINTS_FIELDS } from '../../initializers/constants' import { PluginPackageJson } from '../../../shared/models/plugins/plugin-package-json.model' import { isUrlValid } from './activitypub/misc' +import { isThemeRegistered } from '../../lib/plugins/theme-utils' const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS @@ -61,6 +62,10 @@ function isCSSPathsValid (css: any[]) { return isArray(css) && css.every(c => isSafePath(c)) } +function isThemeValid (name: string) { + return isPluginNameValid(name) && isThemeRegistered(name) +} + function isPackageJSONValid (packageJSON: PluginPackageJson, pluginType: PluginType) { return isNpmPluginNameValid(packageJSON.name) && isPluginDescriptionValid(packageJSON.description) && @@ -82,6 +87,7 @@ function isLibraryCodeValid (library: any) { export { isPluginTypeValid, isPackageJSONValid, + isThemeValid, isPluginVersionValid, isPluginNameValid, isPluginDescriptionValid, -- cgit v1.2.3