skins: use "colibris" as default, even when no settings.json is present

Starting with Etherpad 1.8.3 we decided to use Colibris as default skin for new
installs. Without this change, when starting with no settings.json file,
Etherpad would (wrongly) use "no-skin".

This change should have been part of 70bc71c0c3.
This commit is contained in:
muxator 2020-04-19 02:58:35 +02:00
parent 8956efc4ae
commit 0b0608d7d4
1 changed files with 9 additions and 9 deletions

View File

@ -626,19 +626,19 @@ exports.reloadSettings = function reloadSettings() {
log4js.replaceConsole();
if (!exports.skinName) {
console.warn(`No "skinName" parameter found. Please check out settings.json.template and update your settings.json. Falling back to the default "no-skin".`);
exports.skinName = "no-skin";
console.warn(`No "skinName" parameter found. Please check out settings.json.template and update your settings.json. Falling back to the default "colibris".`);
exports.skinName = "colibris";
}
// checks if skinName has an acceptable value, otherwise falls back to "no-skin"
// checks if skinName has an acceptable value, otherwise falls back to "colibris"
if (exports.skinName) {
const skinBasePath = path.join(exports.root, "src", "static", "skins");
const countPieces = exports.skinName.split(path.sep).length;
if (countPieces != 1) {
console.error(`skinName must be the name of a directory under "${skinBasePath}". This is not valid: "${exports.skinName}". Falling back to the default "no-skin".`);
console.error(`skinName must be the name of a directory under "${skinBasePath}". This is not valid: "${exports.skinName}". Falling back to the default "colibris".`);
exports.skinName = "no-skin";
exports.skinName = "colibris";
}
// informative variable, just for the log messages
@ -646,15 +646,15 @@ exports.reloadSettings = function reloadSettings() {
// what if someone sets skinName == ".." or "."? We catch him!
if (absolutePaths.isSubdir(skinBasePath, skinPath) === false) {
console.error(`Skin path ${skinPath} must be a subdirectory of ${skinBasePath}. Falling back to the default "no-skin".`);
console.error(`Skin path ${skinPath} must be a subdirectory of ${skinBasePath}. Falling back to the default "colibris".`);
exports.skinName = "no-skin";
exports.skinName = "colibris";
skinPath = path.join(skinBasePath, exports.skinName);
}
if (fs.existsSync(skinPath) === false) {
console.error(`Skin path ${skinPath} does not exist. Falling back to the default "no-skin".`);
exports.skinName = "no-skin";
console.error(`Skin path ${skinPath} does not exist. Falling back to the default "colibris".`);
exports.skinName = "colibris";
skinPath = path.join(skinBasePath, exports.skinName);
}