Compare commits

...

3 commits

Author SHA1 Message Date
DayShift
cc0d7f64c9
Merge 16ab2425e5 into 7dc6191b0a 2025-01-25 17:29:01 +00:00
DayShift
16ab2425e5
Update whapi.js
More concise and reasonable regular expression fix
2025-01-26 01:28:58 +08:00
DayShift
84d67a239b
Update server/notification-providers/pushdeer.js
More concise and reasonable regular expression fix

Co-authored-by: Frank Elsinga <frank@elsinga.de>
2025-01-26 01:15:39 +08:00
2 changed files with 3 additions and 2 deletions

View file

@ -11,7 +11,8 @@ class PushDeer extends NotificationProvider {
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const serverUrl = notification.pushdeerServer || "https://api2.pushdeer.com";
const url = `${serverUrl.trim().replace(/(?<!\/)\/*$/, "")}/message/push`;
// capture group below is nessesary to prevent an ReDOS-attack
const url = `${serverUrl.trim().replace(/([^\/])\/+$/, "$1")}/message/push`;
let valid = msg != null && monitorJSON != null && heartbeatJSON != null;

View file

@ -24,7 +24,7 @@ class Whapi extends NotificationProvider {
"body": msg,
};
let url = (notification.whapiApiUrl || "https://gate.whapi.cloud/").replace(/(?<!\/)\/*$/, "") + "/messages/text";
let url = (notification.whapiApiUrl || "https://gate.whapi.cloud/").replace(/([^\/])\/+$/, "$1") + "/messages/text";
await axios.post(url, data, config);