Skip to content

Commit

Permalink
(fix) resolve issue with snapshot not working with multiple alert met…
Browse files Browse the repository at this point in the history
…hods configured
  • Loading branch information
0x2142 committed Nov 30, 2023
1 parent c7a4331 commit e771087
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions notifier/alerts.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package notifier

import (
"bytes"
"io"
)

Expand All @@ -11,13 +12,15 @@ var AlertTitle = "Frigate Alert"

// SendAlert forwards alert information to all enabled alerting methods
func SendAlert(message, snapshotURL string, snapshot io.Reader) {
// Create copy of snapshot for each alerting method
snap, _ := io.ReadAll(snapshot)
if DiscordEnabled {
SendDiscordMessage(message, snapshot)
SendDiscordMessage(message, bytes.NewReader(snap))
}
if GotifyEnabled {
SendGotifyPush(message, snapshotURL)
}
if SMTPEnabled {
SendSMTP(message, snapshot)
SendSMTP(message, bytes.NewReader(snap))
}
}

0 comments on commit e771087

Please sign in to comment.