~xenrox/ntfy-alertmanager

9b9d71d64877a09d8410cdbd824a3d501c13dfe5 — Thorben Günther a month ago dbe860e
Fix linter warnings
1 files changed, 5 insertions(+), 5 deletions(-)

M main.go
M main.go => main.go +5 -5
@@ 33,7 33,7 @@ import (

var version = "dev"

var MAX_NTFY_ACTIONS = 3
var maxNTFYActions = 3

type bridge struct {
	cfg    *config.Config


@@ 362,18 362,18 @@ func (br *bridge) publish(n *notification) error {
	}

	nActions := len(actions)
	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))
	if nActions > maxNTFYActions {
		br.logger.Warn(fmt.Sprintf("Publish: Too many actions (%d), ntfy only supports up to %d - removing surplus actions.", nActions, maxNTFYActions))
		br.logger.Debug("Action list",
			slog.Any("actions", actions))
		actions = actions[:MAX_NTFY_ACTIONS]
		actions = actions[:maxNTFYActions]
	}
	req.Header.Set("Actions", strings.Join(actions, ";"))

	configFingerprint := br.cfg.Ntfy.CertFingerprint
	if configFingerprint != "" {
		tlsCfg := &tls.Config{}
		tlsCfg.VerifyPeerCertificate = func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {
		tlsCfg.VerifyPeerCertificate = func(rawCerts [][]byte, _ [][]*x509.Certificate) error {
			for _, rawCert := range rawCerts {
				hash := sha512.Sum512(rawCert)
				if hex.EncodeToString(hash[:]) == configFingerprint {