Merge branch 'feature/enhanced-discord-webhook-alerts-5535' of github.com-0xsid0703:0xsid0703/uptime-kuma into feature/enhanced-discord-webhook-alerts-5535
# Conflicts: # server/model/monitor.js
This commit is contained in:
commit
20edcccd19
@ -121,17 +121,17 @@ class Discord extends NotificationProvider {
|
||||
let wentOfflineFormatted = null;
|
||||
if (heartbeatJSON["lastDownTime"]) {
|
||||
const wentOfflineTimestamp = Math.floor(new Date(heartbeatJSON["lastDownTime"]).getTime() / 1000);
|
||||
wentOfflineFormatted = `<t:${wentOfflineTimestamp}:F>`;
|
||||
wentOfflineFormatted = `<t:${wentOfflineTimestamp}:F>`;
|
||||
|
||||
// Calculate the actual duration between went offline and back online
|
||||
const durationSeconds = backOnlineTimestamp - wentOfflineTimestamp;
|
||||
|
||||
|
||||
// Format duration as human-readable string (e.g., "1h 23m", "45m 30s")
|
||||
// TODO: Update below to Intl.DurationFormat("en", { style: "short" }).format(duration) once we are on a newer node version
|
||||
const hours = Math.floor(durationSeconds / 3600);
|
||||
const minutes = Math.floor((durationSeconds % 3600) / 60);
|
||||
const seconds = durationSeconds % 60;
|
||||
|
||||
|
||||
const durationParts = [];
|
||||
if (hours > 0) {
|
||||
durationParts.push(`${hours}h`);
|
||||
@ -143,7 +143,7 @@ class Discord extends NotificationProvider {
|
||||
// Only show seconds if less than an hour
|
||||
durationParts.push(`${seconds}s`);
|
||||
}
|
||||
|
||||
|
||||
downtimeDuration = durationParts.length > 0 ? durationParts.join(" ") : "0s";
|
||||
}
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
"General Monitor Type": "General Monitor Type",
|
||||
"Passive Monitor Type": "Passive Monitor Type",
|
||||
"Specific Monitor Type": "Specific Monitor Type",
|
||||
"markdownSupported": "Markdown syntax supported",
|
||||
"markdownSupported": "Markdown syntax supported. If using HTML, avoid leading spaces to prevent formatting issues.",
|
||||
"pauseDashboardHome": "Pause",
|
||||
"Pause": "Pause",
|
||||
"Name": "Name",
|
||||
|
||||
@ -25,9 +25,7 @@
|
||||
class="form-control"
|
||||
data-testid="description-input"
|
||||
></textarea>
|
||||
<div class="form-text">
|
||||
{{ $t("markdownSupported") }}
|
||||
</div>
|
||||
<div class="form-text">{{ $t("markdownSupported") }}</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer Text -->
|
||||
@ -39,9 +37,7 @@
|
||||
class="form-control"
|
||||
data-testid="footer-text-input"
|
||||
></textarea>
|
||||
<div class="form-text">
|
||||
{{ $t("markdownSupported") }}
|
||||
</div>
|
||||
<div class="form-text">{{ $t("markdownSupported") }}</div>
|
||||
</div>
|
||||
|
||||
<div class="my-3">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user