Fixed Telegram proxy issue (#4703)

This commit is contained in:
Ylian Saint-Hilaire 2022-11-02 13:59:00 -07:00
parent 3a22bfbc24
commit 60af01a165
2 changed files with 6 additions and 3 deletions

View File

@ -142,9 +142,12 @@ module.exports.zeroPad = function(num, c) { if (c == null) { c = 2; } var s = '0
// Lowercase all the names in a object recursively
// Allow for exception keys, child of exceptions will not get lower-cased.
module.exports.objKeysToLower = function (obj, exceptions) {
// Exceptions is an array of "keyname" or "parent\keyname"
module.exports.objKeysToLower = function (obj, exceptions, parent) {
for (var i in obj) {
if ((typeof obj[i] == 'object') && ((exceptions == null) || (exceptions.indexOf(i.toLowerCase()) == -1))) { module.exports.objKeysToLower(obj[i], exceptions); } // LowerCase all key names in the child object
if ((typeof obj[i] == 'object') && ((exceptions == null) || (exceptions.indexOf(i.toLowerCase()) == -1)) && ((parent != null) && (exceptions.indexOf(parent.toLowerCase() + '/' + i.toLowerCase()) == -1))) {
module.exports.objKeysToLower(obj[i], exceptions, i); // LowerCase all key names in the child object
}
if (i.toLowerCase() !== i) { obj[i.toLowerCase()] = obj[i]; delete obj[i]; } // LowerCase all key names
}
return obj;

View File

@ -1202,7 +1202,7 @@ function CreateMeshCentralServer(config, args) {
for (i in args) { config2.settings[i] = args[i]; }
// Lower case all keys in the config file
common.objKeysToLower(config2, ['ldapoptions', 'defaultuserwebstate', 'forceduserwebstate', 'httpheaders']);
common.objKeysToLower(config2, ['ldapoptions', 'defaultuserwebstate', 'forceduserwebstate', 'httpheaders', 'telegram/proxy']);
// Grab some of the values from the original config.json file if present.
config2['mysql'] = config['mysql'];