|
@@ -40,56 +40,57 @@ module.exports = function(crowi) {
|
|
|
/**
|
|
/**
|
|
|
* default values when migrated from Official Crowi
|
|
* default values when migrated from Official Crowi
|
|
|
*/
|
|
*/
|
|
|
- function getDefaultCrowiConfigs()
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ function getDefaultCrowiConfigs() {
|
|
|
return {
|
|
return {
|
|
|
//'app:installed' : "0.0.0",
|
|
//'app:installed' : "0.0.0",
|
|
|
- 'app:title' : 'Crowi',
|
|
|
|
|
- 'app:confidential' : '',
|
|
|
|
|
-
|
|
|
|
|
- 'app:fileUpload' : false,
|
|
|
|
|
-
|
|
|
|
|
- 'security:restrictGuestMode' : 'Deny',
|
|
|
|
|
-
|
|
|
|
|
- 'security:registrationMode' : 'Open',
|
|
|
|
|
- 'security:registrationWhiteList' : [],
|
|
|
|
|
-
|
|
|
|
|
- 'security:isEnabledPassport' : false,
|
|
|
|
|
- 'security:passport-ldap:isEnabled' : false,
|
|
|
|
|
- 'security:passport-ldap:serverUrl' : undefined,
|
|
|
|
|
- 'security:passport-ldap:isUserBind' : undefined,
|
|
|
|
|
- 'security:passport-ldap:bindDN' : undefined,
|
|
|
|
|
- 'security:passport-ldap:bindDNPassword' : undefined,
|
|
|
|
|
- 'security:passport-ldap:searchFilter' : undefined,
|
|
|
|
|
- 'security:passport-ldap:attrMapUsername' : undefined,
|
|
|
|
|
- 'security:passport-ldap:groupSearchBase' : undefined,
|
|
|
|
|
- 'security:passport-ldap:groupSearchFilter' : undefined,
|
|
|
|
|
- 'security:passport-ldap:groupDnProperty' : undefined,
|
|
|
|
|
-
|
|
|
|
|
- 'aws:bucket' : 'crowi',
|
|
|
|
|
- 'aws:region' : 'ap-northeast-1',
|
|
|
|
|
- 'aws:accessKeyId' : '',
|
|
|
|
|
- 'aws:secretAccessKey' : '',
|
|
|
|
|
-
|
|
|
|
|
- 'mail:from' : '',
|
|
|
|
|
- 'mail:smtpHost' : '',
|
|
|
|
|
- 'mail:smtpPort' : '',
|
|
|
|
|
- 'mail:smtpUser' : '',
|
|
|
|
|
- 'mail:smtpPassword' : '',
|
|
|
|
|
-
|
|
|
|
|
- 'google:clientId' : '',
|
|
|
|
|
- 'google:clientSecret' : '',
|
|
|
|
|
-
|
|
|
|
|
- 'plugin:isEnabledPlugins' : true,
|
|
|
|
|
-
|
|
|
|
|
- 'customize:css' : '',
|
|
|
|
|
- 'customize:script' : '',
|
|
|
|
|
- 'customize:header' : '',
|
|
|
|
|
- 'customize:title' : '',
|
|
|
|
|
- 'customize:behavior' : 'crowi',
|
|
|
|
|
- 'customize:layout' : 'crowi',
|
|
|
|
|
- 'customize:isEnabledTimeline' : true,
|
|
|
|
|
- 'customize:isSavedStatesOfTabChanges' : true,
|
|
|
|
|
|
|
+ 'app:title': 'Crowi',
|
|
|
|
|
+ 'app:confidential': '',
|
|
|
|
|
+
|
|
|
|
|
+ 'app:fileUpload': false,
|
|
|
|
|
+
|
|
|
|
|
+ 'security:restrictGuestMode': 'Deny',
|
|
|
|
|
+
|
|
|
|
|
+ 'security:registrationMode': 'Open',
|
|
|
|
|
+ 'security:registrationWhiteList': [],
|
|
|
|
|
+
|
|
|
|
|
+ 'security:isEnabledPassport': false,
|
|
|
|
|
+ 'security:passport-ldap:isEnabled': false,
|
|
|
|
|
+ 'security:passport-ldap:serverUrl': undefined,
|
|
|
|
|
+ 'security:passport-ldap:isUserBind': undefined,
|
|
|
|
|
+ 'security:passport-ldap:bindDN': undefined,
|
|
|
|
|
+ 'security:passport-ldap:bindDNPassword': undefined,
|
|
|
|
|
+ 'security:passport-ldap:searchFilter': undefined,
|
|
|
|
|
+ 'security:passport-ldap:attrMapUsername': undefined,
|
|
|
|
|
+ 'security:passport-ldap:groupSearchBase': undefined,
|
|
|
|
|
+ 'security:passport-ldap:groupSearchFilter': undefined,
|
|
|
|
|
+ 'security:passport-ldap:groupDnProperty': undefined,
|
|
|
|
|
+
|
|
|
|
|
+ 'aws:bucket': 'crowi',
|
|
|
|
|
+ 'aws:region': 'ap-northeast-1',
|
|
|
|
|
+ 'aws:accessKeyId': '',
|
|
|
|
|
+ 'aws:secretAccessKey': '',
|
|
|
|
|
+
|
|
|
|
|
+ 'mail:from': '',
|
|
|
|
|
+ 'mail:smtpHost': '',
|
|
|
|
|
+ 'mail:smtpPort': '',
|
|
|
|
|
+ 'mail:smtpUser': '',
|
|
|
|
|
+ 'mail:smtpPassword': '',
|
|
|
|
|
+
|
|
|
|
|
+ 'google:clientId': '',
|
|
|
|
|
+ 'google:clientSecret': '',
|
|
|
|
|
+
|
|
|
|
|
+ 'plugin:isEnabledPlugins': true,
|
|
|
|
|
+
|
|
|
|
|
+ 'customize:css': '',
|
|
|
|
|
+ 'customize:script': '',
|
|
|
|
|
+ 'customize:header': '',
|
|
|
|
|
+ 'customize:title': '',
|
|
|
|
|
+ 'customize:highlightJsStyle': 'github',
|
|
|
|
|
+ 'customize:highlightJsStyleBorder': false,
|
|
|
|
|
+ 'customize:behavior': 'crowi',
|
|
|
|
|
+ 'customize:layout': 'crowi',
|
|
|
|
|
+ 'customize:isEnabledTimeline': true,
|
|
|
|
|
+ 'customize:isSavedStatesOfTabChanges': true,
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -97,7 +98,7 @@ module.exports = function(crowi) {
|
|
|
return {
|
|
return {
|
|
|
'markdown:isEnabledLinebreaks': true,
|
|
'markdown:isEnabledLinebreaks': true,
|
|
|
'markdown:isEnabledLinebreaksInComments': true,
|
|
'markdown:isEnabledLinebreaksInComments': true,
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function getValueForCrowiNS(config, key) {
|
|
function getValueForCrowiNS(config, key) {
|
|
@@ -109,8 +110,7 @@ module.exports = function(crowi) {
|
|
|
return config.crowi[key];
|
|
return config.crowi[key];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- configSchema.statics.getRestrictGuestModeLabels = function()
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.getRestrictGuestModeLabels = function() {
|
|
|
var labels = {};
|
|
var labels = {};
|
|
|
labels[SECURITY_RESTRICT_GUEST_MODE_DENY] = 'アカウントを持たないユーザーはアクセス不可';
|
|
labels[SECURITY_RESTRICT_GUEST_MODE_DENY] = 'アカウントを持たないユーザーはアクセス不可';
|
|
|
labels[SECURITY_RESTRICT_GUEST_MODE_READONLY] = '閲覧のみ許可';
|
|
labels[SECURITY_RESTRICT_GUEST_MODE_READONLY] = '閲覧のみ許可';
|
|
@@ -118,8 +118,7 @@ module.exports = function(crowi) {
|
|
|
return labels;
|
|
return labels;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.getRegistrationModeLabels = function()
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.getRegistrationModeLabels = function() {
|
|
|
var labels = {};
|
|
var labels = {};
|
|
|
labels[SECURITY_REGISTRATION_MODE_OPEN] = '公開 (だれでも登録可能)';
|
|
labels[SECURITY_REGISTRATION_MODE_OPEN] = '公開 (だれでも登録可能)';
|
|
|
labels[SECURITY_REGISTRATION_MODE_RESTRICTED] = '制限 (登録完了には管理者の承認が必要)';
|
|
labels[SECURITY_REGISTRATION_MODE_RESTRICTED] = '制限 (登録完了には管理者の承認が必要)';
|
|
@@ -128,11 +127,10 @@ module.exports = function(crowi) {
|
|
|
return labels;
|
|
return labels;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.updateConfigCache = function(ns, config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.updateConfigCache = function(ns, config) {
|
|
|
var originalConfig = crowi.getConfig();
|
|
var originalConfig = crowi.getConfig();
|
|
|
var newNSConfig = originalConfig[ns] || {};
|
|
var newNSConfig = originalConfig[ns] || {};
|
|
|
- Object.keys(config).forEach(function (key) {
|
|
|
|
|
|
|
+ Object.keys(config).forEach(function(key) {
|
|
|
if (config[key] || config[key] === '' || config[key] === false) {
|
|
if (config[key] || config[key] === '' || config[key] === false) {
|
|
|
newNSConfig[key] = config[key];
|
|
newNSConfig[key] = config[key];
|
|
|
}
|
|
}
|
|
@@ -147,10 +145,9 @@ module.exports = function(crowi) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// Execute only once for installing application
|
|
// Execute only once for installing application
|
|
|
- configSchema.statics.applicationInstall = function(callback)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.applicationInstall = function(callback) {
|
|
|
var Config = this;
|
|
var Config = this;
|
|
|
- Config.count({ ns: 'crowi' }, function (err, count) {
|
|
|
|
|
|
|
+ Config.count({ ns: 'crowi' }, function(err, count) {
|
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
|
return callback(new Error('Application already installed'), null);
|
|
return callback(new Error('Application already installed'), null);
|
|
|
}
|
|
}
|
|
@@ -162,8 +159,7 @@ module.exports = function(crowi) {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.setupCofigFormData = function(ns, config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.setupCofigFormData = function(ns, config) {
|
|
|
var defaultConfig = {};
|
|
var defaultConfig = {};
|
|
|
|
|
|
|
|
// set Default Settings
|
|
// set Default Settings
|
|
@@ -177,7 +173,7 @@ module.exports = function(crowi) {
|
|
|
if (!defaultConfig[ns]) {
|
|
if (!defaultConfig[ns]) {
|
|
|
defaultConfig[ns] = {};
|
|
defaultConfig[ns] = {};
|
|
|
}
|
|
}
|
|
|
- Object.keys(config[ns] || {}).forEach(function (key) {
|
|
|
|
|
|
|
+ Object.keys(config[ns] || {}).forEach(function(key) {
|
|
|
if (config[ns][key] !== undefined) {
|
|
if (config[ns][key] !== undefined) {
|
|
|
defaultConfig[key] = config[ns][key];
|
|
defaultConfig[key] = config[ns][key];
|
|
|
}
|
|
}
|
|
@@ -186,47 +182,43 @@ module.exports = function(crowi) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
- configSchema.statics.updateNamespaceByArray = function(ns, configs, callback)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.updateNamespaceByArray = function(ns, configs, callback) {
|
|
|
var Config = this;
|
|
var Config = this;
|
|
|
if (configs.length < 0) {
|
|
if (configs.length < 0) {
|
|
|
return callback(new Error('Argument #1 is not array.'), null);
|
|
return callback(new Error('Argument #1 is not array.'), null);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Object.keys(configs).forEach(function (key) {
|
|
|
|
|
|
|
+ Object.keys(configs).forEach(function(key) {
|
|
|
var value = configs[key];
|
|
var value = configs[key];
|
|
|
|
|
|
|
|
Config.findOneAndUpdate(
|
|
Config.findOneAndUpdate(
|
|
|
{ ns: ns, key: key },
|
|
{ ns: ns, key: key },
|
|
|
{ ns: ns, key: key, value: JSON.stringify(value) },
|
|
{ ns: ns, key: key, value: JSON.stringify(value) },
|
|
|
{ upsert: true, },
|
|
{ upsert: true, },
|
|
|
- function (err, config) {
|
|
|
|
|
|
|
+ function(err, config) {
|
|
|
debug('Config.findAndUpdate', err, config);
|
|
debug('Config.findAndUpdate', err, config);
|
|
|
- });
|
|
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
return callback(null, configs);
|
|
return callback(null, configs);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.findAndUpdate = function(ns, key, value, callback)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.findAndUpdate = function(ns, key, value, callback) {
|
|
|
var Config = this;
|
|
var Config = this;
|
|
|
Config.findOneAndUpdate(
|
|
Config.findOneAndUpdate(
|
|
|
{ ns: ns, key: key },
|
|
{ ns: ns, key: key },
|
|
|
{ ns: ns, key: key, value: JSON.stringify(value) },
|
|
{ ns: ns, key: key, value: JSON.stringify(value) },
|
|
|
{ upsert: true, },
|
|
{ upsert: true, },
|
|
|
- function (err, config) {
|
|
|
|
|
|
|
+ function(err, config) {
|
|
|
debug('Config.findAndUpdate', err, config);
|
|
debug('Config.findAndUpdate', err, config);
|
|
|
callback(err, config);
|
|
callback(err, config);
|
|
|
- });
|
|
|
|
|
|
|
+ });
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.getConfig = function(callback)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.getConfig = function(callback) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.loadAllConfig = function(callback)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.loadAllConfig = function(callback) {
|
|
|
var Config = this
|
|
var Config = this
|
|
|
, config = {};
|
|
, config = {};
|
|
|
config.crowi = {}; // crowi namespace
|
|
config.crowi = {}; // crowi namespace
|
|
@@ -252,8 +244,7 @@ module.exports = function(crowi) {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.isEnabledPassport = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.isEnabledPassport = function(config) {
|
|
|
// always true if crowi-plus installed cleanly
|
|
// always true if crowi-plus installed cleanly
|
|
|
if (Object.keys(config.crowi).length == 0) {
|
|
if (Object.keys(config.crowi).length == 0) {
|
|
|
return true;
|
|
return true;
|
|
@@ -263,18 +254,16 @@ module.exports = function(crowi) {
|
|
|
return getValueForCrowiNS(config, key);
|
|
return getValueForCrowiNS(config, key);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.isEnabledPassportLdap = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.isEnabledPassportLdap = function(config) {
|
|
|
const key = 'security:passport-ldap:isEnabled';
|
|
const key = 'security:passport-ldap:isEnabled';
|
|
|
return getValueForCrowiNS(config, key);
|
|
return getValueForCrowiNS(config, key);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.isUploadable = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.isUploadable = function(config) {
|
|
|
var method = crowi.env.FILE_UPLOAD || 'aws';
|
|
var method = crowi.env.FILE_UPLOAD || 'aws';
|
|
|
|
|
|
|
|
if (method == 'aws' && (
|
|
if (method == 'aws' && (
|
|
|
- !config.crowi['aws:accessKeyId'] ||
|
|
|
|
|
|
|
+ !config.crowi['aws:accessKeyId'] ||
|
|
|
!config.crowi['aws:secretAccessKey'] ||
|
|
!config.crowi['aws:secretAccessKey'] ||
|
|
|
!config.crowi['aws:region'] ||
|
|
!config.crowi['aws:region'] ||
|
|
|
!config.crowi['aws:bucket'])) {
|
|
!config.crowi['aws:bucket'])) {
|
|
@@ -284,8 +273,7 @@ module.exports = function(crowi) {
|
|
|
return method != 'none';
|
|
return method != 'none';
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.isGuesstAllowedToRead = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.isGuesstAllowedToRead = function(config) {
|
|
|
// return false if undefined
|
|
// return false if undefined
|
|
|
if (undefined === config.crowi || undefined === config.crowi['security:restrictGuestMode']) {
|
|
if (undefined === config.crowi || undefined === config.crowi['security:restrictGuestMode']) {
|
|
|
return false;
|
|
return false;
|
|
@@ -294,14 +282,12 @@ module.exports = function(crowi) {
|
|
|
return SECURITY_RESTRICT_GUEST_MODE_READONLY === config.crowi['security:restrictGuestMode'];
|
|
return SECURITY_RESTRICT_GUEST_MODE_READONLY === config.crowi['security:restrictGuestMode'];
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.isEnabledPlugins = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.isEnabledPlugins = function(config) {
|
|
|
const key = 'plugin:isEnabledPlugins';
|
|
const key = 'plugin:isEnabledPlugins';
|
|
|
return getValueForCrowiNS(config, key);
|
|
return getValueForCrowiNS(config, key);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.isEnabledLinebreaks = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.isEnabledLinebreaks = function(config) {
|
|
|
const key = 'markdown:isEnabledLinebreaks';
|
|
const key = 'markdown:isEnabledLinebreaks';
|
|
|
|
|
|
|
|
// return default value if undefined
|
|
// return default value if undefined
|
|
@@ -312,8 +298,7 @@ module.exports = function(crowi) {
|
|
|
return config.markdown[key];
|
|
return config.markdown[key];
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.isEnabledLinebreaksInComments = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.isEnabledLinebreaksInComments = function(config) {
|
|
|
const key = 'markdown:isEnabledLinebreaksInComments';
|
|
const key = 'markdown:isEnabledLinebreaksInComments';
|
|
|
|
|
|
|
|
// return default value if undefined
|
|
// return default value if undefined
|
|
@@ -327,70 +312,69 @@ module.exports = function(crowi) {
|
|
|
/**
|
|
/**
|
|
|
* initialize custom css strings
|
|
* initialize custom css strings
|
|
|
*/
|
|
*/
|
|
|
- configSchema.statics.initCustomCss = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.initCustomCss = function(config) {
|
|
|
const key = 'customize:css';
|
|
const key = 'customize:css';
|
|
|
const rawCss = getValueForCrowiNS(config, key);
|
|
const rawCss = getValueForCrowiNS(config, key);
|
|
|
// uglify and store
|
|
// uglify and store
|
|
|
this._customCss = uglifycss.processString(rawCss);
|
|
this._customCss = uglifycss.processString(rawCss);
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- configSchema.statics.customCss = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.customCss = function(config) {
|
|
|
return this._customCss;
|
|
return this._customCss;
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- configSchema.statics.initCustomScript = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.initCustomScript = function(config) {
|
|
|
const key = 'customize:script';
|
|
const key = 'customize:script';
|
|
|
const rawScript = getValueForCrowiNS(config, key);
|
|
const rawScript = getValueForCrowiNS(config, key);
|
|
|
// store as is
|
|
// store as is
|
|
|
this._customScript = rawScript;
|
|
this._customScript = rawScript;
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- configSchema.statics.customScript = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.customScript = function(config) {
|
|
|
return this._customScript;
|
|
return this._customScript;
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- configSchema.statics.customHeader = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.customHeader = function(config) {
|
|
|
const key = 'customize:header';
|
|
const key = 'customize:header';
|
|
|
return getValueForCrowiNS(config, key);
|
|
return getValueForCrowiNS(config, key);
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- configSchema.statics.customTitle = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.customTitle = function(config) {
|
|
|
const key = 'customize:title';
|
|
const key = 'customize:title';
|
|
|
return getValueForCrowiNS(config, key);
|
|
return getValueForCrowiNS(config, key);
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- configSchema.statics.behaviorType = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.behaviorType = function(config) {
|
|
|
const key = 'customize:behavior';
|
|
const key = 'customize:behavior';
|
|
|
return getValueForCrowiNS(config, key);
|
|
return getValueForCrowiNS(config, key);
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- configSchema.statics.layoutType = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.layoutType = function(config) {
|
|
|
const key = 'customize:layout';
|
|
const key = 'customize:layout';
|
|
|
return getValueForCrowiNS(config, key);
|
|
return getValueForCrowiNS(config, key);
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- configSchema.statics.isEnabledTimeline = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.highlightJsStyle = function(config) {
|
|
|
|
|
+ const key = 'customize:highlightJsStyle';
|
|
|
|
|
+ return getValueForCrowiNS(config, key);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ configSchema.statics.highlightJsStyleBorder = function(config) {
|
|
|
|
|
+ const key = 'customize:highlightJsStyleBorder';
|
|
|
|
|
+ return getValueForCrowiNS(config, key);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ configSchema.statics.isEnabledTimeline = function(config) {
|
|
|
const key = 'customize:isEnabledTimeline';
|
|
const key = 'customize:isEnabledTimeline';
|
|
|
return getValueForCrowiNS(config, key);
|
|
return getValueForCrowiNS(config, key);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.isSavedStatesOfTabChanges = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.isSavedStatesOfTabChanges = function(config) {
|
|
|
const key = 'customize:isSavedStatesOfTabChanges';
|
|
const key = 'customize:isSavedStatesOfTabChanges';
|
|
|
return getValueForCrowiNS(config, key);
|
|
return getValueForCrowiNS(config, key);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.fileUploadEnabled = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.fileUploadEnabled = function(config) {
|
|
|
const Config = this;
|
|
const Config = this;
|
|
|
|
|
|
|
|
if (!Config.isUploadable(config)) {
|
|
if (!Config.isUploadable(config)) {
|
|
@@ -401,13 +385,11 @@ module.exports = function(crowi) {
|
|
|
return !!config.crowi['app:fileUpload'];
|
|
return !!config.crowi['app:fileUpload'];
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.hasSlackConfig = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.hasSlackConfig = function(config) {
|
|
|
return Config.hasSlackWebClientConfig(config) || Config.hasSlackIwhUrl(config);
|
|
return Config.hasSlackWebClientConfig(config) || Config.hasSlackIwhUrl(config);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.hasSlackWebClientConfig = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.hasSlackWebClientConfig = function(config) {
|
|
|
if (!config.notification) {
|
|
if (!config.notification) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -422,24 +404,21 @@ module.exports = function(crowi) {
|
|
|
/**
|
|
/**
|
|
|
* for Slack Incoming Webhooks
|
|
* for Slack Incoming Webhooks
|
|
|
*/
|
|
*/
|
|
|
- configSchema.statics.hasSlackIwhUrl = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.hasSlackIwhUrl = function(config) {
|
|
|
if (!config.notification) {
|
|
if (!config.notification) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
return config.notification['slack:incomingWebhookUrl'];
|
|
return config.notification['slack:incomingWebhookUrl'];
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.isIncomingWebhookPrioritized = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.isIncomingWebhookPrioritized = function(config) {
|
|
|
if (!config.notification) {
|
|
if (!config.notification) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
return config.notification['slack:isIncomingWebhookPrioritized'];
|
|
return config.notification['slack:isIncomingWebhookPrioritized'];
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.hasSlackToken = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.hasSlackToken = function(config) {
|
|
|
if (!this.hasSlackWebClientConfig(config)) {
|
|
if (!this.hasSlackWebClientConfig(config)) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -451,8 +430,7 @@ module.exports = function(crowi) {
|
|
|
return true;
|
|
return true;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- configSchema.statics.getLocalconfig = function(config)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ configSchema.statics.getLocalconfig = function(config) {
|
|
|
const Config = this;
|
|
const Config = this;
|
|
|
const env = crowi.getEnv();
|
|
const env = crowi.getEnv();
|
|
|
|
|
|
|
@@ -476,7 +454,7 @@ module.exports = function(crowi) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
return local_config;
|
|
return local_config;
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
configSchema.statics.isInstalled = function(config)
|
|
configSchema.statics.isInstalled = function(config)
|