mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-03-09 15:40:18 +00:00 
			
		
		
		
	Disabled Firebase support on NodeJS 23 for now, added warning.
This commit is contained in:
		
							parent
							
								
									975e49a190
								
							
						
					
					
						commit
						7bd5b66ebc
					
				
					 3 changed files with 31 additions and 9 deletions
				
			
		| 
						 | 
					@ -28,6 +28,10 @@ module.exports.CreateFirebase = function (parent, senderid, serverkey) {
 | 
				
			||||||
        receivedBadArgs: 0
 | 
					        receivedBadArgs: 0
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // In NodeJS v23, add util.isNullOrUndefined() to make node-xcs work correctly.
 | 
				
			||||||
 | 
					    // Remove this when node-xcs moves to support NodeJS v23
 | 
				
			||||||
 | 
					    if (require('util').isNullOrUndefined == null) { require('util').isNullOrUndefined = function (v) { return v == null; } }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    const Sender = require('node-xcs').Sender;
 | 
					    const Sender = require('node-xcs').Sender;
 | 
				
			||||||
    const Message = require('node-xcs').Message;
 | 
					    const Message = require('node-xcs').Message;
 | 
				
			||||||
    const Notification = require('node-xcs').Notification;
 | 
					    const Notification = require('node-xcs').Notification;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1992,15 +1992,31 @@ function CreateMeshCentralServer(config, args) {
 | 
				
			||||||
                        if (typeof config.settings.webpush.gcmapi == 'string') { webpush.setGCMAPIKey(config.settings.webpush.gcmapi); }
 | 
					                        if (typeof config.settings.webpush.gcmapi == 'string') { webpush.setGCMAPIKey(config.settings.webpush.gcmapi); }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    // Get the current node version
 | 
				
			||||||
 | 
					                    const verSplit = process.version.substring(1).split('.');
 | 
				
			||||||
 | 
					                    var nodeVersion = parseInt(verSplit[0]) + (parseInt(verSplit[1]) / 100);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // Setup Firebase
 | 
					                    // Setup Firebase
 | 
				
			||||||
                    if ((config.firebase != null) && (typeof config.firebase.senderid == 'string') && (typeof config.firebase.serverkey == 'string')) {
 | 
					                    if ((config.firebase != null) && (typeof config.firebase.senderid == 'string') && (typeof config.firebase.serverkey == 'string')) {
 | 
				
			||||||
                        obj.firebase = require('./firebase').CreateFirebase(obj, config.firebase.senderid, config.firebase.serverkey);
 | 
					                        if (nodeVersion >= 23) {
 | 
				
			||||||
 | 
					                            addServerWarning('Firebase is not supported on this version of NodeJS.', 27);
 | 
				
			||||||
 | 
					                        } else {
 | 
				
			||||||
 | 
					                            obj.firebase = require('./firebase').CreateFirebase(obj, config.firebase.senderid, config.firebase.serverkey);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                    } else if ((typeof config.firebaserelay == 'object') && (typeof config.firebaserelay.url == 'string')) {
 | 
					                    } else if ((typeof config.firebaserelay == 'object') && (typeof config.firebaserelay.url == 'string')) {
 | 
				
			||||||
                        // Setup the push messaging relay
 | 
					                        if (nodeVersion >= 23) {
 | 
				
			||||||
                        obj.firebase = require('./firebase').CreateFirebaseRelay(obj, config.firebaserelay.url, config.firebaserelay.key);
 | 
					                            addServerWarning('Firebase is not supported on this version of NodeJS.', 27);
 | 
				
			||||||
 | 
					                        } else {
 | 
				
			||||||
 | 
					                            // Setup the push messaging relay
 | 
				
			||||||
 | 
					                            obj.firebase = require('./firebase').CreateFirebaseRelay(obj, config.firebaserelay.url, config.firebaserelay.key);
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                    } else if (obj.config.settings.publicpushnotifications === true) {
 | 
					                    } else if (obj.config.settings.publicpushnotifications === true) {
 | 
				
			||||||
                        // Setup the Firebase push messaging relay using https://alt.meshcentral.com, this is the public push notification server.
 | 
					                        if (nodeVersion >= 23) {
 | 
				
			||||||
                        obj.firebase = require('./firebase').CreateFirebaseRelay(obj, 'https://alt.meshcentral.com/firebaserelay.aspx');
 | 
					                            addServerWarning('Firebase is not supported on this version of NodeJS.', 27);
 | 
				
			||||||
 | 
					                        } else {
 | 
				
			||||||
 | 
					                            // Setup the Firebase push messaging relay using https://alt.meshcentral.com, this is the public push notification server.
 | 
				
			||||||
 | 
					                            obj.firebase = require('./firebase').CreateFirebaseRelay(obj, 'https://alt.meshcentral.com/firebaserelay.aspx');
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    // Start periodic maintenance
 | 
					                    // Start periodic maintenance
 | 
				
			||||||
| 
						 | 
					@ -4112,7 +4128,8 @@ var ServerWarnings = {
 | 
				
			||||||
    23: "Unable to load agent icon file: {0}.",
 | 
					    23: "Unable to load agent icon file: {0}.",
 | 
				
			||||||
    24: "Unable to load agent logo file: {0}.",
 | 
					    24: "Unable to load agent logo file: {0}.",
 | 
				
			||||||
    25: "This NodeJS version does not support OpenID.",
 | 
					    25: "This NodeJS version does not support OpenID.",
 | 
				
			||||||
    26: "This NodeJS version does not support Discord.js."
 | 
					    26: "This NodeJS version does not support Discord.js.",
 | 
				
			||||||
 | 
					    27: "Firebase is not supported on this version of NodeJS."
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
*/
 | 
					*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4285,7 +4302,7 @@ function mainStart() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Firebase Support
 | 
					        // Firebase Support
 | 
				
			||||||
        // Avoid 0.1.8 due to bugs: https://github.com/guness/node-xcs/issues/43
 | 
					        // Avoid 0.1.8 due to bugs: https://github.com/guness/node-xcs/issues/43
 | 
				
			||||||
        if (config.firebase != null) { modules.push('node-xcs@0.1.7'); }
 | 
					        if (config.firebase != null) { modules.push('node-xcs@0.1.8'); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Syslog support
 | 
					        // Syslog support
 | 
				
			||||||
        if ((require('os').platform() != 'win32') && (config.settings.syslog || config.settings.syslogjson)) { modules.push('modern-syslog@1.2.0'); }
 | 
					        if ((require('os').platform() != 'win32') && (config.settings.syslog || config.settings.syslogjson)) { modules.push('modern-syslog@1.2.0'); }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
<!DOCTYPE html>
 | 
					<!DOCTYPE html>
 | 
				
			||||||
<html lang="en" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
 | 
					<html lang="en" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
 | 
				
			||||||
<head>
 | 
					<head>
 | 
				
			||||||
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
 | 
					    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
 | 
				
			||||||
| 
						 | 
					@ -2483,7 +2483,8 @@
 | 
				
			||||||
                            23: "Unable to load agent icon file: {0}.",
 | 
					                            23: "Unable to load agent icon file: {0}.",
 | 
				
			||||||
                            24: "Unable to load agent logo file: {0}.",
 | 
					                            24: "Unable to load agent logo file: {0}.",
 | 
				
			||||||
                            25: "This NodeJS version does not support OpenID.",
 | 
					                            25: "This NodeJS version does not support OpenID.",
 | 
				
			||||||
                            26: "This NodeJS version does not support Discord.js."
 | 
					                            26: "This NodeJS version does not support Discord.js.",
 | 
				
			||||||
 | 
					                            27: "Firebase is not supported on this version of NodeJS."
 | 
				
			||||||
                        };
 | 
					                        };
 | 
				
			||||||
                        var x = '';
 | 
					                        var x = '';
 | 
				
			||||||
                        for (var i in message.warnings) {
 | 
					                        for (var i in message.warnings) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue