mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-04-02 06:22:20 +00: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
|
||||
* @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) {
|
||||
const okMsg = "Sent Successfully.";
|
||||
const url = `https://www.pushplus.plus/send`;
|
||||
const url = "https://www.pushplus.plus/send";
|
||||
try {
|
||||
await axios.post(url, {
|
||||
"token": notification.pushPlusSendKey,
|
||||
|
@ -19,7 +23,7 @@ class PushPlus extends NotificationProvider {
|
|||
"content": msg,
|
||||
"template": "html"
|
||||
}, { headers: { "Content-Type": "application/json" } }
|
||||
);
|
||||
);
|
||||
return okMsg;
|
||||
|
||||
} catch (error) {
|
||||
|
@ -47,4 +51,4 @@ class PushPlus extends NotificationProvider {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = PushPlus;
|
||||
module.exports = PushPlus;
|
||||
|
|
Loading…
Add table
Reference in a new issue