mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-23 23:04:04 +00:00
Update serwersms.js
Adds the ability to use group_id
This commit is contained in:
parent
c919d2c990
commit
1ece0faa76
1 changed files with 9 additions and 0 deletions
|
@ -17,6 +17,8 @@ class SerwerSMS extends NotificationProvider {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Użyj telefonu jako pierwszej opcji
|
||||||
let data = {
|
let data = {
|
||||||
"username": notification.serwersmsUsername,
|
"username": notification.serwersmsUsername,
|
||||||
"password": notification.serwersmsPassword,
|
"password": notification.serwersmsPassword,
|
||||||
|
@ -27,6 +29,13 @@ class SerwerSMS extends NotificationProvider {
|
||||||
|
|
||||||
let resp = await axios.post(url, data, config);
|
let resp = await axios.post(url, data, config);
|
||||||
|
|
||||||
|
if (!resp.data.success) {
|
||||||
|
// If unsuccessful, try using group_id
|
||||||
|
data.phone = null; // Clear phone number
|
||||||
|
data.group_id = notification.serwersmsPhoneNumber;
|
||||||
|
resp = await axios.post(url, data, config);
|
||||||
|
}
|
||||||
|
|
||||||
if (!resp.data.success) {
|
if (!resp.data.success) {
|
||||||
if (resp.data.error) {
|
if (resp.data.error) {
|
||||||
let error = `SerwerSMS.pl API returned error code ${resp.data.error.code} (${resp.data.error.type}) with error message: ${resp.data.error.message}`;
|
let error = `SerwerSMS.pl API returned error code ${resp.data.error.code} (${resp.data.error.type}) with error message: ${resp.data.error.message}`;
|
||||||
|
|
Loading…
Reference in a new issue