mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-01-14 16:24:59 -05:00
add authorization to ntfy
Signed-off-by: Simon Smith <simonsmith5521@gmail.com>
This commit is contained in:
parent
31bb6d7864
commit
d8d13bda42
@ -3410,6 +3410,10 @@ See description for information about each item.
|
|||||||
"userurl": {
|
"userurl": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "A URL given to users to help them setup this service."
|
"description": "A URL given to users to help them setup this service."
|
||||||
|
},
|
||||||
|
"authorization": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Authorization Header to include in the request"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": "Enabled ntfy.sh integration support."
|
"description": "Enabled ntfy.sh integration support."
|
||||||
|
@ -202,7 +202,8 @@ For [self-hosting your own ntfy server](https://ntfy.sh/docs/install/) with [ACL
|
|||||||
"messaging": {
|
"messaging": {
|
||||||
"ntfy": {
|
"ntfy": {
|
||||||
"host": "https://[my]ntfy.sh",
|
"host": "https://[my]ntfy.sh",
|
||||||
"userurl": "https://[my]ntfy.sh/userhelp"
|
"userurl": "https://[my]ntfy.sh/userhelp",
|
||||||
|
"authorization": "Basic cGhpbDpteXBhc3M="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3408,6 +3408,10 @@
|
|||||||
"userurl": {
|
"userurl": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "A URL given to users to help them setup this service."
|
"description": "A URL given to users to help them setup this service."
|
||||||
|
},
|
||||||
|
"authorization": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Authorization Header to include in the request"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description": "Enabled ntfy.sh integration support."
|
"description": "Enabled ntfy.sh integration support."
|
||||||
|
@ -335,7 +335,8 @@ 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 req = require('https').request(new URL(url), { method: 'POST' }, function (res) { if (func != null) { func(true); } });
|
const headers = (typeof parent.config.messaging.ntfy.authorization == 'string') ? { 'Authorization': parent.config.messaging.ntfy.authorization } : {};
|
||||||
|
const req = require('https').request(new URL(url), { method: 'POST', headers: headers }, function (res) { if (func != null) { func(true); } });
|
||||||
req.on('error', function (err) { if (func != null) { func(false); } });
|
req.on('error', function (err) { if (func != null) { func(false); } });
|
||||||
req.end(msg);
|
req.end(msg);
|
||||||
} else if ((to.startsWith('zulip:')) && (obj.zulipClient != null)) { // zulip
|
} else if ((to.startsWith('zulip:')) && (obj.zulipClient != null)) { // zulip
|
||||||
|
@ -628,6 +628,11 @@
|
|||||||
"_discord": {
|
"_discord": {
|
||||||
"serverurl": "https://discord.gg/xxxxxxxxx",
|
"serverurl": "https://discord.gg/xxxxxxxxx",
|
||||||
"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
"token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
},
|
||||||
|
"_ntfy": {
|
||||||
|
"host": "https://[my]ntfy.sh",
|
||||||
|
"userurl": "https://[my]ntfy.sh/userhelp",
|
||||||
|
"authorization": "Basic xxxxxxxxxxxxxxxxxxxx"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user