Fix linter warnings
This commit is contained in:
parent
dbe860e429
commit
9b9d71d648
1 changed files with 5 additions and 5 deletions
10
main.go
10
main.go
|
@ -33,7 +33,7 @@ import (
|
||||||
|
|
||||||
var version = "dev"
|
var version = "dev"
|
||||||
|
|
||||||
var MAX_NTFY_ACTIONS = 3
|
var maxNTFYActions = 3
|
||||||
|
|
||||||
type bridge struct {
|
type bridge struct {
|
||||||
cfg *config.Config
|
cfg *config.Config
|
||||||
|
@ -362,18 +362,18 @@ func (br *bridge) publish(n *notification) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
nActions := len(actions)
|
nActions := len(actions)
|
||||||
if 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, MAX_NTFY_ACTIONS))
|
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",
|
br.logger.Debug("Action list",
|
||||||
slog.Any("actions", actions))
|
slog.Any("actions", actions))
|
||||||
actions = actions[:MAX_NTFY_ACTIONS]
|
actions = actions[:maxNTFYActions]
|
||||||
}
|
}
|
||||||
req.Header.Set("Actions", strings.Join(actions, ";"))
|
req.Header.Set("Actions", strings.Join(actions, ";"))
|
||||||
|
|
||||||
configFingerprint := br.cfg.Ntfy.CertFingerprint
|
configFingerprint := br.cfg.Ntfy.CertFingerprint
|
||||||
if configFingerprint != "" {
|
if configFingerprint != "" {
|
||||||
tlsCfg := &tls.Config{}
|
tlsCfg := &tls.Config{}
|
||||||
tlsCfg.VerifyPeerCertificate = func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error {
|
tlsCfg.VerifyPeerCertificate = func(rawCerts [][]byte, _ [][]*x509.Certificate) error {
|
||||||
for _, rawCert := range rawCerts {
|
for _, rawCert := range rawCerts {
|
||||||
hash := sha512.Sum512(rawCert)
|
hash := sha512.Sum512(rawCert)
|
||||||
if hex.EncodeToString(hash[:]) == configFingerprint {
|
if hex.EncodeToString(hash[:]) == configFingerprint {
|
||||||
|
|
Loading…
Add table
Reference in a new issue