Files
Charon/backend/internal/notifications/router.go
GitHub Actions bc9f2cf882 chore: enable Gotify and Custom Webhhok notifications and improve payload validation
- Enhanced Notifications component tests to include support for Discord, Gotify, and Webhook provider types.
- Updated test cases to validate the correct handling of provider type options and ensure proper payload structure during creation, preview, and testing.
- Introduced new tests for Gotify token handling and ensured sensitive information is not exposed in the UI.
- Refactored existing tests for clarity and maintainability, including improved assertions and error handling.
- Added comprehensive coverage for payload validation scenarios, including malformed requests and security checks against SSRF and oversized payloads.
2026-02-24 05:34:25 +00:00

38 lines
899 B
Go

package notifications
import "strings"
type Router struct{}
func NewRouter() *Router {
return &Router{}
}
func (r *Router) ShouldUseNotify(providerType, providerEngine string, flags map[string]bool) bool {
if !flags[FlagNotifyEngineEnabled] {
return false
}
if strings.EqualFold(providerEngine, EngineLegacy) {
return false
}
switch strings.ToLower(providerType) {
case "discord":
return flags[FlagDiscordServiceEnabled]
case "gotify":
return flags[FlagGotifyServiceEnabled]
case "webhook":
return flags[FlagWebhookServiceEnabled]
default:
return false
}
}
func (r *Router) ShouldUseLegacyFallback(flags map[string]bool) bool {
// Hard-disabled: Legacy fallback has been permanently removed.
// This function exists only for interface compatibility and always returns false.
_ = flags // Explicitly ignore flags to prevent accidental re-introduction
return false
}