diff --git a/beszel/internal/alerts/alerts.go b/beszel/internal/alerts/alerts.go
index 77422b3..e2c5550 100644
--- a/beszel/internal/alerts/alerts.go
+++ b/beszel/internal/alerts/alerts.go
@@ -185,46 +185,47 @@ func (am *AlertManager) sendAlert(data AlertData) {
}
func (am *AlertManager) SendShoutrrrAlert(notificationUrl, title, message, link, linkText string) error {
+ // services that support title param
supportsTitle := []string{"bark", "discord", "gotify", "ifttt", "join", "matrix", "ntfy", "opsgenie", "pushbullet", "pushover", "slack", "teams", "telegram", "zulip"}
- supportsLink := []string{"ntfy"}
+
// Parse the URL
parsedURL, err := url.Parse(notificationUrl)
if err != nil {
return fmt.Errorf("error parsing URL: %v", err)
}
-
scheme := parsedURL.Scheme
-
- // // Get query parameters
queryParams := parsedURL.Query()
// Add title
- if !sliceContains(supportsTitle, scheme) {
- message = title + "\n\n" + message
- } else {
+ if sliceContains(supportsTitle, scheme) {
queryParams.Add("title", title)
-
- }
- // Add link
- if !sliceContains(supportsLink, scheme) {
- // add link to the message
- message += "\n\n" + link
- } else {
- // ntfy link
- if scheme == "ntfy" {
- queryParams.Add("Actions", fmt.Sprintf("view, %s, %s", linkText, link))
+ } else if scheme == "mattermost" {
+ // use markdown title for mattermost
+ message = "##### " + title + "\n\n" + message
+ } else if scheme == "generic" && queryParams.Has("template") {
+ // add title as property if using generic with template json
+ titleKey := queryParams.Get("titlekey")
+ if titleKey == "" {
+ titleKey = "title"
}
+ queryParams.Add("$"+titleKey, title)
+ } else {
+ // otherwise just add title to message
+ message = title + "\n\n" + message
}
- //
- if scheme == "generic" {
- queryParams.Add("template", "json")
- queryParams.Add("$title", title)
+ // Add link
+ if scheme == "ntfy" {
+ // if ntfy, add link to actions
+ queryParams.Add("Actions", fmt.Sprintf("view, %s, %s", linkText, link))
+ } else {
+ // else add link directly to the message
+ message += "\n\n" + link
}
// Encode the modified query parameters back into the URL
parsedURL.RawQuery = queryParams.Encode()
- log.Println("URL after modification:", parsedURL.String())
+ // log.Println("URL after modification:", parsedURL.String())
err = shoutrrr.Send(parsedURL.String(), message)
diff --git a/beszel/site/src/components/routes/settings/general.tsx b/beszel/site/src/components/routes/settings/general.tsx
index 71c9bfb..00dea21 100644
--- a/beszel/site/src/components/routes/settings/general.tsx
+++ b/beszel/site/src/components/routes/settings/general.tsx
@@ -9,6 +9,7 @@ import {
} from '@/components/ui/select'
import { chartTimeData } from '@/lib/utils'
import { Separator } from '@/components/ui/separator'
+import { SaveIcon } from 'lucide-react'
export default function SettingsProfilePage() {
return (
@@ -20,8 +21,11 @@ export default function SettingsProfilePage() {
Adjust display options for charts.
+- Sets the default time range for charts. + Sets the default time range for charts when a system is viewed.
- Get notified when new alerts are created. + Leave the emails field to disable email notifications.
Beszel uses{' '} Shoutrrr {' '} to integrate with popular notification services.
-