mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-15 10:16:12 +01:00
Support scoped theme packages
This commit is contained in:
committed by
Julian Lam
parent
d656c65c9a
commit
70ff2d9b88
@@ -34,8 +34,11 @@ function buildTargets() {
|
||||
);
|
||||
}
|
||||
|
||||
var themeNamePattern = /^(@.*?\/)?nodebb-theme-.*$/;
|
||||
var pluginNamePattern = /^(@.*?\/)?nodebb-(theme|plugin|widget|rewards)-.*$/;
|
||||
|
||||
function activate(plugin) {
|
||||
if (plugin.startsWith('nodebb-theme-')) {
|
||||
if (themeNamePattern.test(plugin)) {
|
||||
reset.reset({
|
||||
theme: plugin,
|
||||
}, function (err) {
|
||||
@@ -50,7 +53,7 @@ function activate(plugin) {
|
||||
db.init(next);
|
||||
},
|
||||
function (next) {
|
||||
if (!plugin.startsWith('nodebb-')) {
|
||||
if (!pluginNamePattern.test(plugin)) {
|
||||
// Allow omission of `nodebb-plugin-`
|
||||
plugin = 'nodebb-plugin-' + plugin;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,9 @@ var widgets = require('../widgets');
|
||||
|
||||
var dirname = require('./paths').baseDir;
|
||||
|
||||
var themeNamePattern = /^(@.*?\/)?nodebb-theme-.*$/;
|
||||
var pluginNamePattern = /^(@.*?\/)?nodebb-(theme|plugin|widget|rewards)-.*$/;
|
||||
|
||||
exports.reset = function (options, callback) {
|
||||
var map = {
|
||||
theme: function (next) {
|
||||
@@ -21,7 +24,7 @@ exports.reset = function (options, callback) {
|
||||
if (themeId === true) {
|
||||
resetThemes(next);
|
||||
} else {
|
||||
if (!themeId.startsWith('nodebb-theme-')) {
|
||||
if (!themeNamePattern.test(themeId)) {
|
||||
// Allow omission of `nodebb-theme-`
|
||||
themeId = 'nodebb-theme-' + themeId;
|
||||
}
|
||||
@@ -34,7 +37,7 @@ exports.reset = function (options, callback) {
|
||||
if (pluginId === true) {
|
||||
resetPlugins(next);
|
||||
} else {
|
||||
if (!pluginId.startsWith('nodebb-plugin-')) {
|
||||
if (!pluginNamePattern.test(pluginId)) {
|
||||
// Allow omission of `nodebb-plugin-`
|
||||
pluginId = 'nodebb-plugin-' + pluginId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user