mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00
Revert "fix: plugin/theme names with scope are not allowed"
This reverts commit 8426746bf1
.
This commit is contained in:
parent
8426746bf1
commit
e9f887323a
1 changed files with 3 additions and 9 deletions
|
@ -6,10 +6,6 @@ import { exists, isArray, isSafePath } from './misc.js'
|
||||||
|
|
||||||
const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS
|
const PLUGINS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.PLUGINS
|
||||||
|
|
||||||
const NPM_VALIDATION_RE = new RegExp(
|
|
||||||
/^(@[^\._][a-z-_\.~0-9]+\/)?([a-z-0-9]+)$/,
|
|
||||||
);
|
|
||||||
|
|
||||||
function isPluginTypeValid (value: any) {
|
function isPluginTypeValid (value: any) {
|
||||||
return exists(value) &&
|
return exists(value) &&
|
||||||
(value === PluginType.PLUGIN || value === PluginType.THEME)
|
(value === PluginType.PLUGIN || value === PluginType.THEME)
|
||||||
|
@ -18,16 +14,14 @@ function isPluginTypeValid (value: any) {
|
||||||
function isPluginNameValid (value: string) {
|
function isPluginNameValid (value: string) {
|
||||||
return exists(value) &&
|
return exists(value) &&
|
||||||
validator.default.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.NAME) &&
|
validator.default.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.NAME) &&
|
||||||
validator.default.matches(value, NPM_VALIDATION_RE)
|
validator.default.matches(value, /^[a-z-0-9]+$/)
|
||||||
}
|
}
|
||||||
|
|
||||||
function isNpmPluginNameValid (value: string) {
|
function isNpmPluginNameValid (value: string) {
|
||||||
const match = value.match(NPM_VALIDATION_RE);
|
|
||||||
return exists(value) &&
|
return exists(value) &&
|
||||||
validator.default.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.NAME) &&
|
validator.default.isLength(value, PLUGINS_CONSTRAINTS_FIELDS.NAME) &&
|
||||||
validator.default.matches(value, NPM_VALIDATION_RE) &&
|
validator.default.matches(value, /^[a-z\-._0-9]+$/) &&
|
||||||
(match[2].startsWith("peertube-plugin-") ||
|
(value.startsWith('peertube-plugin-') || value.startsWith('peertube-theme-'))
|
||||||
match[2].startsWith("peertube-theme-"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isPluginDescriptionValid (value: string) {
|
function isPluginDescriptionValid (value: string) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue