From 6ab5a97ada335c31c03b6596487bde836758a971 Mon Sep 17 00:00:00 2001
From: szerencl <57007996+szerencl@users.noreply.github.com>
Date: Sat, 7 Oct 2023 00:29:23 +0200
Subject: [PATCH] Added sound option for pushover

---
 docs/notif/pushover.md            | 6 ++++++
 internal/model/notif_pushover.go  | 1 +
 internal/notif/pushover/client.go | 1 +
 3 files changed, 8 insertions(+)

diff --git a/docs/notif/pushover.md b/docs/notif/pushover.md
index 6cf61d1f..03a81d13 100644
--- a/docs/notif/pushover.md
+++ b/docs/notif/pushover.md
@@ -10,6 +10,8 @@ You can send notifications using [Pushover](https://pushover.net/).
       pushover:
         token: uQiRzpo4DXghDmr9QzzfQu27cmVRsG
         recipient: gznej3rKEVAvPUxu9vvNnqpmZpokzF
+        priority: -2
+        sound: none
         templateTitle: "{{ .Entry.Image }} released"
         templateBody: |
           Docker tag {{ .Entry.Image }} which you subscribed to through {{ .Entry.Provider }} provider has been released.
@@ -21,6 +23,8 @@ You can send notifications using [Pushover](https://pushover.net/).
 | `tokenFile`         |                                     | Use content of secret file as Pushover application/API token if `token` not defined |
 | `recipient`         |                                     | User key to send notification to                                                    |
 | `recipientFile`     |                                     | Use content of secret file as User key if `recipient` not defined                   |
+| `priority`          |                                     | Priority of the notification                                                        |
+| `sound`             |                                     | Notification sound to be used                                                       |
 | `templateTitle`[^1] | See [below](#default-templatetitle) | [Notification template](../faq.md#notification-template) for message title          |
 | `templateBody`[^1]  | See [below](#default-templatebody)  | [Notification template](../faq.md#notification-template) for message body           |
 
@@ -29,6 +33,8 @@ You can send notifications using [Pushover](https://pushover.net/).
     * `DIUN_NOTIF_PUSHOVER_TOKENFILE`
     * `DIUN_NOTIF_PUSHOVER_RECIPIENT`
     * `DIUN_NOTIF_PUSHOVER_RECIPIENTFILE`
+    * `DIUN_NOTIF_PUSHOVER_PRIORITY`
+    * `DIUN_NOTIF_PUSHOVER_SOUND`
     * `DIUN_NOTIF_PUSHOVER_TEMPLATETITLE`
     * `DIUN_NOTIF_PUSHOVER_TEMPLATEBODY`
 
diff --git a/internal/model/notif_pushover.go b/internal/model/notif_pushover.go
index df709fba..76907449 100644
--- a/internal/model/notif_pushover.go
+++ b/internal/model/notif_pushover.go
@@ -7,6 +7,7 @@ type NotifPushover struct {
 	Recipient     string `yaml:"recipient,omitempty" json:"recipient,omitempty" validate:"omitempty"`
 	RecipientFile string `yaml:"recipientFile,omitempty" json:"recipientFile,omitempty" validate:"omitempty,file"`
 	Priority      int    `yaml:"priority,omitempty" json:"priority,omitempty" validate:"omitempty,min=-2,max=2"`
+	Sound         string `yaml:"sound,omitempty" json:"sound,omitempty" validate:"omitempty"`
 	TemplateTitle string `yaml:"templateTitle,omitempty" json:"templateTitle,omitempty" validate:"required"`
 	TemplateBody  string `yaml:"templateBody,omitempty" json:"templateBody,omitempty" validate:"required"`
 }
diff --git a/internal/notif/pushover/client.go b/internal/notif/pushover/client.go
index 2fb7b9ce..2f0ddafb 100644
--- a/internal/notif/pushover/client.go
+++ b/internal/notif/pushover/client.go
@@ -64,6 +64,7 @@ func (c *Client) Send(entry model.NotifEntry) error {
 		Title:     string(title),
 		Message:   string(body),
 		Priority:  c.cfg.Priority,
+		Sound:     c.cfg.Sound,
 		URL:       c.meta.URL,
 		URLTitle:  c.meta.Name,
 		Timestamp: time.Now().Unix(),