mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-01 19:32:34 +02:00
refactor(notification-providers): improve code for pushplus
This commit is contained in:
parent
ecd6b69eaf
commit
08718a9701
1 changed files with 8 additions and 4 deletions
|
@ -7,11 +7,15 @@ class PushPlus extends NotificationProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
* @param {BeanModel} notification Notification object
|
||||||
|
* @param {string} msg Message content
|
||||||
|
* @param {?object} monitorJSON Monitor details
|
||||||
|
* @param {?object} heartbeatJSON Heartbeat details
|
||||||
|
* @returns {Promise<string>} Success message
|
||||||
*/
|
*/
|
||||||
|
|
||||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
const okMsg = "Sent Successfully.";
|
const okMsg = "Sent Successfully.";
|
||||||
const url = `https://www.pushplus.plus/send`;
|
const url = "https://www.pushplus.plus/send";
|
||||||
try {
|
try {
|
||||||
await axios.post(url, {
|
await axios.post(url, {
|
||||||
"token": notification.pushPlusSendKey,
|
"token": notification.pushPlusSendKey,
|
||||||
|
@ -19,7 +23,7 @@ class PushPlus extends NotificationProvider {
|
||||||
"content": msg,
|
"content": msg,
|
||||||
"template": "html"
|
"template": "html"
|
||||||
}, { headers: { "Content-Type": "application/json" } }
|
}, { headers: { "Content-Type": "application/json" } }
|
||||||
);
|
);
|
||||||
return okMsg;
|
return okMsg;
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -47,4 +51,4 @@ class PushPlus extends NotificationProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = PushPlus;
|
module.exports = PushPlus;
|
||||||
|
|
Loading…
Add table
Reference in a new issue