- Updated the list of supported notification provider types to include 'pushover'. - Enhanced the notifications API tests to validate Pushover integration. - Modified the notifications form to include fields specific to Pushover, such as API Token and User Key. - Implemented CRUD operations for Pushover providers in the settings. - Added end-to-end tests for Pushover provider functionality, including form rendering, payload validation, and security checks. - Updated translations to include Pushover-specific labels and placeholders.
36 lines
757 B
Go
36 lines
757 B
Go
package notifications
|
|
|
|
import "strings"
|
|
|
|
// NOTE: used only in tests
|
|
type Router struct{}
|
|
|
|
func NewRouter() *Router {
|
|
return &Router{}
|
|
}
|
|
|
|
func (r *Router) ShouldUseNotify(providerType string, flags map[string]bool) bool {
|
|
if !flags[FlagNotifyEngineEnabled] {
|
|
return false
|
|
}
|
|
|
|
switch strings.ToLower(providerType) {
|
|
case "discord":
|
|
return flags[FlagDiscordServiceEnabled]
|
|
case "email":
|
|
return flags[FlagEmailServiceEnabled]
|
|
case "gotify":
|
|
return flags[FlagGotifyServiceEnabled]
|
|
case "webhook":
|
|
return flags[FlagWebhookServiceEnabled]
|
|
case "telegram":
|
|
return flags[FlagTelegramServiceEnabled]
|
|
case "slack":
|
|
return flags[FlagSlackServiceEnabled]
|
|
case "pushover":
|
|
return flags[FlagPushoverServiceEnabled]
|
|
default:
|
|
return false
|
|
}
|
|
}
|