aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/plugins.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-09 11:45:19 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit7cd4d2ba10106c10602c86f74f55743ded588896 (patch)
tree81f0dd7a7ef763511158d1035f3e09e09d5dcd2c /server/helpers/custom-validators/plugins.ts
parent8d76959e11ab7172040853fa4fadaf8d53e6aa12 (diff)
downloadPeerTube-7cd4d2ba10106c10602c86f74f55743ded588896.tar.gz
PeerTube-7cd4d2ba10106c10602c86f74f55743ded588896.tar.zst
PeerTube-7cd4d2ba10106c10602c86f74f55743ded588896.zip
WIP plugins: add theme support
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,