mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-10-29 15:25:01 -04:00 
			
		
		
		
	fix ntfy missing user-agent #6488
Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
		
							parent
							
								
									438289b2ed
								
							
						
					
					
						commit
						7928f7fb30
					
				| @ -352,9 +352,9 @@ module.exports.CreateServer = function (parent) { | |||||||
|             push.send(domain.title ? domain.title : 'MeshCentral', msg, function (err, res) { if (func != null) { func(err == null); } }); |             push.send(domain.title ? domain.title : 'MeshCentral', msg, function (err, res) { if (func != null) { func(err == null); } }); | ||||||
|         } else if ((to.startsWith('ntfy:')) && (obj.ntfyClient != null)) { // ntfy
 |         } else if ((to.startsWith('ntfy:')) && (obj.ntfyClient != null)) { // ntfy
 | ||||||
|             const url = 'https://' + (((typeof parent.config.messaging.ntfy == 'object') && (typeof parent.config.messaging.ntfy.host == 'string')) ? parent.config.messaging.ntfy.host : 'ntfy.sh') + '/' + encodeURIComponent(to.substring(5)); |             const url = 'https://' + (((typeof parent.config.messaging.ntfy == 'object') && (typeof parent.config.messaging.ntfy.host == 'string')) ? parent.config.messaging.ntfy.host : 'ntfy.sh') + '/' + encodeURIComponent(to.substring(5)); | ||||||
|             const headers = (typeof parent.config.messaging.ntfy.authorization  == 'string') ? { 'Authorization': parent.config.messaging.ntfy.authorization } : {}; |             const headers = { 'User-Agent': 'MeshCentral v' + parent.currentVer }; | ||||||
|             const req = require('https').request(new URL(url), { method: 'POST', headers: headers }, function (res) { if (func != null) { func(true); } }); |             if (typeof parent.config.messaging.ntfy.authorization  == 'string') { headers['Authorization'] = parent.config.messaging.ntfy.authorization; } | ||||||
|             req.on('error', function (err) { if (func != null) { func(false); } }); |             const req = require('https').request(new URL(url), { method: 'POST', headers: headers }, function (res) { if (func != null) { func(res.statusCode == 200); } }); | ||||||
|             req.end(msg); |             req.end(msg); | ||||||
|         } else if ((to.startsWith('zulip:')) && (obj.zulipClient != null)) { // zulip
 |         } else if ((to.startsWith('zulip:')) && (obj.zulipClient != null)) { // zulip
 | ||||||
|             obj.zulipClient.sendMessage({ |             obj.zulipClient.sendMessage({ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user