1
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2025-11-23 22:37:10 +02:00

Shorten text for SMSIR Notification provider (#6365)

Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
Amirparsa Baghdadi
2025-11-19 14:22:09 +03:30
committed by GitHub
parent 5701a97ad9
commit c31ea9c891

View File

@@ -32,6 +32,15 @@ class SMSIR extends NotificationProvider {
return mobile; return mobile;
}); });
const MAX_MESSAGE_LENGTH = 25; // This is a limitation placed by SMSIR
// Shorten By removing spaces, keeping context is better than cutting off the text
// If that does not work, truncate. Still better than not receiving an SMS
if (msg.length > MAX_MESSAGE_LENGTH && msg.replace(/\s/g, ""). length <= MAX_MESSAGE_LENGTH) {
msg = msg.replace(/\s/g, "");
} else if (msg.length > MAX_MESSAGE_LENGTH) {
msg = msg.substring(0, MAX_MESSAGE_LENGTH - 1 - "...".length) + "...";
}
// Run multiple network requests at once // Run multiple network requests at once
const requestPromises = formattedMobiles const requestPromises = formattedMobiles
.map(mobile => { .map(mobile => {