Files
Charon/backend/internal/notifications/router.go
GitHub Actions 86023788aa feat: add support for Ntfy notification provider
- Updated the list of supported notification provider types to include 'ntfy'.
- Modified the notification settings UI to accommodate the Ntfy provider, including form fields for topic URL and access token.
- Enhanced localization files to include translations for Ntfy-related fields in German, English, Spanish, French, and Chinese.
- Implemented tests for the Ntfy notification provider, covering form rendering, CRUD operations, payload contracts, and security measures.
- Updated existing tests to account for the new Ntfy provider in various scenarios.
2026-03-24 21:04:54 +00:00

38 lines
810 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]
case "ntfy":
return flags[FlagNtfyServiceEnabled]
default:
return false
}
}