mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
Settings.js: trivial reformatting
This commit is contained in:
parent
ee4a27d10e
commit
d526c5ccca
1 changed files with 35 additions and 52 deletions
|
@ -287,12 +287,9 @@ exports.scrollWhenFocusLineIsOutOfViewport = {
|
|||
//checks if abiword is avaiable
|
||||
exports.abiwordAvailable = function()
|
||||
{
|
||||
if(exports.abiword != null)
|
||||
{
|
||||
if (exports.abiword != null) {
|
||||
return os.type().indexOf("Windows") != -1 ? "withoutPDF" : "yes";
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return "no";
|
||||
}
|
||||
};
|
||||
|
@ -321,8 +318,7 @@ exports.exportAvailable = function () {
|
|||
// Provide git version if available
|
||||
exports.getGitCommit = function() {
|
||||
var version = "";
|
||||
try
|
||||
{
|
||||
try {
|
||||
var rootPath = path.resolve(npm.dir, '..');
|
||||
if (fs.lstatSync(rootPath + '/.git').isFile()) {
|
||||
rootPath = fs.readFileSync(rootPath + '/.git', "utf8");
|
||||
|
@ -334,9 +330,7 @@ exports.getGitCommit = function() {
|
|||
var refPath = rootPath + "/" + ref.substring(5, ref.indexOf("\n"));
|
||||
version = fs.readFileSync(refPath, "utf-8");
|
||||
version = version.substring(0, 7);
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
} catch(e) {
|
||||
console.warn("Can't get git version for server header\n" + e.message)
|
||||
}
|
||||
return version;
|
||||
|
@ -391,53 +385,43 @@ exports.reloadSettings = function reloadSettings() {
|
|||
}
|
||||
|
||||
//loop trough the settings
|
||||
for(var i in settings)
|
||||
{
|
||||
for (var i in settings) {
|
||||
//test if the setting start with a lowercase character
|
||||
if(i.charAt(0).search("[a-z]") !== 0)
|
||||
{
|
||||
if (i.charAt(0).search("[a-z]") !== 0) {
|
||||
console.warn(`Settings should start with a lowercase character: '${i}'`);
|
||||
}
|
||||
|
||||
//we know this setting, so we overwrite it
|
||||
//or it's a settings hash, specific to a plugin
|
||||
if(exports[i] !== undefined || i.indexOf('ep_')==0)
|
||||
{
|
||||
if (exports[i] !== undefined || i.indexOf('ep_') == 0) {
|
||||
if (_.isObject(settings[i]) && !_.isArray(settings[i])) {
|
||||
exports[i] = _.defaults(settings[i], exports[i]);
|
||||
} else {
|
||||
exports[i] = settings[i];
|
||||
}
|
||||
}
|
||||
//this setting is unkown, output a warning and throw it away
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// this setting is unknown, output a warning and throw it away
|
||||
console.warn(`Unknown Setting: '${i}'. This setting doesn't exist or it was removed`);
|
||||
}
|
||||
}
|
||||
|
||||
//loop trough the settings
|
||||
for(var i in credentials)
|
||||
{
|
||||
for (var i in credentials) {
|
||||
//test if the setting start with a lowercase character
|
||||
if(i.charAt(0).search("[a-z]") !== 0)
|
||||
{
|
||||
if (i.charAt(0).search("[a-z]") !== 0) {
|
||||
console.warn(`Settings should start with a lowercase character: '${i}'`);
|
||||
}
|
||||
|
||||
//we know this setting, so we overwrite it
|
||||
//or it's a settings hash, specific to a plugin
|
||||
if(exports[i] !== undefined || i.indexOf('ep_')==0)
|
||||
{
|
||||
if (exports[i] !== undefined || i.indexOf('ep_') == 0) {
|
||||
if (_.isObject(credentials[i]) && !_.isArray(credentials[i])) {
|
||||
exports[i] = _.defaults(credentials[i], exports[i]);
|
||||
} else {
|
||||
exports[i] = credentials[i];
|
||||
}
|
||||
}
|
||||
//this setting is unkown, output a warning and throw it away
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// this setting is unknown, output a warning and throw it away
|
||||
console.warn(`Unknown Setting: '${i}'. This setting doesn't exist or it was removed`);
|
||||
}
|
||||
}
|
||||
|
@ -485,8 +469,7 @@ exports.reloadSettings = function reloadSettings() {
|
|||
|
||||
if (exports.abiword) {
|
||||
// Check abiword actually exists
|
||||
if(exports.abiword != null)
|
||||
{
|
||||
if (exports.abiword != null) {
|
||||
fs.exists(exports.abiword, function(exists) {
|
||||
if (!exists) {
|
||||
var abiwordError = "Abiword does not exist at this path, check your settings file";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue