Skip to content

Modern Docker Management, Designed for Everyone

feat: add pushover notifcation provider (#1516)

Kyle Mendell017513343606
diff --git a/backend/internal/huma/handlers/notifications.go b/backend/internal/huma/handlers/notifications.go
index acf8d8360..5a331893f 100644
--- a/backend/internal/huma/handlers/notifications.go
+++ b/backend/internal/huma/handlers/notifications.go
@@ -217,13 +217,7 @@ func (h *NotificationHandler) CreateOrUpdateNotificationSettings(ctx context.Con
return nil, err
}
provider := models.NotificationProvider(input.Body.Provider)
- if provider != models.NotificationProviderDiscord &&
- provider != models.NotificationProviderEmail &&
- provider != models.NotificationProviderTelegram &&
- provider != models.NotificationProviderSignal &&
- provider != models.NotificationProviderSlack &&
- provider != models.NotificationProviderNtfy &&
- provider != models.NotificationProviderGeneric {
+ if !models.IsValidNotificationProvider(provider) {
return nil, huma.Error400BadRequest((&common.InvalidNotificationProviderError{}).Error())
}
diff --git a/backend/internal/models/notification.go b/backend/internal/models/notification.go
index f46c3e48e..d3a85c377 100644
--- a/backend/internal/models/notification.go
+++ b/backend/internal/models/notification.go
@@ -13,9 +13,26 @@ const (
NotificationProviderSignal NotificationProvider = "signal"
NotificationProviderSlack NotificationProvider = "slack"
NotificationProviderNtfy NotificationProvider = "ntfy"
+ NotificationProviderPushover NotificationProvider = "pushover"
NotificationProviderGeneric NotificationProvider = "generic"
)
+var validNotificationProviders = map[NotificationProvider]struct{}{
+ NotificationProviderDiscord: {},
+ NotificationProviderEmail: {},
+ NotificationProviderTelegram: {},
+ NotificationProviderSignal: {},
+ NotificationProviderSlack: {},
+ NotificationProviderNtfy: {},
+ NotificationProviderPushover: {},
+ NotificationProviderGeneric: {},
+}
+
+func IsValidNotificationProvider(provider NotificationProvider) bool {
+ _, ok := validNotificationProviders[provider]
+ return ok
+}
+
type NotificationEventType string
const (
@@ -127,6 +144,15 @@ type NtfyConfig struct {
Events map[NotificationEventType]bool `json:"events,omitempty"`
}
+type PushoverConfig struct {
+ Token string `json:"token"`
+ User string `json:"user"`
+ Devices []string `json:"devices,omitempty"`
+ Priority int8 `json:"priority"`
+ Title string `json:"title,omitempty"`
+ Events map[NotificationEventType]bool `json:"events,omitempty"`
+}
+
type GenericConfig struct {
WebhookURL string `json:"webhookUrl"`
Method string `json:"method,omitempty"`
diff --git a/backend/internal/services/notification_service.go b/backend/internal/services/notification_service.go
index a45051327..9366d2104 100644
--- a/backend/internal/services/notification_service.go
+++ b/backend/internal/services/notification_service.go
@@ -127,6 +127,8 @@ func (s *NotificationService) SendImageUpdateNotification(ctx context.Context, i
sendErr = s.sendSlackNotification(ctx, imageRef, updateInfo, setting.Config)
case models.NotificationProviderNtfy:
sendErr = s.sendNtfyNotification(ctx, imageRef, updateInfo, setting.Config)
+ case models.NotificationProviderPushover:
+ sendErr = s.sendPushoverNotification(ctx, imageRef, updateInfo, setting.Config)
case models.NotificationProviderGeneric:
sendErr = s.sendGenericNotification(ctx, imageRef, updateInfo, setting.Config)
default:
@@ -220,6 +222,8 @@ func (s *NotificationService) SendContainerUpdateNotification(ctx context.Contex
sendErr = s.sendSlackContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)
case models.NotificationProviderNtfy:
sendErr = s.sendNtfyContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)
+ case models.NotificationProviderPushover:
+ sendErr = s.sendPushoverContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)
case models.NotificationProviderGeneric:
sendErr = s.sendGenericContainerUpdateNotification(ctx, containerName, imageRef, oldDigest, newDigest, setting.Config)
default:
@@ -707,6 +711,8 @@ func (s *NotificationService) TestNotification(ctx context.Context, provider mod
return s.sendSlackNotification(ctx, "nginx:latest", testUpdate, setting.Config)
case models.NotificationProviderNtfy:
return s.sendNtfyNotification(ctx, "test/image:latest", testUpdate, setting.Config)
+ case models.NotificationProviderPushover:
+ return s.sendPushoverNotification(ctx, "test/image:latest", testUpdate, setting.Config)
case models.NotificationProviderGeneric:
return s.sendGenericNotification(ctx, "test/image:latest", testUpdate, setting.Config)
default:
@@ -865,6 +871,8 @@ func (s *NotificationService) SendBatchImageUpdateNotification(ctx context.Conte
sendErr = s.sendBatchSlackNotification(ctx, updatesWithChanges, setting.Config)
case models.NotificationProviderNtfy:
sendErr = s.sendBatchNtfyNotification(ctx, updatesWithChanges, setting.Config)
+ case models.NotificationProviderPushover:
+ sendErr = s.sendBatchPushoverNotification(ctx, updatesWithChanges, setting.Config)
case models.NotificationProviderGeneric:
sendErr = s.sendBatchGenericNotification(ctx, updatesWithChanges, setting.Config)
default:
@@ -1571,6 +1579,146 @@ func (s *NotificationService) sendBatchNtfyNotification(ctx context.Context, upd
return nil
}
+func (s *NotificationService) sendPushoverNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {
+ var pushoverConfig models.PushoverConfig
+ configBytes, err := json.Marshal(config)
+ if err != nil {
+ return fmt.Errorf("failed to marshal Pushover config: %w", err)
+ }
+ if err := json.Unmarshal(configBytes, &pushoverConfig); err != nil {
+ return fmt.Errorf("failed to unmarshal Pushover config: %w", err)
+ }
+
+ if pushoverConfig.Token == "" {
+ return fmt.Errorf("pushover API token not configured")
+ }
+ if pushoverConfig.User == "" {
+ return fmt.Errorf("pushover user key not configured")
+ }
+
+ if pushoverConfig.Token != "" {
+ if decrypted, err := crypto.Decrypt(pushoverConfig.Token); err == nil {
+ pushoverConfig.Token = decrypted
+ } else {
+ slog.Warn("Failed to decrypt Pushover token, using raw value (may be unencrypted legacy value)", "error", err)
+ }
+ }
+
+ updateStatus := "No Update"
+ if updateInfo.HasUpdate {
+ updateStatus = "⚠️ Update Available"
+ }
+
+ message := fmt.Sprintf("🔔 Container Image Update Notification\n\n"+
+ "Image: %s\n"+
+ "Status: %s\n"+
+ "Update Type: %s\n",
+ imageRef, updateStatus, updateInfo.UpdateType)
+
+ if updateInfo.CurrentDigest != "" {
+ message += fmt.Sprintf("Current Digest: %s\n", updateInfo.CurrentDigest)
+ }
+ if updateInfo.LatestDigest != "" {
+ message += fmt.Sprintf("Latest Digest: %s\n", updateInfo.LatestDigest)
+ }
+
+ if err := notifications.SendPushover(ctx, pushoverConfig, message); err != nil {
+ return fmt.Errorf("failed to send Pushover notification: %w", err)
+ }
+
+ return nil
+}
+
+func (s *NotificationService) sendPushoverContainerUpdateNotification(ctx context.Context, containerName, imageRef, oldDigest, newDigest string, config models.JSON) error {
+ var pushoverConfig models.PushoverConfig
+ configBytes, err := json.Marshal(config)
+ if err != nil {
+ return fmt.Errorf("failed to marshal Pushover config: %w", err)
+ }
+ if err := json.Unmarshal(configBytes, &pushoverConfig); err != nil {
+ return fmt.Errorf("failed to unmarshal Pushover config: %w", err)
+ }
+
+ if pushoverConfig.Token == "" {
+ return fmt.Errorf("pushover API token not configured")
+ }
+ if pushoverConfig.User == "" {
+ return fmt.Errorf("pushover user key not configured")
+ }
+
+ if pushoverConfig.Token != "" {
+ if decrypted, err := crypto.Decrypt(pushoverConfig.Token); err == nil {
+ pushoverConfig.Token = decrypted
+ } else {
+ slog.Warn("Failed to decrypt Pushover token, using raw value (may be unencrypted legacy value)", "error", err)
+ }
+ }
+
+ message := fmt.Sprintf("✅ Container Successfully Updated\n\n"+
+ "Your container has been updated with the latest image version.\n\n"+
+ "Container: %s\n"+
+ "Image: %s\n"+
+ "Status: ✅ Updated Successfully\n",
+ containerName, imageRef)
+
+ if oldDigest != "" {
+ message += fmt.Sprintf("Previous Version: %s\n", oldDigest)
+ }
+ if newDigest != "" {
+ message += fmt.Sprintf("Current Version: %s\n", newDigest)
+ }
+
+ if err := notifications.SendPushover(ctx, pushoverConfig, message); err != nil {
+ return fmt.Errorf("failed to send Pushover notification: %w", err)
+ }
+
+ return nil
+}
+
+func (s *NotificationService) sendBatchPushoverNotification(ctx context.Context, updates map[string]*imageupdate.Response, config models.JSON) error {
+ var pushoverConfig models.PushoverConfig
+ configBytes, err := json.Marshal(config)
+ if err != nil {
+ return fmt.Errorf("failed to marshal pushover config: %w", err)
+ }
+ if err := json.Unmarshal(configBytes, &pushoverConfig); err != nil {
+ return fmt.Errorf("failed to unmarshal pushover config: %w", err)
+ }
+
+ if pushoverConfig.Token != "" {
+ if decrypted, err := crypto.Decrypt(pushoverConfig.Token); err == nil {
+ pushoverConfig.Token = decrypted
+ }
+ }
+
+ // Build batch message content
+ title := "Container Image Updates Available"
+ description := fmt.Sprintf("%d container image(s) have updates available.", len(updates))
+ if len(updates) == 1 {
+ description = "1 container image has an update available."
+ }
+
+ message := fmt.Sprintf("%s\n\n%s\n\n", title, description)
+
+ for imageRef, update := range updates {
+ message += fmt.Sprintf("%s\n"+
+ "• Type: %s\n"+
+ "• Current: %s\n"+
+ "• Latest: %s\n\n",
+ imageRef,
+ update.UpdateType,
+ update.CurrentDigest,
+ update.LatestDigest,
+ )
+ }
+
+ if err := notifications.SendPushover(ctx, pushoverConfig, message); err != nil {
+ return fmt.Errorf("failed to send batch Pushover notification: %w", err)
+ }
+
+ return nil
+}
+
func (s *NotificationService) sendGenericNotification(ctx context.Context, imageRef string, updateInfo *imageupdate.Response, config models.JSON) error {
var genericConfig models.GenericConfig
configBytes, err := json.Marshal(config)
diff --git a/backend/internal/utils/notifications/pushover_sender.go b/backend/internal/utils/notifications/pushover_sender.go
new file mode 100644
index 000000000..ef5d7ae04
--- /dev/null
+++ b/backend/internal/utils/notifications/pushover_sender.go
@@ -0,0 +1,87 @@
+package notifications
+
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "strconv"
+ "strings"
+
+ "github.com/getarcaneapp/arcane/backend/internal/models"
+ "github.com/nicholas-fedor/shoutrrr"
+)
+
+// BuildPushoverURL converts PushoverConfig to Shoutrrr URL format.
+// URL example: pushover://:token@user?devices=device1,device2&priority=1&title=Container+Update
+func BuildPushoverURL(config models.PushoverConfig) (string, error) {
+ user := strings.TrimSpace(config.User)
+ token := strings.TrimSpace(config.Token)
+
+ if user == "" {
+ return "", fmt.Errorf("pushover user key is required")
+ }
+ if token == "" {
+ return "", fmt.Errorf("pushover token is required")
+ }
+ if config.Priority < -2 || config.Priority > 2 {
+ return "", fmt.Errorf("pushover priority must be between -2 and 2")
+ }
+
+ u := &url.URL{
+ Scheme: "pushover",
+ Host: user,
+ User: url.UserPassword("", token),
+ }
+
+ q := u.Query()
+ devices := make([]string, 0, len(config.Devices))
+ for _, device := range config.Devices {
+ trimmed := strings.TrimSpace(device)
+ if trimmed != "" {
+ devices = append(devices, trimmed)
+ }
+ }
+ if len(devices) > 0 {
+ q.Set("devices", strings.Join(devices, ","))
+ }
+ if config.Priority != 0 {
+ q.Set("priority", strconv.FormatInt(int64(config.Priority), 10))
+ }
+ if title := strings.TrimSpace(config.Title); title != "" {
+ q.Set("title", title)
+ }
+
+ u.RawQuery = q.Encode()
+ return u.String(), nil
+}
+
+// SendPushover sends a message via Shoutrrr Pushover using proper service configuration.
+func SendPushover(ctx context.Context, config models.PushoverConfig, message string) error {
+ if strings.TrimSpace(config.Token) == "" {
+ return fmt.Errorf("pushover token is empty")
+ }
+ if strings.TrimSpace(config.User) == "" {
+ return fmt.Errorf("pushover user key is empty")
+ }
+ if config.Priority < -2 || config.Priority > 2 {
+ return fmt.Errorf("pushover priority must be between -2 and 2")
+ }
+
+ shoutrrrURL, err := BuildPushoverURL(config)
+ if err != nil {
+ return fmt.Errorf("failed to build shoutrrr Pushover URL: %w", err)
+ }
+
+ sender, err := shoutrrr.CreateSender(shoutrrrURL)
+ if err != nil {
+ return fmt.Errorf("failed to create shoutrrr Pushover sender: %w", err)
+ }
+
+ errs := sender.Send(message, nil)
+ for _, err := range errs {
+ if err != nil {
+ return fmt.Errorf("failed to send Pushover message via shoutrrr: %w", err)
+ }
+ }
+ return nil
+}
diff --git a/backend/internal/utils/notifications/pushover_sender_test.go b/backend/internal/utils/notifications/pushover_sender_test.go
new file mode 100644
index 000000000..0be24faa9
--- /dev/null
+++ b/backend/internal/utils/notifications/pushover_sender_test.go
@@ -0,0 +1,94 @@
+package notifications
+
+import (
+ "net/url"
+ "testing"
+
+ "github.com/getarcaneapp/arcane/backend/internal/models"
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+)
+
+func TestBuildPushoverURL(t *testing.T) {
+ tests := []struct {
+ name string
+ config models.PushoverConfig
+ wantURL string
+ wantErr string
+ check func(*url.URL)
+ }{
+ {
+ name: "basic config",
+ config: models.PushoverConfig{
+ Token: "token123",
+ User: "userKey",
+ },
+ wantURL: "pushover://:token123@userKey",
+ },
+ {
+ name: "config with devices priority and title",
+ config: models.PushoverConfig{
+ Token: "token123",
+ User: "userKey",
+ Devices: []string{"device1", "device2"},
+ Priority: 1,
+ Title: "Container Update",
+ },
+ check: func(u *url.URL) {
+ password, ok := u.User.Password()
+ require.True(t, ok)
+ assert.Equal(t, "token123", password)
+ assert.Equal(t, "userKey", u.Host)
+
+ q := u.Query()
+ assert.Equal(t, "device1,device2", q.Get("devices"))
+ assert.Equal(t, "1", q.Get("priority"))
+ assert.Equal(t, "Container Update", q.Get("title"))
+ },
+ },
+ {
+ name: "missing token",
+ config: models.PushoverConfig{
+ User: "userKey",
+ },
+ wantErr: "pushover token is required",
+ },
+ {
+ name: "missing user",
+ config: models.PushoverConfig{
+ Token: "token123",
+ },
+ wantErr: "pushover user key is required",
+ },
+ {
+ name: "invalid priority",
+ config: models.PushoverConfig{
+ Token: "token123",
+ User: "userKey",
+ Priority: 3,
+ },
+ wantErr: "pushover priority must be between -2 and 2",
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ gotURL, err := BuildPushoverURL(tt.config)
+ if tt.wantErr != "" {
+ require.Error(t, err)
+ assert.Contains(t, err.Error(), tt.wantErr)
+ return
+ }
+
+ require.NoError(t, err)
+ if tt.wantURL != "" {
+ assert.Equal(t, tt.wantURL, gotURL)
+ }
+ if tt.check != nil {
+ parsed, parseErr := url.Parse(gotURL)
+ require.NoError(t, parseErr)
+ tt.check(parsed)
+ }
+ })
+ }
+}
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index c0b6c09d1..4f016bada 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -1707,6 +1707,22 @@
"notifications_ntfy_firebase_help": "Send notifications via Firebase (enabled by default)",
"notifications_ntfy_disable_tls_label": "Disable TLS Verification",
"notifications_ntfy_disable_tls_help": "Disable TLS certificate verification (not recommended)",
+ "notifications_pushover_description": "Send notifications via Pushover when container updates are detected",
+ "notifications_pushover_enabled_label": "Enable Pushover Notifications",
+ "notifications_pushover_token_label": "API Token",
+ "notifications_pushover_token_placeholder": "Enter Pushover API token",
+ "notifications_pushover_token_help": "Your Pushover application API token",
+ "notifications_pushover_user_label": "User Key",
+ "notifications_pushover_user_placeholder": "Enter Pushover user key",
+ "notifications_pushover_user_help": "Your Pushover user key (recipient)",
+ "notifications_pushover_devices_label": "Devices (Optional)",
+ "notifications_pushover_devices_placeholder": "device1, device2",
+ "notifications_pushover_devices_help": "Comma-separated list of device names. Leave empty to send to all devices.",
+ "notifications_pushover_priority_label": "Priority",
+ "notifications_pushover_priority_help": "Priority level (-2 to 2). Higher values are more urgent.",
+ "notifications_pushover_title_label": "Title (Optional)",
+ "notifications_pushover_title_placeholder": "Container Update",
+ "notifications_pushover_title_help": "Optional title override for notifications",
"notifications_generic_title": "Generic Webhook",
"notifications_generic_description": "Send notifications to any webhook endpoint that accepts HTTP POST requests",
"notifications_generic_enabled_label": "Enable Generic Webhook Notifications",
diff --git a/frontend/src/lib/types/notification-providers.ts b/frontend/src/lib/types/notification-providers.ts
index 6fc2ebf4b..92772bb4d 100644
--- a/frontend/src/lib/types/notification-providers.ts
+++ b/frontend/src/lib/types/notification-providers.ts
@@ -1,7 +1,16 @@
import type { NotificationSettings, AppriseSettings, EmailTLSMode } from './notification.type';
// Provider keys - this is the source of truth for all providers (alphabetically sorted)
-export const NOTIFICATION_PROVIDER_KEYS = ['discord', 'email', 'generic', 'ntfy', 'signal', 'slack', 'telegram'] as const;
+export const NOTIFICATION_PROVIDER_KEYS = [
+ 'discord',
+ 'email',
+ 'generic',
+ 'ntfy',
+ 'pushover',
+ 'signal',
+ 'slack',
+ 'telegram'
+] as const;
export type NotificationProviderKey = (typeof NOTIFICATION_PROVIDER_KEYS)[number];
// Base form values that all providers share
@@ -72,6 +81,14 @@ export interface NtfyFormValues extends BaseProviderFormValues {
disableTlsVerification: boolean;
}
+export interface PushoverFormValues extends BaseProviderFormValues {
+ token: string;
+ user: string;
+ devices: string;
+ priority: number;
+ title: string;
+}
+
export interface GenericFormValues extends BaseProviderFormValues {
webhookUrl: string;
method: string;
@@ -96,6 +113,7 @@ export type ProviderFormValues =
| SignalFormValues
| SlackFormValues
| NtfyFormValues
+ | PushoverFormValues
| GenericFormValues;
// Map provider keys to their form value types
@@ -106,6 +124,7 @@ export type ProviderFormValuesMap = {
signal: SignalFormValues;
slack: SlackFormValues;
ntfy: NtfyFormValues;
+ pushover: PushoverFormValues;
generic: GenericFormValues;
};
@@ -336,6 +355,21 @@ export function ntfySettingsToFormValues(settings?: NotificationSettings): NtfyF
};
}
+export function pushoverSettingsToFormValues(settings?: NotificationSettings): PushoverFormValues {
+ const cfg = (settings?.config ?? {}) as Record<string, unknown>;
+ const events = (cfg?.events ?? {}) as Record<string, boolean>;
+ return {
+ enabled: settings?.enabled ?? false,
+ token: (cfg?.token as string) || '',
+ user: (cfg?.user as string) || '',
+ devices: Array.isArray(cfg?.devices) ? (cfg.devices as string[]).join(', ') : '',
+ priority: Number(cfg?.priority ?? 0),
+ title: (cfg?.title as string) || '',
+ eventImageUpdate: events?.image_update ?? true,
+ eventContainerUpdate: events?.container_update ?? true
+ };
+}
+
export function genericSettingsToFormValues(settings?: NotificationSettings): GenericFormValues {
const cfg = (settings?.config ?? {}) as Record<string, unknown>;
const events = (cfg?.events ?? {}) as Record<string, boolean>;
@@ -386,6 +420,27 @@ export function ntfyFormValuesToSettings(values: NtfyFormValues): NotificationSe
};
}
+export function pushoverFormValuesToSettings(values: PushoverFormValues): NotificationSettings {
+ return {
+ provider: 'pushover',
+ enabled: values.enabled,
+ config: {
+ token: values.token,
+ user: values.user,
+ devices: values.devices
+ .split(',')
+ .map((device) => device.trim())
+ .filter((device) => device.length > 0),
+ priority: values.priority,
+ title: values.title,
+ events: {
+ image_update: values.eventImageUpdate,
+ container_update: values.eventContainerUpdate
+ }
+ }
+ };
+}
+
export function genericFormValuesToSettings(values: GenericFormValues): NotificationSettings {
// Parse customHeaders string (format: "key1:value1, key2:value2") into object
const customHeaders: Record<string, string> = {};
diff --git a/frontend/src/lib/types/notification.type.ts b/frontend/src/lib/types/notification.type.ts
index ba3194d03..3b965013b 100644
--- a/frontend/src/lib/types/notification.type.ts
+++ b/frontend/src/lib/types/notification.type.ts
@@ -1,4 +1,4 @@
-export type NotificationProvider = 'discord' | 'email' | 'telegram' | 'signal' | 'slack' | 'ntfy' | 'generic';
+export type NotificationProvider = 'discord' | 'email' | 'telegram' | 'signal' | 'slack' | 'ntfy' | 'pushover' | 'generic';
export type EmailTLSMode = 'none' | 'starttls' | 'ssl';
export interface NotificationSettings {
diff --git a/frontend/src/routes/(app)/settings/notifications/+page.svelte b/frontend/src/routes/(app)/settings/notifications/+page.svelte
index 9c5e19149..daf9e4224 100644
--- a/frontend/src/routes/(app)/settings/notifications/+page.svelte
+++ b/frontend/src/routes/(app)/settings/notifications/+page.svelte
@@ -17,6 +17,7 @@
type SignalFormValues,
type SlackFormValues,
type NtfyFormValues,
+ type PushoverFormValues,
type GenericFormValues,
type AppriseFormValues,
type NotificationProviderKey,
@@ -27,6 +28,7 @@
signalSettingsToFormValues,
slackSettingsToFormValues,
ntfySettingsToFormValues,
+ pushoverSettingsToFormValues,
genericSettingsToFormValues,
appriseSettingsToFormValues,
discordFormValuesToSettings,
@@ -35,6 +37,7 @@
signalFormValuesToSettings,
slackFormValuesToSettings,
ntfyFormValuesToSettings,
+ pushoverFormValuesToSettings,
genericFormValuesToSettings,
appriseFormValuesToSettings
} from '$lib/types/notification-providers';
@@ -46,6 +49,7 @@
SignalProviderForm,
SlackProviderForm,
NtfyProviderForm,
+ PushoverProviderForm,
GenericProviderForm,
AppriseProviderForm
} from './providers';
@@ -77,6 +81,7 @@
let signalFormRef: SignalProviderForm;
let slackFormRef: SlackProviderForm;
let ntfyFormRef: NtfyProviderForm;
+ let pushoverFormRef: PushoverProviderForm;
let genericFormRef: GenericProviderForm;
// Saved settings from server (used to detect if settings exist)
@@ -87,6 +92,7 @@
signal: null,
slack: null,
ntfy: null,
+ pushover: null,
generic: null
});
@@ -97,6 +103,7 @@
let signalValues = $state<SignalFormValues>(signalSettingsToFormValues());
let slackValues = $state<SlackFormValues>(slackSettingsToFormValues());
let ntfyValues = $state<NtfyFormValues>(ntfySettingsToFormValues());
+ let pushoverValues = $state<PushoverFormValues>(pushoverSettingsToFormValues());
let genericValues = $state<GenericFormValues>(genericSettingsToFormValues());
let appriseValues = $state<AppriseFormValues>(appriseSettingsToFormValues());
@@ -107,6 +114,7 @@
let signalBaseline = $state<SignalFormValues>(signalSettingsToFormValues());
let slackBaseline = $state<SlackFormValues>(slackSettingsToFormValues());
let ntfyBaseline = $state<NtfyFormValues>(ntfySettingsToFormValues());
+ let pushoverBaseline = $state<PushoverFormValues>(pushoverSettingsToFormValues());
let genericBaseline = $state<GenericFormValues>(genericSettingsToFormValues());
let appriseBaseline = $state<AppriseFormValues>(appriseSettingsToFormValues());
@@ -117,6 +125,7 @@
const signalHasChanges = $derived(JSON.stringify(signalValues) !== JSON.stringify(signalBaseline));
const slackHasChanges = $derived(JSON.stringify(slackValues) !== JSON.stringify(slackBaseline));
const ntfyHasChanges = $derived(JSON.stringify(ntfyValues) !== JSON.stringify(ntfyBaseline));
+ const pushoverHasChanges = $derived(JSON.stringify(pushoverValues) !== JSON.stringify(pushoverBaseline));
const genericHasChanges = $derived(JSON.stringify(genericValues) !== JSON.stringify(genericBaseline));
const appriseHasChanges = $derived(JSON.stringify(appriseValues) !== JSON.stringify(appriseBaseline));
const hasChanges = $derived(
@@ -126,6 +135,7 @@
signalHasChanges ||
slackHasChanges ||
ntfyHasChanges ||
+ pushoverHasChanges ||
genericHasChanges ||
appriseHasChanges
);
@@ -167,6 +177,9 @@
ntfyValues = ntfySettingsToFormValues(savedSettings.ntfy ?? undefined);
ntfyBaseline = { ...ntfyValues };
+ pushoverValues = pushoverSettingsToFormValues(savedSettings.pushover ?? undefined);
+ pushoverBaseline = { ...pushoverValues };
+
genericValues = genericSettingsToFormValues(savedSettings.generic ?? undefined);
genericBaseline = { ...genericValues };
@@ -188,9 +201,12 @@
const signalValid = signalFormRef?.isValid() ?? true;
const slackValid = slackFormRef?.isValid() ?? true;
const ntfyValid = ntfyFormRef?.isValid() ?? true;
+ const pushoverValid = pushoverFormRef?.isValid() ?? true;
const genericValid = genericFormRef?.isValid() ?? true;
- if (!(emailValid && discordValid && telegramValid && signalValid && slackValid && ntfyValid && genericValid)) {
+ if (
+ !(emailValid && discordValid && telegramValid && signalValid && slackValid && ntfyValid && pushoverValid && genericValid)
+ ) {
toast.error('Please check the form for errors');
return;
}
@@ -278,6 +294,19 @@
}
}
+ // Save Pushover settings if changed
+ if (pushoverHasChanges) {
+ try {
+ const settings = pushoverFormValuesToSettings(pushoverValues);
+ await notificationService.updateSettings('pushover', settings);
+ savedSettings.pushover = settings;
+ pushoverBaseline = { ...pushoverValues };
+ } catch (error: any) {
+ const errorMsg = error?.response?.data?.error || error.message || 'Unknown error';
+ errors.push(m.notifications_saved_failed({ provider: 'Pushover', error: errorMsg }));
+ }
+ }
+
// Save Generic settings if changed
if (genericHasChanges) {
try {
@@ -323,6 +352,7 @@
signalValues = { ...signalBaseline };
slackValues = { ...slackBaseline };
ntfyValues = { ...ntfyBaseline };
+ pushoverValues = { ...pushoverBaseline };
genericValues = { ...genericBaseline };
appriseValues = { ...appriseBaseline };
}
@@ -407,7 +437,7 @@
<div class="space-y-8">
<Tabs.Root bind:value={providerTab}>
<Tabs.List class="inline-flex w-auto">
- {#each NOTIFICATION_PROVIDER_KEYS as provider}
+ {#each NOTIFICATION_PROVIDER_KEYS as provider (provider)}
<Tabs.Trigger value={provider}>{provider.charAt(0).toUpperCase() + provider.slice(1)}</Tabs.Trigger>
{/each}
</Tabs.List>
@@ -472,6 +502,16 @@
/>
</Tabs.Content>
+ <Tabs.Content value="pushover" class="mt-4 space-y-4">
+ <PushoverProviderForm
+ bind:this={pushoverFormRef}
+ bind:values={pushoverValues}
+ disabled={isReadOnly}
+ {isTesting}
+ onTest={() => testNotification('pushover')}
+ />
+ </Tabs.Content>
+
<Tabs.Content value="generic" class="mt-4 space-y-4">
<GenericProviderForm
bind:this={genericFormRef}
diff --git a/frontend/src/routes/(app)/settings/notifications/providers/PushoverProviderForm.svelte b/frontend/src/routes/(app)/settings/notifications/providers/PushoverProviderForm.svelte
new file mode 100644
index 000000000..35f208abf
--- /dev/null
+++ b/frontend/src/routes/(app)/settings/notifications/providers/PushoverProviderForm.svelte
@@ -0,0 +1,175 @@
+<script lang="ts">
+ import { ArcaneButton } from '$lib/components/arcane-button/index.js';
+ import TextInputWithLabel from '$lib/components/form/text-input-with-label.svelte';
+ import { Label } from '$lib/components/ui/label';
+ import Textarea from '$lib/components/ui/textarea/textarea.svelte';
+ import * as Select from '$lib/components/ui/select/index.js';
+ import { m } from '$lib/paraglide/messages';
+ import { SendEmailIcon } from '$lib/icons';
+ import { z } from 'zod/v4';
+ import type { PushoverFormValues } from '$lib/types/notification-providers';
+ import ProviderFormWrapper from './ProviderFormWrapper.svelte';
+ import EventSubscriptions from './EventSubscriptions.svelte';
+
+ interface Props {
+ values: PushoverFormValues;
+ disabled?: boolean;
+ isTesting?: boolean;
+ onTest?: () => void;
+ }
+
+ let { values = $bindable(), disabled = false, isTesting = false, onTest }: Props = $props();
+
+ const priorityOptions = [
+ { value: '-2', label: '-2' },
+ { value: '-1', label: '-1' },
+ { value: '0', label: '0' },
+ { value: '1', label: '1' },
+ { value: '2', label: '2' }
+ ];
+
+ const priorityValue = $derived(String(values.priority ?? 0));
+
+ const schema = z
+ .object({
+ enabled: z.boolean(),
+ token: z.string(),
+ user: z.string(),
+ devices: z.string(),
+ priority: z.coerce.number().int().min(-2).max(2),
+ title: z.string(),
+ eventImageUpdate: z.boolean(),
+ eventContainerUpdate: z.boolean()
+ })
+ .superRefine((d, ctx) => {
+ if (!d.enabled) return;
+ if (!d.token.trim()) {
+ ctx.addIssue({ code: 'custom', message: m.common_required(), path: ['token'] });
+ }
+ if (!d.user.trim()) {
+ ctx.addIssue({ code: 'custom', message: m.common_required(), path: ['user'] });
+ }
+ });
+
+ const validation = $derived.by(() => schema.safeParse(values));
+
+ const selectedPriorityLabel = $derived(
+ priorityOptions.find((option) => option.value === priorityValue)?.label ?? priorityValue
+ );
+
+ const fieldErrors = $derived.by(() => {
+ const errs: Partial<Record<keyof PushoverFormValues, string>> = {};
+ if (validation.success) return errs;
+ for (const issue of validation.error.issues) {
+ const key = issue.path?.[0] as keyof PushoverFormValues | undefined;
+ if (!key || errs[key]) continue;
+ errs[key] = issue.message;
+ }
+ return errs;
+ });
+
+ export function isValid(): boolean {
+ return validation.success;
+ }
+</script>
+
+<ProviderFormWrapper
+ id="pushover"
+ title="Pushover"
+ description={m.notifications_pushover_description()}
+ enabledLabel={m.notifications_pushover_enabled_label()}
+ bind:enabled={values.enabled}
+ {disabled}
+>
+ <TextInputWithLabel
+ bind:value={values.token}
+ {disabled}
+ label={m.notifications_pushover_token_label()}
+ placeholder={m.notifications_pushover_token_placeholder()}
+ type="password"
+ autocomplete="off"
+ helpText={m.notifications_pushover_token_help()}
+ />
+ {#if fieldErrors.token}
+ <p class="text-destructive -mt-2 text-sm">{fieldErrors.token}</p>
+ {/if}
+
+ <TextInputWithLabel
+ bind:value={values.user}
+ {disabled}
+ label={m.notifications_pushover_user_label()}
+ placeholder={m.notifications_pushover_user_placeholder()}
+ type="text"
+ autocomplete="off"
+ helpText={m.notifications_pushover_user_help()}
+ />
+ {#if fieldErrors.user}
+ <p class="text-destructive -mt-2 text-sm">{fieldErrors.user}</p>
+ {/if}
+
+ <div class="space-y-2">
+ <Label for="pushover-devices">{m.notifications_pushover_devices_label()}</Label>
+ <Textarea
+ id="pushover-devices"
+ bind:value={values.devices}
+ {disabled}
+ autocomplete="off"
+ placeholder={m.notifications_pushover_devices_placeholder()}
+ rows={2}
+ />
+ <p class="text-muted-foreground text-sm">{m.notifications_pushover_devices_help()}</p>
+ </div>
+
+ <div class="space-y-2">
+ <Label for="pushover-priority">{m.notifications_pushover_priority_label()}</Label>
+ <Select.Root
+ type="single"
+ value={priorityValue}
+ {disabled}
+ onValueChange={(value) => {
+ values.priority = Number(value);
+ }}
+ >
+ <Select.Trigger id="pushover-priority" class="h-10 w-full">
+ <span>{selectedPriorityLabel}</span>
+ </Select.Trigger>
+ <Select.Content>
+ {#each priorityOptions as option (option.value)}
+ <Select.Item value={option.value}>{option.label}</Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+ <p class="text-muted-foreground text-sm">{m.notifications_pushover_priority_help()}</p>
+ </div>
+
+ <TextInputWithLabel
+ bind:value={values.title}
+ {disabled}
+ label={m.notifications_pushover_title_label()}
+ placeholder={m.notifications_pushover_title_placeholder()}
+ type="text"
+ autocomplete="off"
+ helpText={m.notifications_pushover_title_help()}
+ />
+
+ <EventSubscriptions
+ providerId="pushover"
+ bind:eventImageUpdate={values.eventImageUpdate}
+ bind:eventContainerUpdate={values.eventContainerUpdate}
+ {disabled}
+ />
+
+ {#if onTest}
+ <div class="pt-2">
+ <ArcaneButton
+ action="base"
+ tone="outline"
+ onclick={onTest}
+ disabled={disabled || isTesting}
+ loading={isTesting}
+ icon={SendEmailIcon}
+ customLabel={m.notifications_test_notification()}
+ />
+ </div>
+ {/if}
+</ProviderFormWrapper>
diff --git a/frontend/src/routes/(app)/settings/notifications/providers/index.ts b/frontend/src/routes/(app)/settings/notifications/providers/index.ts
index ad9a0cb14..4f158a6de 100644
--- a/frontend/src/routes/(app)/settings/notifications/providers/index.ts
+++ b/frontend/src/routes/(app)/settings/notifications/providers/index.ts
@@ -7,4 +7,5 @@ export { default as AppriseProviderForm } from './AppriseProviderForm.svelte';
export { default as ProviderFormWrapper } from './ProviderFormWrapper.svelte';
export { default as EventSubscriptions } from './EventSubscriptions.svelte';
export { default as NtfyProviderForm } from './NtfyProviderForm.svelte';
+export { default as PushoverProviderForm } from './PushoverProviderForm.svelte';
export { default as GenericProviderForm } from './GenericProviderForm.svelte';
diff --git a/types/notification/notification.go b/types/notification/notification.go
index 949dc16d0..2a9b628c8 100644
--- a/types/notification/notification.go
+++ b/types/notification/notification.go
@@ -24,6 +24,9 @@ const (
// NotificationProviderNtfy is the builtin Ntfy notification provider.
NotificationProviderNtfy Provider = "ntfy"
+ // NotificationProviderPushover is the builtin Pushover notification provider.
+ NotificationProviderPushover Provider = "pushover"
+
// NotificationProviderGeneric is the builtin Generic webhook notification provider.
NotificationProviderGeneric Provider = "generic"
)