fix(notifications): Pushover and Telegram formatting (#1362)

* fix(notifications): Pushover and Telegram formatting

* fix(notifications): html builder

* fix(notifications): escape html

* fix(notifications): escaping
This commit is contained in:
ze0s 2024-01-23 13:03:20 +01:00 committed by GitHub
parent c377bc9157
commit ae4427175f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 140 additions and 38 deletions

View file

@ -33,7 +33,7 @@ type pushoverSender struct {
log zerolog.Logger
Settings domain.Notification
baseUrl string
builder NotificationBuilderPlainText
builder MessageBuilderHTML
httpClient *http.Client
}
@ -43,7 +43,7 @@ func NewPushoverSender(log zerolog.Logger, settings domain.Notification) domain.
log: log.With().Str("sender", "pushover").Logger(),
Settings: settings,
baseUrl: "https://api.pushover.net/1/messages.json",
builder: NotificationBuilderPlainText{},
builder: MessageBuilderHTML{},
httpClient: &http.Client{
Timeout: time.Second * 30,
Transport: sharedhttp.Transport,
@ -52,8 +52,7 @@ func NewPushoverSender(log zerolog.Logger, settings domain.Notification) domain.
}
func (s *pushoverSender) Send(event domain.NotificationEvent, payload domain.NotificationPayload) error {
title := s.builder.BuildTitle(event)
title := BuildTitle(event)
message := s.builder.BuildBody(payload)
m := pushoverMessage{