@@ 33,6 33,8 @@ import (
var version = "dev"
+var MAX_NTFY_ACTIONS = 3
+
type bridge struct {
cfg *config.Config
logger *slog.Logger
@@ 360,9 362,11 @@ func (br *bridge) publish(n *notification) error {
}
nActions := len(actions)
- if nActions > 3 {
- // TODO: Limit actions to three
- br.logger.Warn(fmt.Sprintf("Publish: Too many actions (%d), ntfy only supports up to three.", nActions))
+ if nActions > MAX_NTFY_ACTIONS {
+ br.logger.Warn(fmt.Sprintf("Publish: Too many actions (%d), ntfy only supports up to %d - removing surplus actions.", nActions, MAX_NTFY_ACTIONS))
+ br.logger.Debug("Action list",
+ slog.Any("actions", actions))
+ actions = actions[:MAX_NTFY_ACTIONS]
}
req.Header.Set("Actions", strings.Join(actions, ";"))