mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added Firebase Cloud Messaging support.
This commit is contained in:
parent
27a5817c5f
commit
3b2abf8498
5 changed files with 62 additions and 9 deletions
|
@ -678,7 +678,7 @@ function CreateMeshCentralServer(config, args) {
|
|||
}
|
||||
|
||||
// Check top level configuration for any unreconized values
|
||||
if (config) { for (var i in config) { if ((typeof i == 'string') && (i.length > 0) && (i[0] != '_') && (['settings', 'domaindefaults', 'domains', 'configfiles', 'smtp', 'letsencrypt', 'peers', 'sms', 'sendgrid', '$schema'].indexOf(i) == -1)) { addServerWarning('Unrecognized configuration option \"' + i + '\".'); } } }
|
||||
if (config) { for (var i in config) { if ((typeof i == 'string') && (i.length > 0) && (i[0] != '_') && (['settings', 'domaindefaults', 'domains', 'configfiles', 'smtp', 'letsencrypt', 'peers', 'sms', 'sendgrid', 'firebase', '$schema'].indexOf(i) == -1)) { addServerWarning('Unrecognized configuration option \"' + i + '\".'); } } }
|
||||
|
||||
if (typeof obj.args.userallowedip == 'string') { if (obj.args.userallowedip == '') { config.settings.userallowedip = obj.args.userallowedip = null; } else { config.settings.userallowedip = obj.args.userallowedip = obj.args.userallowedip.split(','); } }
|
||||
if (typeof obj.args.userblockedip == 'string') { if (obj.args.userblockedip == '') { config.settings.userblockedip = obj.args.userblockedip = null; } else { config.settings.userblockedip = obj.args.userblockedip = obj.args.userblockedip.split(','); } }
|
||||
|
@ -1544,6 +1544,18 @@ function CreateMeshCentralServer(config, args) {
|
|||
if ((obj.smsserver != null) && (obj.args.lanonly == true)) { addServerWarning("SMS gateway has limited use in LAN mode."); }
|
||||
}
|
||||
|
||||
// Setup Firebase
|
||||
if (config.firebase != null) {
|
||||
try {
|
||||
obj.firebase = require('firebase-admin');
|
||||
var firebaseServiceAccount = require(obj.path.join(obj.datapath, config.firebase.serviceaccountkeyfile));
|
||||
obj.firebase.initializeApp({ credential: obj.firebase.credential.cert(firebaseServiceAccount) });
|
||||
} catch (ex) {
|
||||
console.log('Unable to setup Firebase: ' + ex);
|
||||
delete obj.firebase;
|
||||
}
|
||||
}
|
||||
|
||||
// Start periodic maintenance
|
||||
obj.maintenanceTimer = setInterval(obj.maintenanceActions, 1000 * 60 * 60); // Run this every hour
|
||||
|
||||
|
@ -3053,6 +3065,9 @@ function mainStart() {
|
|||
if (NodeJSVer < 8) { console.log("SMS Plivo support requires Node v8 or above, current version is " + process.version + "."); } else { modules.push('plivo'); }
|
||||
}
|
||||
|
||||
// Firebase Support
|
||||
if (config.firebase != null) { modules.push('firebase-admin'); }
|
||||
|
||||
// Syslog support
|
||||
if ((require('os').platform() != 'win32') && (config.settings.syslog || config.settings.syslogjson)) { modules.push('modern-syslog'); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue