feat(notify): the remaining notification services of Uptime Kuma
ci / image (pull_request) Successful in 4m24s
ci / build (pull_request) Successful in 5m6s
ci / lint (pull_request) Successful in 12m3s
ci / test (pull_request) Successful in 15m27s

Adds 93 services, bringing the total to 109 plus webhook and email:
chat and messengers (DingTalk, Feishu, LINE, Nextcloud Talk, Threema,
WhatsApp gateways, Nostr, Home Assistant, …), push (Bark, Gorush,
ServerChan, …), SMS and calls (Twilio, Plivo, 46elks, Alibaba Cloud,
Teltonika routers, …), email APIs (SendGrid, Brevo, Resend, Microsoft
Graph, …) and incident management (Grafana OnCall, Jira Service
Management, Splunk On-Call, Squadcast, SIGNL4, …). Customers bring
their own credentials; secrets are sealed like the others.

Services pair incidents by their ID where they can resolve alerts.
Signed requests (DingTalk, Nextcloud Talk, Alibaba Cloud) and replies
that report failures with status 200 are handled. Nostr messages are
sealed and gift-wrapped (NIP-17/59) with go-nostr, but sent over our own
WebSocket connections so relays go through the network guard. Messages
now carry the monitor's name, ID and target.

The channel form groups services, the i18n test derives provider keys
from the registry, and channel types may contain digits.

Refs #92

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-22 17:40:19 +01:00
1 parent 465fda60dc
commit 52819e64bb
20 files changed
+3239 -666

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@ It is built for teams and hosting providers: organizations with members, roles a
- **Checks:** HTTP(S) with keyword, JSON APIs with conditions on values, Prometheus queries, TCP, TLS certificate expiry, DNS, ICMP; PostgreSQL, MySQL/MariaDB, SQL Server, MongoDB, Redis; MQTT, Kafka, RabbitMQ; gRPC health, SMTP, RADIUS, SNMP; Steam and Minecraft servers; Docker containers; heartbeats pinged by cron jobs, and Prometheus Alertmanager alerts. Credentials are stored encrypted. Platform admins can switch off types an installation cannot offer. - **Checks:** HTTP(S) with keyword, JSON APIs with conditions on values, Prometheus queries, TCP, TLS certificate expiry, DNS, ICMP; PostgreSQL, MySQL/MariaDB, SQL Server, MongoDB, Redis; MQTT, Kafka, RabbitMQ; gRPC health, SMTP, RADIUS, SNMP; Steam and Minecraft servers; Docker containers; heartbeats pinged by cron jobs, and Prometheus Alertmanager alerts. Credentials are stored encrypted. Platform admins can switch off types an installation cannot offer.
- **Multi-region:** checkers run per region, several per region for load and failover; any number of regions per monitor. - **Multi-region:** checkers run per region, several per region for load and failover; any number of regions per monitor.
- **Alerting:** incidents with webhooks (signed), email, Slack, Discord, Microsoft Teams, Google Chat, Mattermost, Rocket.Chat, Telegram, Matrix, ntfy, Gotify, Pushover, Pushbullet, Signal, PagerDuty, Opsgenie and Apprise; confirmations, maintenance windows (one-off or recurring). - **Alerting:** incidents with webhooks (signed), email and over 100 services: chat and messengers (Slack, Discord, Microsoft Teams, Telegram, Matrix, WhatsApp gateways, Nostr, …), push (ntfy, Gotify, Pushover, …), SMS and calls (Twilio, Plivo, …), email APIs (SendGrid, Microsoft 365, …) and incident management (PagerDuty, Opsgenie, Grafana OnCall, Jira Service Management, …), plus Apprise; customers bring their own credentials. Confirmations, maintenance windows (one-off or recurring).
- **History:** charts and SLA from one hour to a year, per region; see what the checker saw (redirect chain, timing, certificate, response body). - **History:** charts and SLA from one hour to a year, per region; see what the checker saw (redirect chain, timing, certificate, response body).
- **Status pages:** unlimited, custom domains with automatic TLS, themes, Markdown, legal notice; served from cache during outages. - **Status pages:** unlimited, custom domains with automatic TLS, themes, Markdown, legal notice; served from cache during outages.
- **Organizations:** members, custom roles scoped to monitor groups or status pages, API tokens, OpenID Connect SSO per organization, enforced 2FA, audit log. - **Organizations:** members, custom roles scoped to monitor groups or status pages, API tokens, OpenID Connect SSO per organization, enforced 2FA, audit log.
+16 -1
View File
@@ -6,6 +6,7 @@ require (
github.com/a-h/templ v0.3.1118 github.com/a-h/templ v0.3.1118
github.com/caarlos0/env/v11 v11.4.2 github.com/caarlos0/env/v11 v11.4.2
github.com/caddyserver/certmagic v0.25.6 github.com/caddyserver/certmagic v0.25.6
github.com/coder/websocket v1.8.15
github.com/coreos/go-oidc/v3 v3.21.0 github.com/coreos/go-oidc/v3 v3.21.0
github.com/eclipse/paho.mqtt.golang v1.5.1 github.com/eclipse/paho.mqtt.golang v1.5.1
github.com/gin-gonic/gin v1.12.0 github.com/gin-gonic/gin v1.12.0
@@ -17,6 +18,7 @@ require (
github.com/jackc/pgx/v5 v5.13.0 github.com/jackc/pgx/v5 v5.13.0
github.com/microsoft/go-mssqldb v1.12.0 github.com/microsoft/go-mssqldb v1.12.0
github.com/mochi-mqtt/server/v2 v2.7.9 github.com/mochi-mqtt/server/v2 v2.7.9
github.com/nbd-wtf/go-nostr v0.52.3
github.com/nicksnyder/go-i18n/v2 v2.7.0 github.com/nicksnyder/go-i18n/v2 v2.7.0
github.com/pquerna/otp v1.5.0 github.com/pquerna/otp v1.5.0
github.com/pressly/goose/v3 v3.30.1 github.com/pressly/goose/v3 v3.30.1
@@ -37,9 +39,13 @@ require (
require ( require (
filippo.io/edwards25519 v1.2.0 // indirect filippo.io/edwards25519 v1.2.0 // indirect
github.com/ImVexed/fasturl v0.0.0-20230304231329-4e41488060f3 // indirect
github.com/a-h/parse v0.0.42 // indirect github.com/a-h/parse v0.0.42 // indirect
github.com/andybalholm/brotli v1.3.0 // indirect github.com/andybalholm/brotli v1.3.0 // indirect
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/bytedance/gopkg v0.1.3 // indirect github.com/bytedance/gopkg v0.1.3 // indirect
github.com/bytedance/sonic v1.15.0 // indirect github.com/bytedance/sonic v1.15.0 // indirect
github.com/bytedance/sonic/loader v0.5.0 // indirect github.com/bytedance/sonic/loader v0.5.0 // indirect
@@ -48,6 +54,8 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cli/browser v1.3.0 // indirect github.com/cli/browser v1.3.0 // indirect
github.com/cloudwego/base64x v0.1.6 // indirect github.com/cloudwego/base64x v0.1.6 // indirect
github.com/decred/dcrd/crypto/blake256 v1.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
github.com/fatih/color v1.19.0 // indirect github.com/fatih/color v1.19.0 // indirect
github.com/fsnotify/fsnotify v1.10.1 // indirect github.com/fsnotify/fsnotify v1.10.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.16 // indirect github.com/gabriel-vasile/mimetype v1.4.16 // indirect
@@ -62,11 +70,13 @@ require (
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/puddle/v2 v2.2.3 // indirect github.com/jackc/puddle/v2 v2.2.3 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.20.4 // indirect github.com/klauspost/compress v1.20.4 // indirect
github.com/klauspost/cpuid/v2 v2.4.0 // indirect github.com/klauspost/cpuid/v2 v2.4.0 // indirect
github.com/leodido/go-urn v1.5.0 // indirect github.com/leodido/go-urn v1.5.0 // indirect
github.com/libdns/libdns v1.1.1 // indirect github.com/libdns/libdns v1.1.1 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
github.com/mattn/go-colorable v0.1.16 // indirect github.com/mattn/go-colorable v0.1.16 // indirect
github.com/mattn/go-isatty v0.0.24 // indirect github.com/mattn/go-isatty v0.0.24 // indirect
github.com/mfridman/interpolate v0.2.0 // indirect github.com/mfridman/interpolate v0.2.0 // indirect
@@ -77,11 +87,15 @@ require (
github.com/natefinch/atomic v1.0.1 // indirect github.com/natefinch/atomic v1.0.1 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pierrec/lz4/v4 v4.1.33 // indirect github.com/pierrec/lz4/v4 v4.1.33 // indirect
github.com/puzpuzpuz/xsync/v3 v3.5.1 // indirect
github.com/quic-go/qpack v0.6.0 // indirect github.com/quic-go/qpack v0.6.0 // indirect
github.com/quic-go/quic-go v0.59.0 // indirect github.com/quic-go/quic-go v0.59.0 // indirect
github.com/rs/xid v1.4.0 // indirect github.com/rs/xid v1.4.0 // indirect
github.com/sethvargo/go-retry v0.5.0 // indirect github.com/sethvargo/go-retry v0.5.0 // indirect
github.com/shopspring/decimal v1.6.0 // indirect github.com/shopspring/decimal v1.6.0 // indirect
github.com/tidwall/gjson v1.18.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.3.1 // indirect github.com/ugorji/go/codec v1.3.1 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect
@@ -93,10 +107,11 @@ require (
go.uber.org/multierr v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap/exp v0.3.0 // indirect go.uber.org/zap/exp v0.3.0 // indirect
golang.org/x/arch v0.22.0 // indirect golang.org/x/arch v0.22.0 // indirect
golang.org/x/exp v0.0.0-20261109185158-a52e3aef5920 // indirect
golang.org/x/mod v0.43.0 // indirect golang.org/x/mod v0.43.0 // indirect
golang.org/x/sync v0.25.0 // indirect golang.org/x/sync v0.25.0 // indirect
golang.org/x/sys v0.50.0 // indirect golang.org/x/sys v0.50.0 // indirect
golang.org/x/tools v0.52.0 // indirect golang.org/x/tools v0.52.1-0.20261106145633-d407941a339a // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c // indirect
google.golang.org/protobuf v1.36.12 // indirect google.golang.org/protobuf v1.36.12 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
+117 -2
View File
@@ -16,10 +16,13 @@ github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1 h1:0O6j18nQDo
github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1/go.mod h1:xdYAf5bjkOpsd3auA8riiJW4vneBubt9caavL7626jQ= github.com/AzureAD/microsoft-authentication-library-for-go v1.10.1/go.mod h1:xdYAf5bjkOpsd3auA8riiJW4vneBubt9caavL7626jQ=
github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk=
github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/ImVexed/fasturl v0.0.0-20230304231329-4e41488060f3 h1:ClzzXMDDuUbWfNNZqGeYq4PnYOlwlOVIvSyNaIy0ykg=
github.com/ImVexed/fasturl v0.0.0-20230304231329-4e41488060f3/go.mod h1:we0YA5CsBbH5+/NUzC/AlMmxaDtWlXeNsqrwXjTzmzA=
github.com/a-h/parse v0.0.42 h1:OUb8soeTG5+mRWieRyS/OyNU7Xl0+4wr4kPKKPa/WUQ= github.com/a-h/parse v0.0.42 h1:OUb8soeTG5+mRWieRyS/OyNU7Xl0+4wr4kPKKPa/WUQ=
github.com/a-h/parse v0.0.42/go.mod h1:X9OHJ1IjgakwZoDSoHYhdtKKD0zXZ2agpoIztPAA95w= github.com/a-h/parse v0.0.42/go.mod h1:X9OHJ1IjgakwZoDSoHYhdtKKD0zXZ2agpoIztPAA95w=
github.com/a-h/templ v0.3.1118 h1:rZv90g1xVb7ieNz4j5WK6yQePZfsg7j7fVvP8qVmeJI= github.com/a-h/templ v0.3.1118 h1:rZv90g1xVb7ieNz4j5WK6yQePZfsg7j7fVvP8qVmeJI=
github.com/a-h/templ v0.3.1118/go.mod h1:ttKggixbDULrwkJzfEO5fa4IPGTKiRt3qP09zjPuCS4= github.com/a-h/templ v0.3.1118/go.mod h1:ttKggixbDULrwkJzfEO5fa4IPGTKiRt3qP09zjPuCS4=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/andybalholm/brotli v1.3.0 h1:IdkhjSe/+34U+fP7FSR2Q6Poj1hnHUa2GoWmzXJd6qY= github.com/andybalholm/brotli v1.3.0 h1:IdkhjSe/+34U+fP7FSR2Q6Poj1hnHUa2GoWmzXJd6qY=
github.com/andybalholm/brotli v1.3.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= github.com/andybalholm/brotli v1.3.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc h1:biVzkmvwrH8WK8raXaxBx6fRVTlJILwEwQGL1I/ByEI= github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc h1:biVzkmvwrH8WK8raXaxBx6fRVTlJILwEwQGL1I/ByEI=
@@ -28,6 +31,30 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M=
github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A=
github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA=
github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE=
github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ=
github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A=
github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE=
github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8=
github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ=
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I=
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M= github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM= github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
github.com/bytedance/sonic v1.15.0 h1:/PXeWFaR5ElNcVE84U0dOHjiMHQOwNIx3K4ymzh/uSE= github.com/bytedance/sonic v1.15.0 h1:/PXeWFaR5ElNcVE84U0dOHjiMHQOwNIx3K4ymzh/uSE=
@@ -48,17 +75,30 @@ github.com/cli/browser v1.3.0 h1:LejqCrpWr+1pRqmEPDGnTZOjsMe7sehifLynZJuqJpo=
github.com/cli/browser v1.3.0/go.mod h1:HH8s+fOAxjhQoBUAsKuPCbqUuxZDhQ2/aD+SzsEfBTk= github.com/cli/browser v1.3.0/go.mod h1:HH8s+fOAxjhQoBUAsKuPCbqUuxZDhQ2/aD+SzsEfBTk=
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU=
github.com/coder/websocket v1.8.15 h1:6B2JPeOGlpff2Uz6vOEH1Vzpi0iUz20A+lPVhPHtNUA=
github.com/coder/websocket v1.8.15/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
github.com/coreos/go-oidc/v3 v3.21.0 h1:wZo4Q9Pum8dYEj0eMUPrqR+kvuGkeUplbLpNCkBqoWM= github.com/coreos/go-oidc/v3 v3.21.0 h1:wZo4Q9Pum8dYEj0eMUPrqR+kvuGkeUplbLpNCkBqoWM=
github.com/coreos/go-oidc/v3 v3.21.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4= github.com/coreos/go-oidc/v3 v3.21.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/crypto/blake256 v1.1.0 h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8=
github.com/decred/dcrd/crypto/blake256 v1.1.0/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40=
github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218=
github.com/dustin/go-humanize v1.1.0 h1:dbKTrvD0klcbBV/h4AWJdMuZogJACoMlvWIWZ5b2xWg= github.com/dustin/go-humanize v1.1.0 h1:dbKTrvD0klcbBV/h4AWJdMuZogJACoMlvWIWZ5b2xWg=
github.com/dustin/go-humanize v1.1.0/go.mod h1:hc1CvRkJMsgxqjmjMQF3QNRAZBwY8AXBAzKYoSX9sFI= github.com/dustin/go-humanize v1.1.0/go.mod h1:hc1CvRkJMsgxqjmjMQF3QNRAZBwY8AXBAzKYoSX9sFI=
github.com/dvyukov/go-fuzz v0.0.0-20200318091601-be3528f3a813/go.mod h1:11Gm+ccJnvAhCNLlf5+cS9KjtbaD5I5zaZpFMsTHWTw=
github.com/eclipse/paho.mqtt.golang v1.5.1 h1:/VSOv3oDLlpqR2Epjn1Q7b2bSTplJIeV2ISgCl2W7nE= github.com/eclipse/paho.mqtt.golang v1.5.1 h1:/VSOv3oDLlpqR2Epjn1Q7b2bSTplJIeV2ISgCl2W7nE=
github.com/eclipse/paho.mqtt.golang v1.5.1/go.mod h1:1/yJCneuyOoCOzKSsOTUc0AJfpsItBGWvYpBLimhArU= github.com/eclipse/paho.mqtt.golang v1.5.1/go.mod h1:1/yJCneuyOoCOzKSsOTUc0AJfpsItBGWvYpBLimhArU=
github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w=
github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx59Ho= github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx59Ho=
github.com/fsnotify/fsnotify v1.10.1/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo= github.com/fsnotify/fsnotify v1.10.1/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo=
github.com/gabriel-vasile/mimetype v1.4.16 h1:5izNFuvA37st1dDRAcA7TtmngBmRgiIPDmTtiEvjx1E= github.com/gabriel-vasile/mimetype v1.4.16 h1:5izNFuvA37st1dDRAcA7TtmngBmRgiIPDmTtiEvjx1E=
@@ -89,17 +129,30 @@ github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0kt
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/gosnmp/gosnmp v1.47.0 h1:nQ0H9erruu03QP0lviAJ6vB6iiIGE0R5u73MKFr6QPs= github.com/gosnmp/gosnmp v1.47.0 h1:nQ0H9erruu03QP0lviAJ6vB6iiIGE0R5u73MKFr6QPs=
github.com/gosnmp/gosnmp v1.47.0/go.mod h1:LWPVcDKeRsiioQGeITGTQha4mdlx9lgmRmXz6zGINQ4= github.com/gosnmp/gosnmp v1.47.0/go.mod h1:LWPVcDKeRsiioQGeITGTQha4mdlx9lgmRmXz6zGINQ4=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
@@ -108,10 +161,16 @@ github.com/jackc/pgx/v5 v5.13.0 h1:Hl08k64maU0nrRyVUEbwCnK6/gT0EhMrtAqBHz9/gA4=
github.com/jackc/pgx/v5 v5.13.0/go.mod h1:u2Fi6no03HCSBYE+ZVdLxbwdu3xyi2vU+K/YNJioSds= github.com/jackc/pgx/v5 v5.13.0/go.mod h1:u2Fi6no03HCSBYE+ZVdLxbwdu3xyi2vU+K/YNJioSds=
github.com/jackc/puddle/v2 v2.2.3 h1:f8HoREISb3l5eO9coPgK7U3hKLhWGokOFVcThl5jrao= github.com/jackc/puddle/v2 v2.2.3 h1:f8HoREISb3l5eO9coPgK7U3hKLhWGokOFVcThl5jrao=
github.com/jackc/puddle/v2 v2.2.3/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jackc/puddle/v2 v2.2.3/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg=
github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/klauspost/compress v1.20.4 h1:dD0v/bvxtjCBqQu6sx1TNWkalEY5lNTIe+HY9w8TeNI= github.com/klauspost/compress v1.20.4 h1:dD0v/bvxtjCBqQu6sx1TNWkalEY5lNTIe+HY9w8TeNI=
github.com/klauspost/compress v1.20.4/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/klauspost/compress v1.20.4/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw= github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw=
@@ -130,6 +189,8 @@ github.com/letsencrypt/pebble/v2 v2.10.1 h1:oKHx3lgN4e5Nno2LKTMrVx+b+NkDptkO9aDi
github.com/letsencrypt/pebble/v2 v2.10.1/go.mod h1:KtYhQ4YTjT5MtoCZ6RTCXlbrrz6cKyXROCuTpIUDJFY= github.com/letsencrypt/pebble/v2 v2.10.1/go.mod h1:KtYhQ4YTjT5MtoCZ6RTCXlbrrz6cKyXROCuTpIUDJFY=
github.com/libdns/libdns v1.1.1 h1:wPrHrXILoSHKWJKGd0EiAVmiJbFShguILTg9leS/P/U= github.com/libdns/libdns v1.1.1 h1:wPrHrXILoSHKWJKGd0EiAVmiJbFShguILTg9leS/P/U=
github.com/libdns/libdns v1.1.1/go.mod h1:4Bj9+5CQiNMVGf87wjX4CY3HQJypUHRuLvlsfsZqLWQ= github.com/libdns/libdns v1.1.1/go.mod h1:4Bj9+5CQiNMVGf87wjX4CY3HQJypUHRuLvlsfsZqLWQ=
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
github.com/mattn/go-colorable v0.1.16 h1:+2YjeAe7xP1OQbZW1jERPWWCDLlNqFNCvjiqGiAt84A= github.com/mattn/go-colorable v0.1.16 h1:+2YjeAe7xP1OQbZW1jERPWWCDLlNqFNCvjiqGiAt84A=
github.com/mattn/go-colorable v0.1.16/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-colorable v0.1.16/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI= github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI=
@@ -151,10 +212,21 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/natefinch/atomic v1.0.1 h1:ZPYKxkqQOx3KZ+RsbnP/YsgvxWQPGxjC0oBt2AhwV0A= github.com/natefinch/atomic v1.0.1 h1:ZPYKxkqQOx3KZ+RsbnP/YsgvxWQPGxjC0oBt2AhwV0A=
github.com/natefinch/atomic v1.0.1/go.mod h1:N/D/ELrljoqDyT3rZrsUmtsuzvHkeB/wWjHV22AZRbM= github.com/natefinch/atomic v1.0.1/go.mod h1:N/D/ELrljoqDyT3rZrsUmtsuzvHkeB/wWjHV22AZRbM=
github.com/nbd-wtf/go-nostr v0.52.3 h1:Xd87pXfJEJRXHpM+fLjQQln8dBNNaoPA10V7BbyP4KI=
github.com/nbd-wtf/go-nostr v0.52.3/go.mod h1:4avYoc9mDGZ9wHsvCOhHH9vPzKucCfuYBtJUSpHTfNk=
github.com/ncruces/go-strftime v1.1.0 h1:vtPmPWMkb539RGV9WpWT9EwJGvrOCKvMNI4obWL47Hk= github.com/ncruces/go-strftime v1.1.0 h1:vtPmPWMkb539RGV9WpWT9EwJGvrOCKvMNI4obWL47Hk=
github.com/ncruces/go-strftime v1.1.0/go.mod h1:yVaq7iwCN09vHRrKBrrflXT0M9tTMG2KmZ9Fj7xeG/g= github.com/ncruces/go-strftime v1.1.0/go.mod h1:yVaq7iwCN09vHRrKBrrflXT0M9tTMG2KmZ9Fj7xeG/g=
github.com/nicksnyder/go-i18n/v2 v2.7.0 h1:oiVQUmuCeNggvm/fUVb6/R0aP82BDVphZnmVHwut+J0= github.com/nicksnyder/go-i18n/v2 v2.7.0 h1:oiVQUmuCeNggvm/fUVb6/R0aP82BDVphZnmVHwut+J0=
github.com/nicksnyder/go-i18n/v2 v2.7.0/go.mod h1:ZMYiWg8ndQSGNk4zbzbyJjrrVjQjuQ8pERFrnBik+c8= github.com/nicksnyder/go-i18n/v2 v2.7.0/go.mod h1:ZMYiWg8ndQSGNk4zbzbyJjrrVjQjuQ8pERFrnBik+c8=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/pierrec/lz4/v4 v4.1.33 h1:GjG1TJ1V4IzKP8L96muuuDNpTwd7D+l2ccXrjAbe014= github.com/pierrec/lz4/v4 v4.1.33 h1:GjG1TJ1V4IzKP8L96muuuDNpTwd7D+l2ccXrjAbe014=
@@ -166,6 +238,8 @@ github.com/pquerna/otp v1.5.0 h1:NMMR+WrmaqXU4EzdGJEE1aUUI0AMRzsp96fFFWNPwxs=
github.com/pquerna/otp v1.5.0/go.mod h1:dkJfzwRKNiegxyNb54X/3fLwhCynbMspSyWKnvi1AEg= github.com/pquerna/otp v1.5.0/go.mod h1:dkJfzwRKNiegxyNb54X/3fLwhCynbMspSyWKnvi1AEg=
github.com/pressly/goose/v3 v3.30.1 h1:KO28meBdbAUIdMbTP7bl9dp1FYZGXcYWb2O7miT09lE= github.com/pressly/goose/v3 v3.30.1 h1:KO28meBdbAUIdMbTP7bl9dp1FYZGXcYWb2O7miT09lE=
github.com/pressly/goose/v3 v3.30.1/go.mod h1:CHGwuG2acDerUaXwz2i5T18VSauXpYDiL4WxzDvcOIM= github.com/pressly/goose/v3 v3.30.1/go.mod h1:CHGwuG2acDerUaXwz2i5T18VSauXpYDiL4WxzDvcOIM=
github.com/puzpuzpuz/xsync/v3 v3.5.1 h1:GJYJZwO6IdxN/IKbneznS6yPkVC+c3zyY/j19c++5Fg=
github.com/puzpuzpuz/xsync/v3 v3.5.1/go.mod h1:VjzYrABPabuM4KyBh1Ftq6u8nhwY5tBPKP9jpmh0nnA=
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8= github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII= github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
github.com/quic-go/quic-go v0.59.0 h1:OLJkp1Mlm/aS7dpKgTc6cnpynnD2Xg7C1pwL6vy/SAw= github.com/quic-go/quic-go v0.59.0 h1:OLJkp1Mlm/aS7dpKgTc6cnpynnD2Xg7C1pwL6vy/SAw=
@@ -189,6 +263,7 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
@@ -196,6 +271,14 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc=
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/twmb/franz-go v1.22.3 h1:RHe35s34pKefMLyL+ZYJ6mQVtfFZz4zHDHVkTyACur0= github.com/twmb/franz-go v1.22.3 h1:RHe35s34pKefMLyL+ZYJ6mQVtfFZz4zHDHVkTyACur0=
@@ -243,16 +326,25 @@ go.yaml.in/yaml/v3 v3.0.6 h1:zcDfvjXEqTQmpjniUBLc91xYJMB2c4QOFxEF/LCEckM=
go.yaml.in/yaml/v3 v3.0.6/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= go.yaml.in/yaml/v3 v3.0.6/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
golang.org/x/arch v0.22.0 h1:c/Zle32i5ttqRXjdLyyHZESLD/bB90DCU1g9l/0YBDI= golang.org/x/arch v0.22.0 h1:c/Zle32i5ttqRXjdLyyHZESLD/bB90DCU1g9l/0YBDI=
golang.org/x/arch v0.22.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A= golang.org/x/arch v0.22.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c= golang.org/x/crypto v0.59.0 h1:xS2jhqYbzNrpvkWP2YTDf4TJwBy3ykR03i8vFDxEc7c=
golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U= golang.org/x/crypto v0.59.0/go.mod h1:veDyUwATGs3c+vN3VfTbzViMGXeTBk3WyhBOkn+F/4U=
golang.org/x/exp v0.0.0-20261109185158-a52e3aef5920 h1:qr+tk4P56rtbVVAJDyAr5LAOiaD/XhZCoRTr4SfLxAk=
golang.org/x/exp v0.0.0-20261109185158-a52e3aef5920/go.mod h1:J3U+E8RzytcGvwz+uJuAP4zULJ2TkAQBnmPZMexpdXs=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg= golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg=
golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY= golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY=
golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
@@ -261,12 +353,21 @@ golang.org/x/net v0.63.0 h1:HCoTmNh9EpD1PpK8gBNFY4gcTY4N+KQEO8ylfIKqFJ0=
golang.org/x/net v0.63.0/go.mod h1:15JLg3IX1bLjHK264EZQEbIpTiR/KVLuo9CTRWd0pig= golang.org/x/net v0.63.0/go.mod h1:15JLg3IX1bLjHK264EZQEbIpTiR/KVLuo9CTRWd0pig=
golang.org/x/oauth2 v0.38.0 h1:uW7XQbcu1eoiQS7uMJvLOjPMl04bTbmY1VeRPxvbspI= golang.org/x/oauth2 v0.38.0 h1:uW7XQbcu1eoiQS7uMJvLOjPMl04bTbmY1VeRPxvbspI=
golang.org/x/oauth2 v0.38.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58= golang.org/x/oauth2 v0.38.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs= golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs=
golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -282,6 +383,7 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
@@ -294,20 +396,33 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs= golang.org/x/tools v0.52.1-0.20261106145633-d407941a339a h1:Yqozs0FNPRoPGS4hNGlrNwRENWr5H5nVG9sN/f+5640=
golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs= golang.org/x/tools v0.52.1-0.20261106145633-d407941a339a/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c h1:XXChExL+Tm7Ubp0x0VXUEncPLHrkXIgoVWqnxmKNbAA= google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c h1:XXChExL+Tm7Ubp0x0VXUEncPLHrkXIgoVWqnxmKNbAA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= google.golang.org/genproto/googleapis/rpc v0.0.0-20261110000943-09e21b237f2c/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc=
google.golang.org/grpc v1.85.0 h1:BPBCfuVRQ1qvBhKDOq9uvQllMvO59rKsYhXpp7Dd8vw= google.golang.org/grpc v1.85.0 h1:BPBCfuVRQ1qvBhKDOq9uvQllMvO59rKsYhXpp7Dd8vw=
google.golang.org/grpc v1.85.0/go.mod h1:0rQrOD58yjal/0EaVbGBANindixsCZNQPDV3VKtaKuQ= google.golang.org/grpc v1.85.0/go.mod h1:0rQrOD58yjal/0EaVbGBANindixsCZNQPDV3VKtaKuQ=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+9 -1
View File
@@ -709,7 +709,7 @@ func (s *Server) channelsView(c *gin.Context, p *principal, page web.Page, me we
v := web.ChannelsView{EmailAvailable: s.smtp != nil, CanWrite: p.Grants.Can(authz.NotificationsWrite), Languages: s.catalog.Supported()} v := web.ChannelsView{EmailAvailable: s.smtp != nil, CanWrite: p.Grants.Can(authz.NotificationsWrite), Languages: s.catalog.Supported()}
ctx2 := c.Request.Context() ctx2 := c.Request.Context()
for _, pr := range notify.Providers { for _, pr := range notify.Providers {
opt := web.ProviderOption{Type: pr.Type} opt := web.ProviderOption{Type: pr.Type, Group: pr.Group}
if help := i18n.T(ctx2, "channels.help_"+pr.Type); help != "channels.help_"+pr.Type { if help := i18n.T(ctx2, "channels.help_"+pr.Type); help != "channels.help_"+pr.Type {
opt.Help = help opt.Help = help
} }
@@ -721,6 +721,14 @@ func (s *Server) channelsView(c *gin.Context, p *principal, page web.Page, me we
} }
v.Providers = append(v.Providers, opt) v.Providers = append(v.Providers, opt)
} }
// By group, then by name; the first is preselected.
groupOrder := []string{"chat", "push", "sms", "email", "incident", "other"}
slices.SortStableFunc(v.Providers, func(a, b web.ProviderOption) int {
if d := slices.Index(groupOrder, a.Group) - slices.Index(groupOrder, b.Group); d != 0 {
return d
}
return strings.Compare(strings.ToLower(i18n.T(ctx2, "channels.type_"+a.Type)), strings.ToLower(i18n.T(ctx2, "channels.type_"+b.Type)))
})
for _, r := range rows { for _, r := range rows {
cv := viewChannel(r) cv := viewChannel(r)
target := cv.URL target := cv.URL
+1 -1
View File
@@ -129,7 +129,7 @@ func (s *Server) openProviderSettings(typ string, raw []byte) (map[string]string
func (s *Server) messageFor(ev notify.Event, locale string) notify.Message { func (s *Server) messageFor(ev notify.Event, locale string) notify.Message {
l := s.catalog.Match(locale) l := s.catalog.Match(locale)
data := map[string]any{"Monitor": ev.Monitor.Name} data := map[string]any{"Monitor": ev.Monitor.Name}
m := notify.Message{Event: ev.Kind, Key: ev.IncidentID} m := notify.Message{Event: ev.Kind, Key: ev.IncidentID, Monitor: ev.Monitor.Name, MonitorID: ev.Monitor.ID, Target: ev.Monitor.Target}
var lines []string var lines []string
switch ev.Kind { switch ev.Kind {
case notify.Opened: case notify.Opened:
+11 -1
View File
@@ -99,7 +99,17 @@ func TestProviderChannel(t *testing.T) {
if !strings.Contains(bodies[0], "Test von UptimeSebi") || !strings.Contains(bodies[1], `"chat_id":"-100999"`) { if !strings.Contains(bodies[0], "Test von UptimeSebi") || !strings.Contains(bodies[1], `"chat_id":"-100999"`) {
t.Errorf("telegram bodies = %v", bodies) t.Errorf("telegram bodies = %v", bodies)
} }
if _, _, page := owner.page("/settings/channels"); !strings.Contains(page, `name="settings.bot_token"`) || !strings.Contains(page, "-100999") { _, _, page := owner.page("/settings/channels")
if !strings.Contains(page, `name="settings.bot_token"`) || !strings.Contains(page, "-100999") {
t.Error("the channels page lacks the service form or the channel") t.Error("the channels page lacks the service form or the channel")
} }
// Services are grouped, and every one has its settings form.
if !strings.Contains(page, `<optgroup label="SMS and calls">`) {
t.Error("the services are not grouped")
}
for _, p := range notify.Providers {
if !strings.Contains(page, `<fieldset data-type="`+p.Type+`"`) {
t.Errorf("the channels page lacks the form of %s", p.Type)
}
}
} }
+20 -2
View File
@@ -12,6 +12,7 @@ import (
"testing" "testing"
"git.zb-server.de/ZB-Server/uptimesebi/internal/authz" "git.zb-server.de/ZB-Server/uptimesebi/internal/authz"
"git.zb-server.de/ZB-Server/uptimesebi/internal/notify"
) )
func catalogKeys(t *testing.T) map[string]map[string]bool { func catalogKeys(t *testing.T) map[string]map[string]bool {
@@ -153,7 +154,6 @@ func TestDynamicFamilies(t *testing.T) {
families := map[string][]string{ families := map[string][]string{
"status.": {"up", "degraded", "down", "unknown", "paused", "maintenance"}, "status.": {"up", "degraded", "down", "unknown", "paused", "maintenance"},
"monitors.type_": {"http", "tcp", "tls", "dns", "icmp", "json", "prometheus", "postgres", "mysql", "mssql", "mongodb", "redis", "mqtt", "kafka", "rabbitmq", "grpc", "smtp", "radius", "snmp", "steam", "minecraft", "docker", "heartbeat", "alertmanager"}, "monitors.type_": {"http", "tcp", "tls", "dns", "icmp", "json", "prometheus", "postgres", "mysql", "mssql", "mongodb", "redis", "mqtt", "kafka", "rabbitmq", "grpc", "smtp", "radius", "snmp", "steam", "minecraft", "docker", "heartbeat", "alertmanager"},
"channels.type_": {"webhook", "email", "slack", "discord", "teams", "googlechat", "mattermost", "rocketchat", "telegram", "matrix", "ntfy", "gotify", "pushover", "pushbullet", "signal", "pagerduty", "opsgenie", "apprise"},
"agents.kind_": {"checker", "statuspage"}, "agents.kind_": {"checker", "statuspage"},
"page.status.": {"operational", "degraded", "outage", "unknown", "maintenance"}, "page.status.": {"operational", "degraded", "outage", "unknown", "maintenance"},
"page.component.": {"operational", "degraded", "outage", "unknown", "maintenance"}, "page.component.": {"operational", "degraded", "outage", "unknown", "maintenance"},
@@ -162,7 +162,6 @@ func TestDynamicFamilies(t *testing.T) {
"monitors.op_": {"eq", "ne", "gt", "ge", "lt", "le", "contains", "exists", "absent"}, "monitors.op_": {"eq", "ne", "gt", "ge", "lt", "le", "contains", "exists", "absent"},
"evidence.stage_": {"dns", "connect", "tls", "response", "body"}, "evidence.stage_": {"dns", "connect", "tls", "response", "body"},
"evidence.phase_": {"dns", "connect", "tls", "wait", "download"}, "evidence.phase_": {"dns", "connect", "tls", "wait", "download"},
"channels.field_": {"webhook_url", "channel", "bot_token", "chat_id", "thread_id", "api_url", "homeserver_url", "access_token", "room_id", "server_url", "topic", "priority", "app_token", "user_key", "device", "number", "recipients", "routing_key", "severity", "api_key", "region", "urls", "config_key"},
"monitors.db_database_": {"postgres", "mysql", "mssql", "mongodb", "redis"}, "monitors.db_database_": {"postgres", "mysql", "mssql", "mongodb", "redis"},
"monitors.broker_hint_": {"mqtt", "kafka", "rabbitmq"}, "monitors.broker_hint_": {"mqtt", "kafka", "rabbitmq"},
"monitors.snmp_cond_": {"any", "eq", "ne", "contains", "gt", "ge", "lt", "le"}, "monitors.snmp_cond_": {"any", "eq", "ne", "contains", "gt", "ge", "lt", "le"},
@@ -173,6 +172,25 @@ func TestDynamicFamilies(t *testing.T) {
"maintenance.recurrence_": {"none", "daily", "weekly", "monthly"}, "maintenance.recurrence_": {"none", "daily", "weekly", "monthly"},
"storage.job_": {"compression", "retention", "refresh_continuous_aggregate", "job_stat_history_retention"}, "storage.job_": {"compression", "retention", "refresh_continuous_aggregate", "job_stat_history_retention"},
} }
// Notification services name their type, group and settings.
families["channels.type_"] = []string{"webhook", "email"}
seenGroup, seenField := map[string]bool{}, map[string]bool{}
for _, p := range notify.Providers {
families["channels.type_"] = append(families["channels.type_"], p.Type)
if !seenGroup[p.Group] {
seenGroup[p.Group] = true
families["channels.group_"] = append(families["channels.group_"], p.Group)
}
for _, f := range p.Fields {
if !seenField[f.Name] {
seenField[f.Name] = true
families["channels.field_"] = append(families["channels.field_"], f.Name)
}
}
if en["channels.help_"+p.Type] {
families["channels.help_"] = append(families["channels.help_"], p.Type)
}
}
for prefix, values := range families { for prefix, values := range families {
for _, v := range values { for _, v := range values {
if !en[prefix+v] { if !en[prefix+v] {
+199
View File
@@ -124,33 +124,139 @@
"auth.sso.submit": "Weiter", "auth.sso.submit": "Weiter",
"channels.create": "Kanal anlegen", "channels.create": "Kanal anlegen",
"channels.delete_confirm": "Diesen Kanal löschen?", "channels.delete_confirm": "Diesen Kanal löschen?",
"channels.field_access_key": "Zugriffsschlüssel",
"channels.field_access_key_id": "AccessKey-ID",
"channels.field_access_key_secret": "AccessKey-Secret",
"channels.field_access_token": "Zugriffstoken", "channels.field_access_token": "Zugriffstoken",
"channels.field_account_sid": "Account-SID",
"channels.field_action_group_id": "Aktionsgruppen-ID",
"channels.field_answer_url": "Answer-URL (für Anrufe)",
"channels.field_api_key": "API-Schlüssel", "channels.field_api_key": "API-Schlüssel",
"channels.field_api_token": "API-Token",
"channels.field_api_url": "API-URL", "channels.field_api_url": "API-URL",
"channels.field_api_version": "API-Version",
"channels.field_app_token": "Anwendungs-Token", "channels.field_app_token": "Anwendungs-Token",
"channels.field_auth_id": "Auth-ID",
"channels.field_auth_token": "Auth-Token",
"channels.field_bcc_email": "BCC (durch Komma getrennt)",
"channels.field_bot_id": "Bot-ID",
"channels.field_bot_key": "Bot-Schlüssel",
"channels.field_bot_secret": "Bot-Geheimnis",
"channels.field_bot_token": "Bot-Token", "channels.field_bot_token": "Bot-Token",
"channels.field_cc_email": "CC (durch Komma getrennt)",
"channels.field_channel": "Kanal", "channels.field_channel": "Kanal",
"channels.field_channel_id": "Kanal-ID",
"channels.field_chat_id": "Chat-ID", "channels.field_chat_id": "Chat-ID",
"channels.field_chat_ids": "Chat-IDs (durch Komma getrennt)",
"channels.field_client_id": "Client-ID",
"channels.field_client_key": "Client-Schlüssel",
"channels.field_client_secret": "Client-Secret",
"channels.field_cloud_id": "Cloud-ID",
"channels.field_config_key": "Konfigurationsschlüssel", "channels.field_config_key": "Konfigurationsschlüssel",
"channels.field_consumer_key": "Consumer-Key",
"channels.field_consumer_secret": "Consumer-Secret",
"channels.field_conversation_token": "Unterhaltungs-Token",
"channels.field_device": "Gerät", "channels.field_device": "Gerät",
"channels.field_device_id": "Geräte-ID",
"channels.field_device_token": "Geräte-Token",
"channels.field_email": "Konto-E-Mail",
"channels.field_endpoint_url": "Endpunkt-URL",
"channels.field_environment": "Umgebung",
"channels.field_from_email": "Absenderadresse",
"channels.field_from_name": "Absendername",
"channels.field_gateway": "Gateway-Typ",
"channels.field_gateway_id": "Gateway-ID (Absender)",
"channels.field_gateway_secret": "Gateway-Secret",
"channels.field_group": "Gruppe",
"channels.field_group_ids": "Gruppen-IDs (durch Komma getrennt)",
"channels.field_hash_key": "Hash-Schlüssel",
"channels.field_homeserver_url": "Homeserver-URL", "channels.field_homeserver_url": "Homeserver-URL",
"channels.field_instance": "Instanz",
"channels.field_integration_key": "Integrationsschlüssel oder Push-URL",
"channels.field_integration_url": "Integrations-URL",
"channels.field_line_number": "Leitungsnummer",
"channels.field_mailbox": "Absender-Postfach",
"channels.field_mentioned_mobiles": "Handynummern erwähnen (durch Komma getrennt)",
"channels.field_message_type": "Nachrichtentyp",
"channels.field_messaging_profile_id": "Messaging-Profil-ID",
"channels.field_messaging_service_sid": "Messaging-Service-SID",
"channels.field_modem": "Modem-ID",
"channels.field_number": "Absendernummer", "channels.field_number": "Absendernummer",
"channels.field_originator_type": "Absendertyp",
"channels.field_password": "Passwort",
"channels.field_peer_id": "Peer-ID",
"channels.field_phone_number": "Telefonnummer",
"channels.field_phone_numbers": "Telefonnummern (durch Komma getrennt)",
"channels.field_platform": "Plattform",
"channels.field_priority": "Priorität", "channels.field_priority": "Priorität",
"channels.field_publish_url": "Publish-URL",
"channels.field_push_key": "Push-Schlüssel",
"channels.field_receiver_id": "Empfänger-ID",
"channels.field_recipient": "Empfänger",
"channels.field_recipient_type": "Empfängertyp",
"channels.field_recipients": "Empfänger (durch Komma getrennt)", "channels.field_recipients": "Empfänger (durch Komma getrennt)",
"channels.field_region": "Region", "channels.field_region": "Region",
"channels.field_relays": "Relays (wss://, durch Komma getrennt)",
"channels.field_rest_url": "REST-Endpunkt-URL (mit Routing-Key)",
"channels.field_room_id": "Raum-ID", "channels.field_room_id": "Raum-ID",
"channels.field_routing_key": "Integrationsschlüssel", "channels.field_routing_key": "Integrationsschlüssel",
"channels.field_send_key": "SendKey",
"channels.field_sender": "Absender",
"channels.field_sender_nsec": "Privater Absenderschlüssel (nsec)",
"channels.field_server_url": "Server-URL", "channels.field_server_url": "Server-URL",
"channels.field_service": "Notify-Service (Standard: notify)",
"channels.field_session": "Session",
"channels.field_severity": "Schweregrad", "channels.field_severity": "Schweregrad",
"channels.field_sign_name": "Signaturname",
"channels.field_sign_secret": "Signatur-Secret",
"channels.field_sms_type": "SMS-Typ",
"channels.field_sound": "Ton",
"channels.field_spt": "SPT-Tokens (durch Komma getrennt)",
"channels.field_subject": "Betreff (Standard: Titel des Vorfalls)",
"channels.field_target": "Ziel",
"channels.field_target_id": "Geräte- oder Benutzer-ID",
"channels.field_template_code": "Vorlagencode",
"channels.field_template_id": "Vorlagen-ID",
"channels.field_template_key": "Vorlagenschlüssel",
"channels.field_tenant_id": "Mandanten-ID",
"channels.field_thread_id": "Themen-ID (Forum-Gruppen)", "channels.field_thread_id": "Themen-ID (Forum-Gruppen)",
"channels.field_to_email": "Empfänger (durch Komma getrennt)",
"channels.field_token": "Token",
"channels.field_topic": "Topic", "channels.field_topic": "Topic",
"channels.field_trigger_id": "Trigger-ID",
"channels.field_urgency": "Dringlichkeit",
"channels.field_urls": "Apprise-URLs", "channels.field_urls": "Apprise-URLs",
"channels.field_user_id": "Benutzer-ID",
"channels.field_user_key": "Benutzer-Schlüssel", "channels.field_user_key": "Benutzer-Schlüssel",
"channels.field_username": "Benutzername",
"channels.field_variable_id": "Variablen-ID",
"channels.field_webhook_url": "Webhook-URL", "channels.field_webhook_url": "Webhook-URL",
"channels.field_workspace_id": "Workspace-ID",
"channels.group_chat": "Chat und Messenger",
"channels.group_email": "E-Mail-Dienste",
"channels.group_incident": "Incident-Management",
"channels.group_other": "Weitere",
"channels.group_push": "Push",
"channels.group_sms": "SMS und Anrufe",
"channels.help_aliyunsms": "Die Vorlage erhält die Parameter name, time, status und msg.",
"channels.help_apprise": "Erreicht über 100 Dienste über einen Apprise-API-Server: gib Apprise-URLs oder den Schlüssel einer dort gespeicherten Konfiguration an.", "channels.help_apprise": "Erreicht über 100 Dienste über einen Apprise-API-Server: gib Apprise-URLs oder den Schlüssel einer dort gespeicherten Konfiguration an.",
"channels.help_bark": "Der Endpunkt enthält deinen Geräteschlüssel, z. B. https://api.day.app/KEY.",
"channels.help_callmebot": "Die URL, die CallMeBot dir geschickt hat, mit Telefonnummer und API-Key.",
"channels.help_dingtalk": "Die Webhook-URL des Roboters; das Signatur-Secret angeben, wenn der Roboter „Zusatzsignatur“ nutzt.",
"channels.help_freemobile": "Schreibt dem Telefon des Free-Mobile-Kontos; dort „Notifications par SMS“ aktivieren.",
"channels.help_googlesheets": "Die URL einer Google-Apps-Script-Web-App, die die gesendeten Felder als Zeile anhängt.",
"channels.help_homeassistant": "Nutzt einen langlebigen Zugriffstoken. Der Service ist der Teil nach notify., z. B. mobile_app_phone; persistent_notification zeigt sie in Home Assistant an.",
"channels.help_keep": "Nutzt die Uptime-Kuma-Integration von Keep.",
"channels.help_microsoftgraph": "Braucht eine App-Registrierung in Microsoft Entra mit der Anwendungsberechtigung Mail.Send; gesendet wird als das Postfach.",
"channels.help_nostr": "Sendet eine verschlüsselte Privatnachricht (NIP-17) vom Absenderschlüssel an jede npub über die Relays.",
"channels.help_opsgenie": "Der Alert wird geschlossen, wenn der Vorfall behoben ist.", "channels.help_opsgenie": "Der Alert wird geschlossen, wenn der Vorfall behoben ist.",
"channels.help_opsimate": "Nutzt die Uptime-Kuma-Integration von OpsiMate.",
"channels.help_pagerduty": "Nutze den Integrationsschlüssel einer Events-API-v2-Integration; die Behebung schließt den PagerDuty-Vorfall.", "channels.help_pagerduty": "Nutze den Integrationsschlüssel einer Events-API-v2-Integration; die Behebung schließt den PagerDuty-Vorfall.",
"channels.help_pinglet": "Nutzt das Uptime-Kuma-Format von Pinglet.",
"channels.help_plivo": "Für Anrufe muss die Answer-URL Plivo-XML liefern; die Nachricht kommt als Parameter message.",
"channels.help_signal": "Braucht einen signal-cli-REST-API-Server (bbernhard/signal-cli-rest-api) mit registrierter Nummer.", "channels.help_signal": "Braucht einen signal-cli-REST-API-Server (bbernhard/signal-cli-rest-api) mit registrierter Nummer.",
"channels.help_smsir": "sms.ir versendet Verify-Vorlagen; die Vorlage braucht einen Parameter uptkumaalert, der Monitor und Zustand erhält.",
"channels.help_splunk": "Der REST-Endpunkt aus der REST-Integration von Splunk On-Call, mit dem Routing-Key am Ende.",
"channels.help_teams": "Nutze die URL eines Teams-Workflows „Bei Empfang einer Webhookanforderung in einem Kanal posten“.", "channels.help_teams": "Nutze die URL eines Teams-Workflows „Bei Empfang einer Webhookanforderung in einem Kanal posten“.",
"channels.help_telegram": "Lege mit @BotFather einen Bot an; die Chat-ID einer Gruppe beginnt mit -100.", "channels.help_telegram": "Lege mit @BotFather einen Bot an; die Chat-ID einer Gruppe beginnt mit -100.",
"channels.intro": "Jeder aktive Kanal wird benachrichtigt, wenn ein Monitor in allen seinen Regionen ausfällt und wenn er sich erholt.", "channels.intro": "Jeder aktive Kanal wird benachrichtigt, wenn ein Monitor in allen seinen Regionen ausfällt und wenn er sich erholt.",
@@ -166,24 +272,117 @@
"channels.test_ok": "Testbenachrichtigung zugestellt.", "channels.test_ok": "Testbenachrichtigung zugestellt.",
"channels.title": "Benachrichtigungen", "channels.title": "Benachrichtigungen",
"channels.to": "Empfänger", "channels.to": "Empfänger",
"channels.type_alerta": "Alerta",
"channels.type_alertnow": "AlertNow",
"channels.type_aliyunsms": "Alibaba Cloud SMS",
"channels.type_amootsms": "Amoot SMS",
"channels.type_apprise": "Apprise", "channels.type_apprise": "Apprise",
"channels.type_bale": "Bale",
"channels.type_bark": "Bark",
"channels.type_bearsms": "BearSMS",
"channels.type_bitrix": "Bitrix24",
"channels.type_brevo": "Brevo",
"channels.type_callmebot": "CallMeBot",
"channels.type_cellsynt": "Cellsynt",
"channels.type_clicksend": "ClickSend SMS",
"channels.type_clickup": "ClickUp Chat",
"channels.type_dingtalk": "DingTalk",
"channels.type_discord": "Discord", "channels.type_discord": "Discord",
"channels.type_egosms": "EgoSMS",
"channels.type_elks46": "46elks",
"channels.type_email": "E-Mail", "channels.type_email": "E-Mail",
"channels.type_evolution": "Evolution API (WhatsApp)",
"channels.type_feishu": "Feishu / Lark",
"channels.type_flashduty": "Flashduty",
"channels.type_flowtriq": "Flowtriq",
"channels.type_fluxer": "Fluxer",
"channels.type_freemobile": "Free Mobile",
"channels.type_goalert": "GoAlert",
"channels.type_googlechat": "Google Chat", "channels.type_googlechat": "Google Chat",
"channels.type_googlesheets": "Google Sheets",
"channels.type_gorush": "Gorush",
"channels.type_gotify": "Gotify", "channels.type_gotify": "Gotify",
"channels.type_grafanaoncall": "Grafana OnCall",
"channels.type_gtxmessaging": "GTX Messaging",
"channels.type_halopsa": "HaloPSA",
"channels.type_heiioncall": "Heii On-Call",
"channels.type_homeassistant": "Home Assistant",
"channels.type_indigo": "Indigo",
"channels.type_jsm": "Jira Service Management",
"channels.type_keep": "Keep",
"channels.type_kook": "KOOK",
"channels.type_line": "LINE Messaging API",
"channels.type_lunasea": "LunaSea",
"channels.type_matrix": "Matrix", "channels.type_matrix": "Matrix",
"channels.type_mattermost": "Mattermost", "channels.type_mattermost": "Mattermost",
"channels.type_max": "MAX",
"channels.type_messenger360": "360messenger (WhatsApp)",
"channels.type_microsoftgraph": "Microsoft 365 (Graph)",
"channels.type_milky": "Milky (QQ)",
"channels.type_nextcloudtalk": "Nextcloud Talk",
"channels.type_nostr": "Nostr",
"channels.type_notifery": "Notifery",
"channels.type_notifyapp": "NotifyApp",
"channels.type_ntfy": "ntfy", "channels.type_ntfy": "ntfy",
"channels.type_octopush": "Octopush",
"channels.type_onebot": "OneBot (QQ)",
"channels.type_onechat": "OneChat",
"channels.type_onesender": "OneSender (WhatsApp)",
"channels.type_ooredoo": "Ooredoo Maldives",
"channels.type_openwa": "OpenWA (WhatsApp)",
"channels.type_opsgenie": "Opsgenie", "channels.type_opsgenie": "Opsgenie",
"channels.type_opsimate": "OpsiMate",
"channels.type_pagerduty": "PagerDuty", "channels.type_pagerduty": "PagerDuty",
"channels.type_pagertree": "PagerTree",
"channels.type_pinglet": "Pinglet",
"channels.type_plivo": "Plivo",
"channels.type_promosms": "PromoSMS",
"channels.type_pumble": "Pumble",
"channels.type_pushbullet": "Pushbullet", "channels.type_pushbullet": "Pushbullet",
"channels.type_pushdeer": "PushDeer",
"channels.type_pushover": "Pushover", "channels.type_pushover": "Pushover",
"channels.type_pushplus": "PushPlus",
"channels.type_pushy": "Pushy",
"channels.type_resend": "Resend",
"channels.type_rocketchat": "Rocket.Chat", "channels.type_rocketchat": "Rocket.Chat",
"channels.type_sendgrid": "SendGrid",
"channels.type_serverchan": "ServerChan",
"channels.type_serwersms": "SerwerSMS.pl",
"channels.type_sevenio": "seven",
"channels.type_signal": "Signal", "channels.type_signal": "Signal",
"channels.type_signalgrid": "Signalgrid",
"channels.type_signl4": "SIGNL4",
"channels.type_slack": "Slack", "channels.type_slack": "Slack",
"channels.type_smsc": "SMSC",
"channels.type_smseagle": "SMSEagle",
"channels.type_smsgateway": "SMS Gateway for Android",
"channels.type_smsir": "sms.ir",
"channels.type_smsmanager": "SmsManager",
"channels.type_smspartner": "SMS Partner",
"channels.type_smsplanet": "SMSPlanet",
"channels.type_splunk": "Splunk On-Call (VictorOps)",
"channels.type_spugpush": "Spug Push",
"channels.type_squadcast": "Squadcast",
"channels.type_stackfield": "Stackfield",
"channels.type_teams": "Microsoft Teams", "channels.type_teams": "Microsoft Teams",
"channels.type_techulus": "Techulus Push",
"channels.type_telegram": "Telegram", "channels.type_telegram": "Telegram",
"channels.type_telnyx": "Telnyx",
"channels.type_teltonika": "Teltonika router",
"channels.type_threema": "Threema",
"channels.type_trigv": "Trigv",
"channels.type_turbosmtp": "turboSMTP",
"channels.type_twilio": "Twilio",
"channels.type_vk": "VK",
"channels.type_vkteams": "VK Teams",
"channels.type_waha": "WAHA (WhatsApp)",
"channels.type_webhook": "Webhook", "channels.type_webhook": "Webhook",
"channels.type_wecom": "WeCom (WeChat Work)",
"channels.type_whapi": "Whapi (WhatsApp)",
"channels.type_wpush": "WPush",
"channels.type_wxpusher": "WxPusher",
"channels.type_yunzhijia": "Yunzhijia",
"channels.type_zohocliq": "Zoho Cliq",
"channels.url": "Webhook-URL", "channels.url": "Webhook-URL",
"checkers.avg_latency": "Mittlere Latenz", "checkers.avg_latency": "Mittlere Latenz",
"checkers.for": "seit {{.Duration}}", "checkers.for": "seit {{.Duration}}",
+199
View File
@@ -124,33 +124,139 @@
"auth.sso.submit": "Continue", "auth.sso.submit": "Continue",
"channels.create": "Create channel", "channels.create": "Create channel",
"channels.delete_confirm": "Delete this channel?", "channels.delete_confirm": "Delete this channel?",
"channels.field_access_key": "Access key",
"channels.field_access_key_id": "AccessKey ID",
"channels.field_access_key_secret": "AccessKey secret",
"channels.field_access_token": "Access token", "channels.field_access_token": "Access token",
"channels.field_account_sid": "Account SID",
"channels.field_action_group_id": "Action group ID",
"channels.field_answer_url": "Answer URL (for calls)",
"channels.field_api_key": "API key", "channels.field_api_key": "API key",
"channels.field_api_token": "API token",
"channels.field_api_url": "API URL", "channels.field_api_url": "API URL",
"channels.field_api_version": "API version",
"channels.field_app_token": "Application token", "channels.field_app_token": "Application token",
"channels.field_auth_id": "Auth ID",
"channels.field_auth_token": "Auth token",
"channels.field_bcc_email": "BCC (comma-separated)",
"channels.field_bot_id": "Bot ID",
"channels.field_bot_key": "Bot key",
"channels.field_bot_secret": "Bot secret",
"channels.field_bot_token": "Bot token", "channels.field_bot_token": "Bot token",
"channels.field_cc_email": "CC (comma-separated)",
"channels.field_channel": "Channel", "channels.field_channel": "Channel",
"channels.field_channel_id": "Channel ID",
"channels.field_chat_id": "Chat ID", "channels.field_chat_id": "Chat ID",
"channels.field_chat_ids": "Chat IDs (comma-separated)",
"channels.field_client_id": "Client ID",
"channels.field_client_key": "Client key",
"channels.field_client_secret": "Client secret",
"channels.field_cloud_id": "Cloud ID",
"channels.field_config_key": "Configuration key", "channels.field_config_key": "Configuration key",
"channels.field_consumer_key": "Consumer key",
"channels.field_consumer_secret": "Consumer secret",
"channels.field_conversation_token": "Conversation token",
"channels.field_device": "Device", "channels.field_device": "Device",
"channels.field_device_id": "Device ID",
"channels.field_device_token": "Device token",
"channels.field_email": "Account email",
"channels.field_endpoint_url": "Endpoint URL",
"channels.field_environment": "Environment",
"channels.field_from_email": "Sender address",
"channels.field_from_name": "Sender name",
"channels.field_gateway": "Gateway type",
"channels.field_gateway_id": "Gateway ID (sender)",
"channels.field_gateway_secret": "Gateway secret",
"channels.field_group": "Group",
"channels.field_group_ids": "Group IDs (comma-separated)",
"channels.field_hash_key": "Hash key",
"channels.field_homeserver_url": "Homeserver URL", "channels.field_homeserver_url": "Homeserver URL",
"channels.field_instance": "Instance",
"channels.field_integration_key": "Integration key or push URL",
"channels.field_integration_url": "Integration URL",
"channels.field_line_number": "Line number",
"channels.field_mailbox": "Sending mailbox",
"channels.field_mentioned_mobiles": "Mention mobiles (comma-separated)",
"channels.field_message_type": "Message type",
"channels.field_messaging_profile_id": "Messaging profile ID",
"channels.field_messaging_service_sid": "Messaging service SID",
"channels.field_modem": "Modem ID",
"channels.field_number": "Sender number", "channels.field_number": "Sender number",
"channels.field_originator_type": "Sender type",
"channels.field_password": "Password",
"channels.field_peer_id": "Peer ID",
"channels.field_phone_number": "Phone number",
"channels.field_phone_numbers": "Phone numbers (comma-separated)",
"channels.field_platform": "Platform",
"channels.field_priority": "Priority", "channels.field_priority": "Priority",
"channels.field_publish_url": "Publish URL",
"channels.field_push_key": "Push key",
"channels.field_receiver_id": "Receiver ID",
"channels.field_recipient": "Recipient",
"channels.field_recipient_type": "Recipient type",
"channels.field_recipients": "Recipients (comma-separated)", "channels.field_recipients": "Recipients (comma-separated)",
"channels.field_region": "Region", "channels.field_region": "Region",
"channels.field_relays": "Relays (wss://, comma-separated)",
"channels.field_rest_url": "REST endpoint URL (with routing key)",
"channels.field_room_id": "Room ID", "channels.field_room_id": "Room ID",
"channels.field_routing_key": "Integration key", "channels.field_routing_key": "Integration key",
"channels.field_send_key": "SendKey",
"channels.field_sender": "Sender",
"channels.field_sender_nsec": "Sender private key (nsec)",
"channels.field_server_url": "Server URL", "channels.field_server_url": "Server URL",
"channels.field_service": "Notify service (default: notify)",
"channels.field_session": "Session",
"channels.field_severity": "Severity", "channels.field_severity": "Severity",
"channels.field_sign_name": "Signature name",
"channels.field_sign_secret": "Signing secret",
"channels.field_sms_type": "SMS type",
"channels.field_sound": "Sound",
"channels.field_spt": "SPT tokens (comma-separated)",
"channels.field_subject": "Subject (default: incident title)",
"channels.field_target": "Target",
"channels.field_target_id": "Device or user ID",
"channels.field_template_code": "Template code",
"channels.field_template_id": "Template ID",
"channels.field_template_key": "Template key",
"channels.field_tenant_id": "Tenant ID",
"channels.field_thread_id": "Topic ID (forum groups)", "channels.field_thread_id": "Topic ID (forum groups)",
"channels.field_to_email": "Recipients (comma-separated)",
"channels.field_token": "Token",
"channels.field_topic": "Topic", "channels.field_topic": "Topic",
"channels.field_trigger_id": "Trigger ID",
"channels.field_urgency": "Urgency",
"channels.field_urls": "Apprise URLs", "channels.field_urls": "Apprise URLs",
"channels.field_user_id": "User ID",
"channels.field_user_key": "User key", "channels.field_user_key": "User key",
"channels.field_username": "Username",
"channels.field_variable_id": "Variable ID",
"channels.field_webhook_url": "Webhook URL", "channels.field_webhook_url": "Webhook URL",
"channels.field_workspace_id": "Workspace ID",
"channels.group_chat": "Chat and messengers",
"channels.group_email": "Email services",
"channels.group_incident": "Incident management",
"channels.group_other": "More",
"channels.group_push": "Push",
"channels.group_sms": "SMS and calls",
"channels.help_aliyunsms": "The template receives the parameters name, time, status and msg.",
"channels.help_apprise": "Reaches over 100 services through an Apprise API server: give Apprise URLs or the key of a configuration stored there.", "channels.help_apprise": "Reaches over 100 services through an Apprise API server: give Apprise URLs or the key of a configuration stored there.",
"channels.help_bark": "The endpoint includes your device key, e.g. https://api.day.app/KEY.",
"channels.help_callmebot": "The URL CallMeBot sent you, with phone number and API key.",
"channels.help_dingtalk": "The robot's webhook URL; add the signing secret if the robot uses \"additional signature\".",
"channels.help_freemobile": "Texts the phone of the Free Mobile account; enable \"Notifications par SMS\" in its options.",
"channels.help_googlesheets": "The URL of a Google Apps Script web app that appends the posted fields as a row.",
"channels.help_homeassistant": "Uses a long-lived access token. The service is the part after notify., e.g. mobile_app_phone; persistent_notification shows it in Home Assistant.",
"channels.help_keep": "Uses Keep's Uptime Kuma integration.",
"channels.help_microsoftgraph": "Needs an app registration in Microsoft Entra with the Mail.Send application permission; mail is sent as the mailbox.",
"channels.help_nostr": "Sends an encrypted private message (NIP-17) from the sender key to each npub through the relays.",
"channels.help_opsgenie": "The alert closes when the incident is resolved.", "channels.help_opsgenie": "The alert closes when the incident is resolved.",
"channels.help_opsimate": "Uses OpsiMate's Uptime Kuma integration.",
"channels.help_pagerduty": "Use the integration key of an Events API v2 integration; resolving closes the PagerDuty incident.", "channels.help_pagerduty": "Use the integration key of an Events API v2 integration; resolving closes the PagerDuty incident.",
"channels.help_pinglet": "Uses Pinglet's Uptime Kuma format.",
"channels.help_plivo": "For calls, the answer URL must return Plivo XML; the message is passed as the message parameter.",
"channels.help_signal": "Needs a signal-cli REST API server (bbernhard/signal-cli-rest-api) with a registered number.", "channels.help_signal": "Needs a signal-cli REST API server (bbernhard/signal-cli-rest-api) with a registered number.",
"channels.help_smsir": "sms.ir sends verify templates; the template needs a parameter named uptkumaalert, which gets the monitor and its state.",
"channels.help_splunk": "The REST endpoint from Splunk On-Call's REST integration, ending in the routing key.",
"channels.help_teams": "Use the URL of a Teams workflow \"Post to a channel when a webhook request is received\".", "channels.help_teams": "Use the URL of a Teams workflow \"Post to a channel when a webhook request is received\".",
"channels.help_telegram": "Create a bot with @BotFather; the chat ID of a group starts with -100.", "channels.help_telegram": "Create a bot with @BotFather; the chat ID of a group starts with -100.",
"channels.intro": "Every enabled channel is notified when a monitor goes down in all of its regions and when it recovers.", "channels.intro": "Every enabled channel is notified when a monitor goes down in all of its regions and when it recovers.",
@@ -166,24 +272,117 @@
"channels.test_ok": "Test notification delivered.", "channels.test_ok": "Test notification delivered.",
"channels.title": "Notifications", "channels.title": "Notifications",
"channels.to": "Recipients", "channels.to": "Recipients",
"channels.type_alerta": "Alerta",
"channels.type_alertnow": "AlertNow",
"channels.type_aliyunsms": "Alibaba Cloud SMS",
"channels.type_amootsms": "Amoot SMS",
"channels.type_apprise": "Apprise", "channels.type_apprise": "Apprise",
"channels.type_bale": "Bale",
"channels.type_bark": "Bark",
"channels.type_bearsms": "BearSMS",
"channels.type_bitrix": "Bitrix24",
"channels.type_brevo": "Brevo",
"channels.type_callmebot": "CallMeBot",
"channels.type_cellsynt": "Cellsynt",
"channels.type_clicksend": "ClickSend SMS",
"channels.type_clickup": "ClickUp Chat",
"channels.type_dingtalk": "DingTalk",
"channels.type_discord": "Discord", "channels.type_discord": "Discord",
"channels.type_egosms": "EgoSMS",
"channels.type_elks46": "46elks",
"channels.type_email": "Email", "channels.type_email": "Email",
"channels.type_evolution": "Evolution API (WhatsApp)",
"channels.type_feishu": "Feishu / Lark",
"channels.type_flashduty": "Flashduty",
"channels.type_flowtriq": "Flowtriq",
"channels.type_fluxer": "Fluxer",
"channels.type_freemobile": "Free Mobile",
"channels.type_goalert": "GoAlert",
"channels.type_googlechat": "Google Chat", "channels.type_googlechat": "Google Chat",
"channels.type_googlesheets": "Google Sheets",
"channels.type_gorush": "Gorush",
"channels.type_gotify": "Gotify", "channels.type_gotify": "Gotify",
"channels.type_grafanaoncall": "Grafana OnCall",
"channels.type_gtxmessaging": "GTX Messaging",
"channels.type_halopsa": "HaloPSA",
"channels.type_heiioncall": "Heii On-Call",
"channels.type_homeassistant": "Home Assistant",
"channels.type_indigo": "Indigo",
"channels.type_jsm": "Jira Service Management",
"channels.type_keep": "Keep",
"channels.type_kook": "KOOK",
"channels.type_line": "LINE Messaging API",
"channels.type_lunasea": "LunaSea",
"channels.type_matrix": "Matrix", "channels.type_matrix": "Matrix",
"channels.type_mattermost": "Mattermost", "channels.type_mattermost": "Mattermost",
"channels.type_max": "MAX",
"channels.type_messenger360": "360messenger (WhatsApp)",
"channels.type_microsoftgraph": "Microsoft 365 (Graph)",
"channels.type_milky": "Milky (QQ)",
"channels.type_nextcloudtalk": "Nextcloud Talk",
"channels.type_nostr": "Nostr",
"channels.type_notifery": "Notifery",
"channels.type_notifyapp": "NotifyApp",
"channels.type_ntfy": "ntfy", "channels.type_ntfy": "ntfy",
"channels.type_octopush": "Octopush",
"channels.type_onebot": "OneBot (QQ)",
"channels.type_onechat": "OneChat",
"channels.type_onesender": "OneSender (WhatsApp)",
"channels.type_ooredoo": "Ooredoo Maldives",
"channels.type_openwa": "OpenWA (WhatsApp)",
"channels.type_opsgenie": "Opsgenie", "channels.type_opsgenie": "Opsgenie",
"channels.type_opsimate": "OpsiMate",
"channels.type_pagerduty": "PagerDuty", "channels.type_pagerduty": "PagerDuty",
"channels.type_pagertree": "PagerTree",
"channels.type_pinglet": "Pinglet",
"channels.type_plivo": "Plivo",
"channels.type_promosms": "PromoSMS",
"channels.type_pumble": "Pumble",
"channels.type_pushbullet": "Pushbullet", "channels.type_pushbullet": "Pushbullet",
"channels.type_pushdeer": "PushDeer",
"channels.type_pushover": "Pushover", "channels.type_pushover": "Pushover",
"channels.type_pushplus": "PushPlus",
"channels.type_pushy": "Pushy",
"channels.type_resend": "Resend",
"channels.type_rocketchat": "Rocket.Chat", "channels.type_rocketchat": "Rocket.Chat",
"channels.type_sendgrid": "SendGrid",
"channels.type_serverchan": "ServerChan",
"channels.type_serwersms": "SerwerSMS.pl",
"channels.type_sevenio": "seven",
"channels.type_signal": "Signal", "channels.type_signal": "Signal",
"channels.type_signalgrid": "Signalgrid",
"channels.type_signl4": "SIGNL4",
"channels.type_slack": "Slack", "channels.type_slack": "Slack",
"channels.type_smsc": "SMSC",
"channels.type_smseagle": "SMSEagle",
"channels.type_smsgateway": "SMS Gateway for Android",
"channels.type_smsir": "sms.ir",
"channels.type_smsmanager": "SmsManager",
"channels.type_smspartner": "SMS Partner",
"channels.type_smsplanet": "SMSPlanet",
"channels.type_splunk": "Splunk On-Call (VictorOps)",
"channels.type_spugpush": "Spug Push",
"channels.type_squadcast": "Squadcast",
"channels.type_stackfield": "Stackfield",
"channels.type_teams": "Microsoft Teams", "channels.type_teams": "Microsoft Teams",
"channels.type_techulus": "Techulus Push",
"channels.type_telegram": "Telegram", "channels.type_telegram": "Telegram",
"channels.type_telnyx": "Telnyx",
"channels.type_teltonika": "Teltonika router",
"channels.type_threema": "Threema",
"channels.type_trigv": "Trigv",
"channels.type_turbosmtp": "turboSMTP",
"channels.type_twilio": "Twilio",
"channels.type_vk": "VK",
"channels.type_vkteams": "VK Teams",
"channels.type_waha": "WAHA (WhatsApp)",
"channels.type_webhook": "Webhook", "channels.type_webhook": "Webhook",
"channels.type_wecom": "WeCom (WeChat Work)",
"channels.type_whapi": "Whapi (WhatsApp)",
"channels.type_wpush": "WPush",
"channels.type_wxpusher": "WxPusher",
"channels.type_yunzhijia": "Yunzhijia",
"channels.type_zohocliq": "Zoho Cliq",
"channels.url": "Webhook URL", "channels.url": "Webhook URL",
"checkers.avg_latency": "Average latency", "checkers.avg_latency": "Average latency",
"checkers.for": "for {{.Duration}}", "checkers.for": "for {{.Duration}}",
@@ -0,0 +1,9 @@
-- +goose Up
-- Some services are named with digits, such as 46elks.
ALTER TABLE notification_channels DROP CONSTRAINT notification_channels_type_check;
ALTER TABLE notification_channels ADD CONSTRAINT notification_channels_type_check CHECK (type ~ '^[a-z0-9]{2,32}$');
-- +goose Down
DELETE FROM notification_channels WHERE type !~ '^[a-z]{2,32}$';
ALTER TABLE notification_channels DROP CONSTRAINT notification_channels_type_check;
ALTER TABLE notification_channels ADD CONSTRAINT notification_channels_type_check CHECK (type ~ '^[a-z]{2,32}$');
+357
View File
@@ -0,0 +1,357 @@
package notify
import (
"context"
"crypto/hmac"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"fmt"
"math/big"
"net/http"
"net/url"
"strconv"
"strings"
"time"
)
// Chat services and messengers, including WhatsApp gateways and home
// automation.
func text(name string, required bool) Field {
return Field{Name: name, Required: required, Kind: "text"}
}
func secret(name string, required bool) Field {
return Field{Name: name, Required: required, Secret: true, Kind: "text"}
}
func urlField(name string, required bool, def string) Field {
return Field{Name: name, Required: required, Kind: "url", Default: def}
}
// secretURL is a URL that carries a credential, such as a webhook.
func secretURL(name string) Field {
return Field{Name: name, Required: true, Secret: true, Kind: "url"}
}
var messageTypeField = Field{Name: "message_type", Kind: "select", Options: []string{"private", "group"}, Default: "private"}
var chatProviders = []Provider{
{Type: "bale", Group: "chat", Fields: []Field{secret("bot_token", true), text("chat_id", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, "https://tapi.bale.ai/bot"+cfg["bot_token"]+"/sendMessage", nil,
map[string]any{"chat_id": cfg["chat_id"], "text": m.text()})
}},
{Type: "bitrix", Group: "chat", Fields: []Field{secretURL("webhook_url"), text("user_id", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
color := "#b73419"
if m.Event == Resolved {
color = "#67b518"
}
_, err := c.get(ctx, trimURL(cfg["webhook_url"])+"/im.notify.system.add.json", nil, url.Values{
"user_id": {cfg["user_id"]}, "message": {"[B]" + m.Title + "[/B]"},
"ATTACH[COLOR]": {color}, "ATTACH[BLOCKS][0][MESSAGE]": {m.Body + "\n" + m.URL},
})
return err
}},
{Type: "clickup", Group: "chat", Fields: []Field{secret("api_token", true), text("workspace_id", true), text("channel_id", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
u := "https://api.clickup.com/api/v3/workspaces/" + url.PathEscape(cfg["workspace_id"]) +
"/chat/channels/" + url.PathEscape(cfg["channel_id"]) + "/messages"
return c.json(ctx, http.MethodPost, u, http.Header{"Authorization": {cfg["api_token"]}},
map[string]any{"type": "message", "content": "**" + m.Title + "**\n" + m.Body + "\n" + m.URL, "content_format": "text/md"})
}},
{Type: "dingtalk", Group: "chat", Fields: []Field{secretURL("webhook_url"), secret("sign_secret", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
u := cfg["webhook_url"]
if key := cfg["sign_secret"]; key != "" {
// Robots with "additional signature" security check the
// timestamp signed with the secret.
ts := strconv.FormatInt(time.Now().UnixMilli(), 10)
mac := hmac.New(sha256.New, []byte(key))
mac.Write([]byte(ts + "\n" + key))
u += "&timestamp=" + ts + "&sign=" + url.QueryEscape(base64.StdEncoding.EncodeToString(mac.Sum(nil)))
}
reply, err := c.callJSON(ctx, http.MethodPost, u, nil, map[string]any{"msgtype": "text", "text": map[string]any{"content": m.text()}})
return replyCheck(reply, err, func(v map[string]any) string {
if str(v["errcode"]) != "0" {
return "DingTalk: " + str(v["errmsg"])
}
return ""
})
}},
{Type: "feishu", Group: "chat", Fields: []Field{secretURL("webhook_url")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
reply, err := c.callJSON(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{"msg_type": "text", "content": map[string]any{"text": m.text()}})
return replyCheck(reply, err, func(v map[string]any) string {
if code := str(v["code"]); code != "" && code != "0" {
return "Feishu: " + str(v["msg"])
}
return ""
})
}},
{Type: "fluxer", Group: "chat", Fields: []Field{secretURL("webhook_url")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{"username": "UptimeSebi", "content": m.text()})
}},
{Type: "kook", Group: "chat", Fields: []Field{secret("bot_token", true), text("channel_id", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
reply, err := c.callJSON(ctx, http.MethodPost, "https://www.kookapp.cn/api/v3/message/create",
http.Header{"Authorization": {"Bot " + cfg["bot_token"]}}, map[string]any{"target_id": cfg["channel_id"], "content": m.text()})
return replyCheck(reply, err, func(v map[string]any) string {
if str(v["code"]) != "0" {
return "KOOK: " + str(v["message"])
}
return ""
})
}},
{Type: "line", Group: "chat", Fields: []Field{secret("access_token", true), text("user_id", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, "https://api.line.me/v2/bot/message/push", bearer(cfg["access_token"]),
map[string]any{"to": cfg["user_id"], "messages": []map[string]any{{"type": "text", "text": m.text()}}})
}},
{Type: "max", Group: "chat", Fields: []Field{secret("bot_token", true), text("chat_id", true), urlField("api_url", false, "https://platform-api.max.ru")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
u := trimURL(or(cfg["api_url"], "https://platform-api.max.ru")) + "/messages?chat_id=" + url.QueryEscape(cfg["chat_id"])
return c.json(ctx, http.MethodPost, u, http.Header{"Authorization": {cfg["bot_token"]}}, map[string]any{"text": m.text()})
}},
{Type: "milky", Group: "chat", Fields: []Field{urlField("api_url", true, ""), secret("access_token", false), messageTypeField, text("receiver_id", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// Milky, a QQ bot protocol.
id, _ := strconv.ParseInt(cfg["receiver_id"], 10, 64)
body := map[string]any{"message": []map[string]any{{"type": "text", "data": map[string]any{"text": m.text()}}}}
endpoint := "send_private_message"
if cfg["message_type"] == "group" {
endpoint, body["group_id"] = "send_group_message", id
} else {
body["user_id"] = id
}
return c.json(ctx, http.MethodPost, trimURL(cfg["api_url"])+"/api/"+endpoint, bearer(cfg["access_token"]), body)
}},
{Type: "onebot", Group: "chat", Fields: []Field{urlField("api_url", true, ""), secret("access_token", false), messageTypeField, text("receiver_id", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
body := map[string]any{"auto_escape": true, "message": m.text(), "message_type": "private", "user_id": cfg["receiver_id"]}
if cfg["message_type"] == "group" {
delete(body, "user_id")
body["message_type"], body["group_id"] = "group", cfg["receiver_id"]
}
return c.json(ctx, http.MethodPost, trimURL(cfg["api_url"])+"/send_msg", bearer(cfg["access_token"]), body)
}},
{Type: "onechat", Group: "chat", Fields: []Field{secret("access_token", true), text("receiver_id", true), text("bot_id", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, "https://chat-api.one.th/message/api/v1/push_message", bearer(cfg["access_token"]),
map[string]any{"to": cfg["receiver_id"], "bot_id": cfg["bot_id"], "type": "text", "message": m.text()})
}},
{Type: "nextcloudtalk", Group: "chat", Fields: []Field{urlField("server_url", true, ""), text("conversation_token", true), secret("bot_secret", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// Talk bots sign a random value followed by the message.
random := randomHex(32)
msg := m.text()
mac := hmac.New(sha256.New, []byte(cfg["bot_secret"]))
mac.Write([]byte(random + msg))
h := http.Header{
"X-Nextcloud-Talk-Bot-Random": {random},
"X-Nextcloud-Talk-Bot-Signature": {hex.EncodeToString(mac.Sum(nil))},
"OCS-APIRequest": {"true"},
}
u := trimURL(cfg["server_url"]) + "/ocs/v2.php/apps/spreed/api/v1/bot/" + url.PathEscape(cfg["conversation_token"]) + "/message"
return c.json(ctx, http.MethodPost, u, h, map[string]any{"message": msg})
}},
{Type: "pumble", Group: "chat", Fields: []Field{secretURL("webhook_url")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
color := map[string]string{"down": "#DC3645", "up": "#5BDD8B"}[m.status()]
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{
"attachments": []map[string]any{{"title": m.Title, "text": m.Body + "\n" + m.URL, "color": or(color, "#5BDD8B")}},
})
}},
{Type: "stackfield", Group: "chat", Fields: []Field{secretURL("webhook_url")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{"Title": m.text()})
}},
{Type: "vk", Group: "chat", Fields: []Field{secret("access_token", true), text("peer_id", true), text("api_version", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
id, _ := rand.Int(rand.Reader, big.NewInt(1<<31-1))
reply, err := c.form(ctx, "https://api.vk.ru/method/messages.send", nil, url.Values{
"access_token": {cfg["access_token"]}, "v": {or(cfg["api_version"], "5.199")}, "peer_id": {cfg["peer_id"]},
"message": {m.text()}, "random_id": {id.String()},
})
return replyCheck(reply, err, func(v map[string]any) string {
if e, ok := v["error"].(map[string]any); ok {
return fmt.Sprintf("VK: %s (%s)", str(e["error_msg"]), str(e["error_code"]))
}
return ""
})
}},
{Type: "vkteams", Group: "chat", Fields: []Field{secret("bot_token", true), text("chat_id", true), urlField("api_url", false, "https://myteam.mail.ru")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
reply, err := c.get(ctx, trimURL(or(cfg["api_url"], "https://myteam.mail.ru"))+"/bot/v1/messages/sendText", nil,
url.Values{"token": {cfg["bot_token"]}, "chatId": {cfg["chat_id"]}, "text": {m.text()}})
return replyCheck(reply, err, func(v map[string]any) string {
if v["ok"] == false {
return "VK Teams: " + str(v["description"])
}
return ""
})
}},
{Type: "wecom", Group: "chat", Fields: []Field{secret("bot_key", true), text("mentioned_mobiles", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
t := map[string]any{"content": m.text()}
if mobiles := list(cfg["mentioned_mobiles"]); len(mobiles) > 0 {
t["mentioned_mobile_list"] = mobiles
}
reply, err := c.callJSON(ctx, http.MethodPost, "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key="+url.QueryEscape(cfg["bot_key"]), nil,
map[string]any{"msgtype": "text", "text": t})
return replyCheck(reply, err, func(v map[string]any) string {
if str(v["errcode"]) != "0" {
return "WeCom: " + str(v["errmsg"])
}
return ""
})
}},
{Type: "yunzhijia", Group: "chat", Fields: []Field{urlField("webhook_url", true, ""), secret("token", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
u := cfg["webhook_url"] + "?yzjtype=0&yzjtoken=" + url.QueryEscape(cfg["token"])
reply, err := c.callJSON(ctx, http.MethodPost, u, nil, map[string]any{"content": m.text()})
return replyCheck(reply, err, func(v map[string]any) string {
if v["success"] != true {
return "Yunzhijia: " + str(v["errmsg"])
}
return ""
})
}},
{Type: "zohocliq", Group: "chat", Fields: []Field{secretURL("webhook_url")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{"text": m.text()})
}},
{Type: "threema", Group: "chat", Fields: []Field{
text("gateway_id", true), secret("gateway_secret", true),
{Name: "recipient_type", Kind: "select", Options: []string{"identity", "phone", "email"}, Default: "identity"},
text("recipient", true),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
v := url.Values{"from": {cfg["gateway_id"]}, "secret": {cfg["gateway_secret"]}, "text": {m.text()}}
switch cfg["recipient_type"] {
case "phone":
v.Set("phone", cfg["recipient"])
case "email":
v.Set("email", cfg["recipient"])
default:
v.Set("to", cfg["recipient"])
}
_, err := c.form(ctx, "https://msgapi.threema.ch/send_simple", nil, v)
return err
}},
{Type: "evolution", Group: "chat", Fields: []Field{
urlField("api_url", true, ""), secret("api_key", true), text("instance", true), text("recipient", true),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// Evolution API, a WhatsApp gateway.
u := trimURL(cfg["api_url"]) + "/message/sendText/" + url.PathEscape(cfg["instance"])
return c.json(ctx, http.MethodPost, u, http.Header{"apikey": {cfg["api_key"]}}, map[string]any{"number": cfg["recipient"], "text": m.text()})
}},
{Type: "waha", Group: "chat", Fields: []Field{
urlField("api_url", true, ""), secret("api_key", false), text("session", true), text("chat_id", true),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, trimURL(cfg["api_url"])+"/api/sendText", http.Header{"X-Api-Key": {cfg["api_key"]}},
map[string]any{"session": cfg["session"], "chatId": cfg["chat_id"], "text": m.text()})
}},
{Type: "whapi", Group: "chat", Fields: []Field{secret("api_token", true), text("recipient", true), urlField("api_url", false, "https://gate.whapi.cloud")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, trimURL(or(cfg["api_url"], "https://gate.whapi.cloud"))+"/messages/text", bearer(cfg["api_token"]),
map[string]any{"to": cfg["recipient"], "body": m.text()})
}},
{Type: "openwa", Group: "chat", Fields: []Field{
urlField("api_url", true, ""), secret("api_key", true), text("session", true), text("chat_ids", true),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
u := trimURL(cfg["api_url"]) + "/api/sessions/" + url.PathEscape(cfg["session"]) + "/messages/send-text"
for _, id := range list(cfg["chat_ids"]) {
if err := c.json(ctx, http.MethodPost, u, http.Header{"X-Api-Key": {cfg["api_key"]}}, map[string]any{"chatId": id, "text": m.text()}); err != nil {
return err
}
}
return nil
}},
{Type: "onesender", Group: "chat", Fields: []Field{
urlField("api_url", true, ""), secret("api_token", true), messageTypeField, text("recipient", true),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
to, kind := cfg["recipient"]+"@s.whatsapp.net", "individual"
if cfg["message_type"] == "group" {
to, kind = cfg["recipient"]+"@g.us", "group"
}
return c.json(ctx, http.MethodPost, cfg["api_url"], bearer(cfg["api_token"]), map[string]any{
"to": to, "type": "text", "recipient_type": kind, "text": map[string]any{"body": m.text()},
})
}},
{Type: "messenger360", Group: "chat", Fields: []Field{secret("api_token", true), text("recipients", false), text("group_ids", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// 360messenger, a WhatsApp gateway.
recipients, groups := list(cfg["recipients"]), list(cfg["group_ids"])
if len(recipients)+len(groups) == 0 {
return fmt.Errorf("no recipient or group set")
}
h := bearer(cfg["api_token"])
for _, r := range recipients {
if err := c.json(ctx, http.MethodPost, "https://api.360messenger.com/v2/sendMessage", h, map[string]any{"phonenumber": r, "text": m.text()}); err != nil {
return err
}
}
for _, g := range groups {
if err := c.json(ctx, http.MethodPost, "https://api.360messenger.com/v2/sendGroup", h, map[string]any{"groupId": g, "text": m.text()}); err != nil {
return err
}
}
return nil
}},
{Type: "nostr", Group: "chat", Fields: []Field{secret("sender_nsec", true), text("recipients", true), text("relays", true)}, send: sendNostr},
{Type: "homeassistant", Group: "chat", Fields: []Field{urlField("server_url", true, ""), secret("access_token", true), text("service", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// A notify service such as mobile_app_phone; "notify" reaches
// the default ones.
u := trimURL(cfg["server_url"]) + "/api/services/notify/" + url.PathEscape(or(cfg["service"], "notify"))
body := map[string]any{"title": m.Title, "message": m.Body + "\n" + m.URL}
if cfg["service"] != "persistent_notification" {
body["data"] = map[string]any{"name": m.Monitor, "status": m.status(), "url": m.URL}
}
return c.json(ctx, http.MethodPost, u, bearer(cfg["access_token"]), body)
}},
{Type: "indigo", Group: "chat", Fields: []Field{urlField("server_url", true, ""), secret("api_key", true), text("variable_id", false), text("action_group_id", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// Indigo home automation: set a variable to the message and run
// an action group.
variable, _ := strconv.Atoi(cfg["variable_id"])
group, _ := strconv.Atoi(cfg["action_group_id"])
if variable == 0 && group == 0 {
return fmt.Errorf("set a variable ID, an action group ID or both")
}
u := trimURL(cfg["server_url"]) + "/v2/api/command"
h := bearer(cfg["api_key"])
if variable != 0 {
if err := c.json(ctx, http.MethodPost, u, h, map[string]any{"id": "uptimesebi", "message": "indigo.variable.updateValue",
"objectId": variable, "parameters": map[string]any{"value": m.text()}}); err != nil {
return err
}
}
if group != 0 {
return c.json(ctx, http.MethodPost, u, h, map[string]any{"id": "uptimesebi", "message": "indigo.actionGroup.execute", "objectId": group})
}
return nil
}},
{Type: "googlesheets", Group: "chat", Fields: []Field{secretURL("webhook_url")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// A Google Apps Script web app appending rows.
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{
"timestamp": time.Now().UTC().Format(time.RFC3339), "status": strings.ToUpper(m.status()),
"monitorName": or(m.Monitor, "N/A"), "monitorUrl": or(m.Target, "N/A"), "message": m.Title + "\n" + m.Body,
})
}},
{Type: "callmebot", Group: "chat", Fields: []Field{secretURL("endpoint_url")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// The URL CallMeBot hands out, with phone and API key.
_, err := c.get(ctx, cfg["endpoint_url"], nil, url.Values{"text": {m.text()}})
return err
}},
}
func randomHex(n int) string {
b := make([]byte, n)
_, _ = rand.Read(b)
return hex.EncodeToString(b)
}
+131
View File
@@ -0,0 +1,131 @@
package notify
import (
"context"
"encoding/json"
"errors"
"net/http"
"net/url"
"strings"
)
// Email delivery services reached over their APIs instead of SMTP.
func emailFields(extra ...Field) []Field {
return append(extra,
text("from_email", true), text("from_name", false), text("to_email", true),
text("cc_email", false), text("bcc_email", false), text("subject", false),
)
}
func subject(cfg map[string]string, m Message) string { return or(cfg["subject"], m.Title) }
func addresses(s string, as func(string) any) []any {
var out []any
for _, a := range list(s) {
out = append(out, as(a))
}
return out
}
func emailObj(a string) any { return map[string]string{"email": a} }
var emailProviders = []Provider{
{Type: "brevo", Group: "email", Fields: emailFields(secret("api_key", true)),
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
body := map[string]any{
"sender": map[string]any{"email": cfg["from_email"], "name": or(cfg["from_name"], "UptimeSebi")},
"to": addresses(cfg["to_email"], emailObj),
"subject": subject(cfg, m),
"textContent": m.text(),
}
if cc := addresses(cfg["cc_email"], emailObj); cc != nil {
body["cc"] = cc
}
if bcc := addresses(cfg["bcc_email"], emailObj); bcc != nil {
body["bcc"] = bcc
}
return c.json(ctx, http.MethodPost, "https://api.brevo.com/v3/smtp/email", http.Header{"api-key": {cfg["api_key"]}}, body)
}},
{Type: "resend", Group: "email", Fields: emailFields(secret("api_key", true)),
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
body := map[string]any{
"from": or(cfg["from_name"], "UptimeSebi") + " <" + cfg["from_email"] + ">", "to": list(cfg["to_email"]),
"subject": subject(cfg, m), "text": m.text(),
}
if cc := list(cfg["cc_email"]); cc != nil {
body["cc"] = cc
}
if bcc := list(cfg["bcc_email"]); bcc != nil {
body["bcc"] = bcc
}
return c.json(ctx, http.MethodPost, "https://api.resend.com/emails", bearer(cfg["api_key"]), body)
}},
{Type: "sendgrid", Group: "email", Fields: emailFields(secret("api_key", true)),
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
p := map[string]any{"to": addresses(cfg["to_email"], emailObj)}
if cc := addresses(cfg["cc_email"], emailObj); cc != nil {
p["cc"] = cc
}
if bcc := addresses(cfg["bcc_email"], emailObj); bcc != nil {
p["bcc"] = bcc
}
return c.json(ctx, http.MethodPost, "https://api.sendgrid.com/v3/mail/send", bearer(cfg["api_key"]), map[string]any{
"personalizations": []any{p},
"from": map[string]any{"email": cfg["from_email"], "name": or(cfg["from_name"], "UptimeSebi")},
"subject": subject(cfg, m),
"content": []map[string]any{{"type": "text/plain", "value": m.text()}},
})
}},
{Type: "turbosmtp", Group: "email", Fields: emailFields(
text("consumer_key", true), secret("consumer_secret", true),
Field{Name: "region", Kind: "select", Options: []string{"us", "eu"}, Default: "us"},
), send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
host := "api.turbo-smtp.com"
if cfg["region"] == "eu" {
host = "api.eu.turbo-smtp.com"
}
body := map[string]any{
"from": cfg["from_email"], "to": strings.Join(list(cfg["to_email"]), ","), "subject": subject(cfg, m), "content": m.text(),
}
if cc := list(cfg["cc_email"]); cc != nil {
body["cc"] = strings.Join(cc, ",")
}
if bcc := list(cfg["bcc_email"]); bcc != nil {
body["bcc"] = strings.Join(bcc, ",")
}
h := http.Header{"consumerKey": {cfg["consumer_key"]}, "consumerSecret": {cfg["consumer_secret"]}}
return c.json(ctx, http.MethodPost, "https://"+host+"/api/v2/mail/send", h, body)
}},
{Type: "microsoftgraph", Group: "email", Fields: []Field{
text("tenant_id", true), text("client_id", true), secret("client_secret", true), text("mailbox", true),
text("to_email", true), text("cc_email", false), text("bcc_email", false), text("subject", false),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// An app registration with the Mail.Send application permission
// sends as the mailbox.
reply, err := c.form(ctx, "https://login.microsoftonline.com/"+url.PathEscape(cfg["tenant_id"])+"/oauth2/v2.0/token", nil, url.Values{
"client_id": {cfg["client_id"]}, "client_secret": {cfg["client_secret"]},
"scope": {"https://graph.microsoft.com/.default"}, "grant_type": {"client_credentials"},
})
if err != nil {
return err
}
var tok struct {
AccessToken string `json:"access_token"`
}
if json.Unmarshal(reply, &tok) != nil || tok.AccessToken == "" {
return errors.New("Microsoft Entra issued no access token")
}
recipients := func(s string) []any {
return addresses(s, func(a string) any { return map[string]any{"emailAddress": map[string]string{"address": a}} })
}
return c.json(ctx, http.MethodPost, "https://graph.microsoft.com/v1.0/users/"+url.PathEscape(cfg["mailbox"])+"/sendMail", bearer(tok.AccessToken),
map[string]any{
"message": map[string]any{
"subject": subject(cfg, m), "body": map[string]any{"contentType": "Text", "content": m.text()},
"toRecipients": recipients(cfg["to_email"]), "ccRecipients": recipients(cfg["cc_email"]), "bccRecipients": recipients(cfg["bcc_email"]),
},
"saveToSentItems": false,
})
}},
}
+228
View File
@@ -0,0 +1,228 @@
package notify
import (
"context"
"encoding/json"
"errors"
"net/http"
"net/url"
"strings"
"time"
)
// Incident management and operations tools. Where a service pairs alerts
// with their resolution, the incident ID is the key.
// kumaPayload is the body Uptime Kuma sends, which some services accept
// as a format of their own ("uptimekuma" integrations).
func kumaPayload(m Message) map[string]any {
p := map[string]any{"msg": m.Title + "\n" + m.Body}
if m.Event != Test {
status := 0
if m.Event == Resolved {
status = 1
}
p["heartbeat"] = map[string]any{
"status": status, "msg": m.Body, "time": time.Now().UTC().Format(time.DateTime),
"monitorID": m.MonitorID.String(), "incidentID": m.Key.String(),
}
p["monitor"] = map[string]any{"id": m.MonitorID.String(), "name": m.Monitor, "url": m.Target, "consoleUrl": m.URL}
}
return p
}
var severityField = func(options []string, def string) Field {
return Field{Name: "severity", Kind: "select", Options: options, Default: def}
}
var incidentProviders = []Provider{
{Type: "alerta", Group: "incident", Fields: []Field{
urlField("api_url", true, ""), secret("api_key", true), text("environment", true),
severityField([]string{"critical", "major", "minor", "warning"}, "critical"),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
severity := cfg["severity"]
if m.Event == Resolved {
severity = "normal"
}
return c.json(ctx, http.MethodPost, cfg["api_url"], http.Header{"Authorization": {"Key " + cfg["api_key"]}}, map[string]any{
"environment": cfg["environment"], "severity": or(severity, "critical"), "correlate": []string{"service_up", "service_down"},
"service": []string{"UptimeSebi"}, "resource": or(m.Monitor, "UptimeSebi"), "event": "service_" + m.status(),
"group": "uptimesebi", "value": m.status(), "text": m.Title + "\n" + m.Body, "origin": "uptimesebi",
"tags": []string{"uptimesebi"}, "type": "uptimesebiAlert", "attributes": map[string]any{"url": m.URL},
})
}},
{Type: "alertnow", Group: "incident", Fields: []Field{secretURL("webhook_url")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
status, typ := "open", "ERROR"
if m.Event == Resolved {
status, typ = "close", "INFO"
}
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{
"summary": m.Title + " - " + m.Body + " >> " + m.URL, "status": status, "event_type": typ, "event_id": m.Key.String(),
})
}},
{Type: "flashduty", Group: "incident", Fields: []Field{secret("integration_key", true), severityField([]string{"Critical", "Warning", "Info"}, "Critical")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
u := cfg["integration_key"]
if !strings.HasPrefix(u, "http") {
u = "https://api.flashcat.cloud/event/push/alert/standard?integration_key=" + url.QueryEscape(u)
}
status := "Info"
switch m.Event {
case Opened:
status = or(cfg["severity"], "Critical")
case Resolved:
status = "Ok"
}
return c.json(ctx, http.MethodPost, u, nil, map[string]any{
"title": m.Title, "description": m.Body, "event_status": status, "alert_key": m.Key.String(),
"labels": map[string]string{"resource": m.Target, "check": m.Monitor},
})
}},
{Type: "goalert", Group: "incident", Fields: []Field{urlField("server_url", true, ""), secret("token", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
v := url.Values{"summary": {truncate(m.Title, 250)}, "details": {m.Body + "\n" + m.URL}, "dedup": {m.Key.String()}}
if m.Event == Resolved {
v.Set("action", "close")
}
_, err := c.form(ctx, trimURL(cfg["server_url"])+"/api/v2/generic/incoming?token="+url.QueryEscape(cfg["token"]), nil, v)
return err
}},
{Type: "grafanaoncall", Group: "incident", Fields: []Field{secretURL("webhook_url")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
state := "alerting"
if m.Event == Resolved {
state = "ok"
}
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{
"title": m.Title, "message": m.Body, "state": state, "alert_uid": m.Key.String(), "link_to_upstream_details": m.URL,
})
}},
{Type: "heiioncall", Group: "incident", Fields: []Field{secret("api_key", true), text("trigger_id", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
action := "alert"
if m.Event == Resolved {
action = "resolve"
}
return c.json(ctx, http.MethodPost, "https://heiioncall.com/triggers/"+url.PathEscape(cfg["trigger_id"])+"/"+action, bearer(cfg["api_key"]),
map[string]any{"msg": m.Title + "\n" + m.Body, "url": m.URL, "name": m.Monitor})
}},
{Type: "jsm", Group: "incident", Fields: []Field{
text("cloud_id", true), text("email", true), secret("api_token", true),
{Name: "priority", Kind: "select", Options: []string{"P1", "P2", "P3", "P4", "P5"}, Default: "P3"},
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// Jira Service Management Operations (formerly Opsgenie).
base := "https://api.atlassian.com/jsm/ops/api/" + url.PathEscape(cfg["cloud_id"]) + "/v1/alerts"
h := basic(cfg["email"], cfg["api_token"])
alias := m.Key.String()
if m.Event == Resolved {
reply, err := c.get(ctx, base+"/alias", h, url.Values{"alias": {alias}})
if err != nil {
return err
}
var alert struct {
ID string `json:"id"`
}
if json.Unmarshal(reply, &alert) != nil || alert.ID == "" {
return errors.New("Jira Service Management: alert to close not found")
}
return c.json(ctx, http.MethodPost, base+"/"+url.PathEscape(alert.ID)+"/close", h, map[string]any{"source": "UptimeSebi"})
}
return c.json(ctx, http.MethodPost, base, h, map[string]any{
"message": truncate(m.Title, 130), "alias": alias, "description": m.Body + "\n" + m.URL,
"source": "UptimeSebi", "priority": or(cfg["priority"], "P3"), "tags": []string{"UptimeSebi"},
})
}},
{Type: "pagertree", Group: "incident", Fields: []Field{
secretURL("integration_url"),
{Name: "urgency", Kind: "select", Options: []string{"high", "critical", "medium", "low", "silent"}, Default: "high"},
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
event := "create"
if m.Event == Resolved {
event = "resolve"
}
return c.json(ctx, http.MethodPost, cfg["integration_url"], nil, map[string]any{
"event_type": event, "id": m.Key.String(), "title": m.Title, "description": m.Body + "\n" + m.URL, "urgency": or(cfg["urgency"], "high"),
})
}},
{Type: "signl4", Group: "incident", Fields: []Field{secretURL("webhook_url")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
p := kumaPayload(m)
p["title"], p["message"], p["X-S4-SourceSystem"], p["monitorUrl"] = m.Title, m.Body, "UptimeSebi", m.URL
if m.Event != Test {
p["X-S4-ExternalID"] = "UptimeSebi-" + m.Key.String()
p["X-S4-Status"] = map[string]string{"down": "new", "up": "resolved"}[m.status()]
}
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, p)
}},
{Type: "splunk", Group: "incident", Fields: []Field{secretURL("rest_url"), severityField([]string{"CRITICAL", "WARNING", "INFO"}, "CRITICAL")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// Splunk On-Call (VictorOps) REST endpoint, including the
// routing key.
typ := or(cfg["severity"], "CRITICAL")
switch m.Event {
case Resolved:
typ = "RECOVERY"
case Test:
typ = "INFO"
}
return c.json(ctx, http.MethodPost, cfg["rest_url"], nil, map[string]any{
"message_type": typ, "entity_id": "UptimeSebi/" + m.Key.String(), "entity_display_name": m.Title,
"state_message": m.Body + "\n" + m.URL, "monitoring_tool": "UptimeSebi",
})
}},
{Type: "squadcast", Group: "incident", Fields: []Field{secretURL("webhook_url")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
body := map[string]any{"message": m.Title, "description": m.Body + "\n" + m.URL, "source": "uptimesebi", "tags": map[string]any{"AlertAddress": m.Target}}
if m.Event != Test {
body["event_id"] = m.Key.String()
body["status"] = map[string]string{"down": "trigger", "up": "resolve"}[m.status()]
}
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, body)
}},
{Type: "trigv", Group: "incident", Fields: []Field{secret("api_key", true), text("channel", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
level := map[string]string{"down": "error", "up": "success"}[m.status()]
body := map[string]any{"channel": or(cfg["channel"], "general"), "title": truncate(m.Title, 255),
"description": truncate(m.Body, 1000), "level": or(level, "info")}
if m.URL != "" {
body["url"] = m.URL
}
return c.json(ctx, http.MethodPost, "https://api.trigv.com/v1/events", bearer(cfg["api_key"]), body)
}},
{Type: "halopsa", Group: "incident", Fields: []Field{secretURL("webhook_url"), text("username", false), secret("password", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
var h http.Header
if cfg["username"] != "" {
h = basic(cfg["username"], cfg["password"])
}
status := map[string]string{"down": "DOWN", "up": "UP"}[m.status()]
return c.json(ctx, http.MethodPost, cfg["webhook_url"], h, map[string]any{
"title": m.Title, "status": or(status, "NOTIFICATION"), "monitor": or(m.Monitor, "No Monitor"), "monitor_id": m.MonitorID.String(),
"message": m.Body + "\n" + m.URL, "timestamp": time.Now().UTC().Format(time.RFC3339),
})
}},
{Type: "flowtriq", Group: "incident", Fields: []Field{secretURL("webhook_url"), secret("api_key", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
var h http.Header
if cfg["api_key"] != "" {
h = http.Header{"X-API-Key": {cfg["api_key"]}}
}
status := map[string]string{"down": "down", "up": "up"}[m.status()]
return c.json(ctx, http.MethodPost, cfg["webhook_url"], h, map[string]any{
"source": "uptimesebi", "status": or(status, "info"), "monitor": or(m.Monitor, "Unknown"), "msg": m.Title + "\n" + m.Body,
})
}},
{Type: "keep", Group: "incident", Fields: []Field{urlField("server_url", true, ""), secret("api_key", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, trimURL(cfg["server_url"])+"/alerts/event/uptimekuma", http.Header{"x-api-key": {cfg["api_key"]}}, kumaPayload(m))
}},
{Type: "opsimate", Group: "incident", Fields: []Field{urlField("server_url", true, ""), secret("api_token", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, trimURL(cfg["server_url"])+"/api/v1/alerts/custom/uptimekuma", http.Header{"x-api-token": {cfg["api_token"]}}, kumaPayload(m))
}},
{Type: "pinglet", Group: "incident", Fields: []Field{urlField("publish_url", true, ""), secret("api_key", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, trimURL(cfg["publish_url"])+"?rewrite=uptimekuma", bearer(cfg["api_key"]), kumaPayload(m))
}},
}
+130
View File
@@ -0,0 +1,130 @@
package notify
import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
"time"
"github.com/coder/websocket"
"github.com/nbd-wtf/go-nostr"
"github.com/nbd-wtf/go-nostr/nip19"
"github.com/nbd-wtf/go-nostr/nip44"
"github.com/nbd-wtf/go-nostr/nip59"
)
// Nostr private messages (NIP-17): the message is sealed for each
// recipient and gift-wrapped (NIP-59). Relays are reached over our own
// WebSocket connections, so the network guard applies to them.
func sendNostr(ctx context.Context, c *client, cfg map[string]string, m Message) error {
sk, err := nostrKey(cfg["sender_nsec"], "nsec")
if err != nil {
return err
}
pub, err := nostr.GetPublicKey(sk)
if err != nil {
return err
}
var events []nostr.Event
for _, r := range list(cfg["recipients"]) {
to, err := nostrKey(r, "npub")
if err != nil {
return err
}
rumor := nostr.Event{Kind: nostr.KindDirectMessage, Content: m.text(), Tags: nostr.Tags{{"p", to}}, CreatedAt: nostr.Now(), PubKey: pub}
rumor.ID = rumor.GetID()
wrap, err := nip59.GiftWrap(rumor, to,
func(plain string) (string, error) {
key, err := nip44.GenerateConversationKey(to, sk)
if err != nil {
return "", err
}
return nip44.Encrypt(plain, key)
},
func(e *nostr.Event) error { return e.Sign(sk) }, nil)
if err != nil {
return err
}
events = append(events, wrap)
}
if len(events) == 0 {
return errors.New("no recipient set")
}
var errs []error
delivered := 0
for _, relay := range list(cfg["relays"]) {
if err := c.publishNostr(ctx, relay, events); err != nil {
errs = append(errs, fmt.Errorf("%s: %w", relayHost(relay), err))
continue
}
delivered++
}
if delivered == 0 {
return errors.Join(append([]error{errors.New("no relay accepted the message")}, errs...)...)
}
return nil
}
// nostrKey decodes a bech32 key with prefix want to hex.
func nostrKey(s, want string) (string, error) {
prefix, v, err := nip19.Decode(strings.TrimSpace(s))
if err != nil || prefix != want {
return "", fmt.Errorf("not an %s key", want)
}
return v.(string), nil
}
func relayHost(relay string) string {
h := strings.TrimPrefix(strings.TrimPrefix(relay, "wss://"), "ws://")
return strings.SplitN(h, "/", 2)[0]
}
// publishNostr sends events to a relay and waits for it to accept each.
func (c *client) publishNostr(ctx context.Context, relay string, events []nostr.Event) error {
if !strings.HasPrefix(relay, "wss://") && !strings.HasPrefix(relay, "ws://") {
return errors.New("relays are wss:// URLs")
}
ctx, cancel := context.WithTimeout(ctx, 8*time.Second)
defer cancel()
conn, _, err := websocket.Dial(ctx, relay, &websocket.DialOptions{HTTPClient: c.hc})
if err != nil {
return err
}
defer func() { _ = conn.CloseNow() }()
for _, e := range events {
msg, _ := json.Marshal([]any{"EVENT", e})
if err := conn.Write(ctx, websocket.MessageText, msg); err != nil {
return err
}
for {
_, data, err := conn.Read(ctx)
if err != nil {
return err
}
var reply []json.RawMessage
if json.Unmarshal(data, &reply) != nil || len(reply) < 3 {
continue
}
var kind, id string
var ok bool
_ = json.Unmarshal(reply[0], &kind)
_ = json.Unmarshal(reply[1], &id)
_ = json.Unmarshal(reply[2], &ok)
if kind != "OK" || id != e.ID {
continue
}
if !ok {
var reason string
if len(reply) > 3 {
_ = json.Unmarshal(reply[3], &reason)
}
return errors.New("rejected: " + truncate(reason, 200))
}
break
}
}
return conn.Close(websocket.StatusNormalClosure, "")
}
+150 -29
View File
@@ -3,12 +3,15 @@ package notify
import ( import (
"bytes" "bytes"
"context" "context"
"encoding/base64"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"io" "io"
"net"
"net/http" "net/http"
"net/url" "net/url"
"slices"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@@ -29,6 +32,22 @@ type Message struct {
// Key identifies the incident across its events, for services that // Key identifies the incident across its events, for services that
// pair "opened" with "resolved" such as PagerDuty. // pair "opened" with "resolved" such as PagerDuty.
Key uuid.UUID Key uuid.UUID
// Monitor, MonitorID and Target describe the monitor, for services
// with fields of their own for them.
Monitor string
MonitorID uuid.UUID
Target string
}
// status is "down", "up" or "test".
func (m Message) status() string {
switch m.Event {
case Opened:
return "down"
case Resolved:
return "up"
}
return "test"
} }
// Field is a setting of a provider. Secret fields are stored sealed and // Field is a setting of a provider. Secret fields are stored sealed and
@@ -45,7 +64,10 @@ type Field struct {
// Provider delivers messages to one kind of service. // Provider delivers messages to one kind of service.
type Provider struct { type Provider struct {
Type string Type string
// Group sorts the service in forms: "chat", "push", "sms", "email" or
// "incident".
Group string
Fields []Field Fields []Field
send func(ctx context.Context, c *client, cfg map[string]string, m Message) error send func(ctx context.Context, c *client, cfg map[string]string, m Message) error
} }
@@ -68,12 +90,20 @@ func Lookup(t string) (Provider, bool) {
return Provider{}, false return Provider{}, false
} }
type client struct{ hc *http.Client } type client struct {
hc *http.Client
d *net.Dialer
}
// transport is replaced in tests to reach fixed service addresses.
var transport = func(d *net.Dialer) http.RoundTripper {
return &http.Transport{DialContext: d.DialContext, DisableKeepAlives: true}
}
func newClient(allowPrivate bool) *client { func newClient(allowPrivate bool) *client {
d := netguard.Dialer(allowPrivate, 5*time.Second) d := netguard.Dialer(allowPrivate, 5*time.Second)
return &client{hc: &http.Client{ return &client{d: d, hc: &http.Client{
Transport: &http.Transport{DialContext: d.DialContext, DisableKeepAlives: true}, Transport: transport(d),
// Redirects would bypass the address the customer configured. // Redirects would bypass the address the customer configured.
CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }, CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse },
}} }}
@@ -82,9 +112,16 @@ func newClient(allowPrivate bool) *client {
// do sends a request and turns non-2xx answers into errors that quote the // do sends a request and turns non-2xx answers into errors that quote the
// start of the service's reply, which usually says what is wrong. // start of the service's reply, which usually says what is wrong.
func (c *client) do(ctx context.Context, method, rawURL string, header http.Header, body io.Reader) error { func (c *client) do(ctx context.Context, method, rawURL string, header http.Header, body io.Reader) error {
_, err := c.call(ctx, method, rawURL, header, body)
return err
}
// call is do returning the reply, for services that report failures in
// successful answers.
func (c *client) call(ctx context.Context, method, rawURL string, header http.Header, body io.Reader) ([]byte, error) {
req, err := http.NewRequestWithContext(ctx, method, rawURL, body) req, err := http.NewRequestWithContext(ctx, method, rawURL, body)
if err != nil { if err != nil {
return err return nil, err
} }
for k, vs := range header { for k, vs := range header {
req.Header[k] = vs req.Header[k] = vs
@@ -95,29 +132,111 @@ func (c *client) do(ctx context.Context, method, rawURL string, header http.Head
if errors.As(err, &uerr) { if errors.As(err, &uerr) {
// The URL may carry a secret, as Telegram's bot token in the path: // The URL may carry a secret, as Telegram's bot token in the path:
// name only the host. // name only the host.
return fmt.Errorf("%s: %w", req.URL.Host, uerr.Err) return nil, fmt.Errorf("%s: %w", req.URL.Host, uerr.Err)
} }
if err != nil { if err != nil {
return err return nil, err
} }
defer func() { _ = resp.Body.Close() }() defer func() { _ = resp.Body.Close() }()
reply, _ := io.ReadAll(io.LimitReader(resp.Body, 512)) reply, _ := io.ReadAll(io.LimitReader(resp.Body, 64<<10))
if resp.StatusCode < 200 || resp.StatusCode > 299 { if resp.StatusCode < 200 || resp.StatusCode > 299 {
return fmt.Errorf("%s answered %d: %s", req.URL.Host, resp.StatusCode, strings.TrimSpace(string(reply))) return nil, fmt.Errorf("%s answered %d: %s", req.URL.Host, resp.StatusCode, truncate(strings.TrimSpace(string(reply)), 300))
} }
return nil return reply, nil
} }
func (c *client) json(ctx context.Context, method, rawURL string, header http.Header, v any) error { func (c *client) json(ctx context.Context, method, rawURL string, header http.Header, v any) error {
_, err := c.callJSON(ctx, method, rawURL, header, v)
return err
}
func (c *client) callJSON(ctx context.Context, method, rawURL string, header http.Header, v any) ([]byte, error) {
body, err := json.Marshal(v) body, err := json.Marshal(v)
if err != nil { if err != nil {
return err return nil, err
} }
if header == nil { if header == nil {
header = http.Header{} header = http.Header{}
} }
header.Set("Content-Type", "application/json") header.Set("Content-Type", "application/json")
return c.do(ctx, method, rawURL, header, bytes.NewReader(body)) return c.call(ctx, method, rawURL, header, bytes.NewReader(body))
}
// form posts URL-encoded values and returns the reply.
func (c *client) form(ctx context.Context, rawURL string, header http.Header, v url.Values) ([]byte, error) {
if header == nil {
header = http.Header{}
}
header.Set("Content-Type", "application/x-www-form-urlencoded")
return c.call(ctx, http.MethodPost, rawURL, header, strings.NewReader(v.Encode()))
}
// get sends a GET with query parameters and returns the reply.
func (c *client) get(ctx context.Context, rawURL string, header http.Header, q url.Values) ([]byte, error) {
if len(q) > 0 {
sep := "?"
if strings.Contains(rawURL, "?") {
sep = "&"
}
rawURL += sep + q.Encode()
}
return c.call(ctx, http.MethodGet, rawURL, header, nil)
}
// basic returns an Authorization header with HTTP basic credentials.
func basic(user, password string) http.Header {
return http.Header{"Authorization": {"Basic " + base64.StdEncoding.EncodeToString([]byte(user+":"+password))}}
}
func bearer(token string) http.Header { return http.Header{"Authorization": {"Bearer " + token}} }
// replyCheck decodes a JSON reply and fails with what bad reports, for
// services that answer 200 to failed requests.
func replyCheck(reply []byte, err error, bad func(map[string]any) string) error {
if err != nil {
return err
}
var v map[string]any
if json.Unmarshal(reply, &v) != nil {
return fmt.Errorf("unexpected answer: %s", truncate(string(reply), 200))
}
if msg := bad(v); msg != "" {
return errors.New(truncate(msg, 300))
}
return nil
}
// str formats a JSON value from a reply for messages and comparisons.
func str(v any) string {
switch v := v.(type) {
case nil:
return ""
case string:
return v
case float64:
return strconv.FormatFloat(v, 'f', -1, 64)
}
b, _ := json.Marshal(v)
return string(b)
}
// list splits comma, semicolon or newline separated values.
func list(s string) []string {
var out []string
for _, v := range strings.FieldsFunc(s, func(r rune) bool { return r == ',' || r == ';' || r == '\n' }) {
if v = strings.TrimSpace(v); v != "" {
out = append(out, v)
}
}
return out
}
// or returns s, or def when s is blank.
func or(s, def string) string {
if strings.TrimSpace(s) == "" {
return def
}
return strings.TrimSpace(s)
} }
// text joins title, body and link for services that take plain text. // text joins title, body and link for services that take plain text.
@@ -138,14 +257,16 @@ var webhookField = Field{Name: "webhook_url", Required: true, Secret: true, Kind
// Providers lists the supported services. Webhook and email are handled by // Providers lists the supported services. Webhook and email are handled by
// their own types; Apprise reaches the services not listed here. // their own types; Apprise reaches the services not listed here.
var Providers = []Provider{ var Providers = slices.Concat(baseProviders, chatProviders, pushProviders, smsProviders, emailProviders, incidentProviders)
{Type: "slack", Fields: []Field{webhookField}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
var baseProviders = []Provider{
{Type: "slack", Group: "chat", Fields: []Field{webhookField}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{"text": m.text()}) return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{"text": m.text()})
}}, }},
{Type: "discord", Fields: []Field{webhookField}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error { {Type: "discord", Group: "chat", Fields: []Field{webhookField}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{"content": m.text(), "username": "UptimeSebi"}) return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{"content": m.text(), "username": "UptimeSebi"})
}}, }},
{Type: "teams", Fields: []Field{webhookField}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error { {Type: "teams", Group: "chat", Fields: []Field{webhookField}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// Teams workflows take Adaptive Cards. // Teams workflows take Adaptive Cards.
blocks := []map[string]any{{"type": "TextBlock", "text": m.Title, "weight": "Bolder", "size": "Medium", "wrap": true}} blocks := []map[string]any{{"type": "TextBlock", "text": m.Title, "weight": "Bolder", "size": "Medium", "wrap": true}}
if m.Body != "" { if m.Body != "" {
@@ -160,20 +281,20 @@ var Providers = []Provider{
"type": "message", "attachments": []map[string]any{{"contentType": "application/vnd.microsoft.card.adaptive", "content": card}}, "type": "message", "attachments": []map[string]any{{"contentType": "application/vnd.microsoft.card.adaptive", "content": card}},
}) })
}}, }},
{Type: "googlechat", Fields: []Field{webhookField}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error { {Type: "googlechat", Group: "chat", Fields: []Field{webhookField}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{"text": m.text()}) return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{"text": m.text()})
}}, }},
{Type: "mattermost", Fields: []Field{webhookField, {Name: "channel", Kind: "text"}}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error { {Type: "mattermost", Group: "chat", Fields: []Field{webhookField, {Name: "channel", Kind: "text"}}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
body := map[string]any{"text": m.text(), "username": "UptimeSebi"} body := map[string]any{"text": m.text(), "username": "UptimeSebi"}
if cfg["channel"] != "" { if cfg["channel"] != "" {
body["channel"] = cfg["channel"] body["channel"] = cfg["channel"]
} }
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, body) return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, body)
}}, }},
{Type: "rocketchat", Fields: []Field{webhookField}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error { {Type: "rocketchat", Group: "chat", Fields: []Field{webhookField}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{"text": m.text()}) return c.json(ctx, http.MethodPost, cfg["webhook_url"], nil, map[string]any{"text": m.text()})
}}, }},
{Type: "telegram", Fields: []Field{ {Type: "telegram", Group: "chat", Fields: []Field{
{Name: "bot_token", Required: true, Secret: true, Kind: "text"}, {Name: "bot_token", Required: true, Secret: true, Kind: "text"},
{Name: "chat_id", Required: true, Kind: "text"}, {Name: "chat_id", Required: true, Kind: "text"},
{Name: "thread_id", Kind: "number"}, {Name: "thread_id", Kind: "number"},
@@ -189,7 +310,7 @@ var Providers = []Provider{
} }
return c.json(ctx, http.MethodPost, api+"/bot"+cfg["bot_token"]+"/sendMessage", nil, body) return c.json(ctx, http.MethodPost, api+"/bot"+cfg["bot_token"]+"/sendMessage", nil, body)
}}, }},
{Type: "matrix", Fields: []Field{ {Type: "matrix", Group: "chat", Fields: []Field{
{Name: "homeserver_url", Required: true, Kind: "url"}, {Name: "homeserver_url", Required: true, Kind: "url"},
{Name: "access_token", Required: true, Secret: true, Kind: "text"}, {Name: "access_token", Required: true, Secret: true, Kind: "text"},
{Name: "room_id", Required: true, Kind: "text"}, {Name: "room_id", Required: true, Kind: "text"},
@@ -199,7 +320,7 @@ var Providers = []Provider{
h := http.Header{"Authorization": {"Bearer " + cfg["access_token"]}} h := http.Header{"Authorization": {"Bearer " + cfg["access_token"]}}
return c.json(ctx, http.MethodPut, u, h, map[string]any{"msgtype": "m.text", "body": m.text()}) return c.json(ctx, http.MethodPut, u, h, map[string]any{"msgtype": "m.text", "body": m.text()})
}}, }},
{Type: "ntfy", Fields: []Field{ {Type: "ntfy", Group: "push", Fields: []Field{
{Name: "server_url", Kind: "url", Default: "https://ntfy.sh"}, {Name: "server_url", Kind: "url", Default: "https://ntfy.sh"},
{Name: "topic", Required: true, Kind: "text"}, {Name: "topic", Required: true, Kind: "text"},
{Name: "priority", Kind: "select", Options: []string{"3", "1", "2", "4", "5"}, Default: "4"}, {Name: "priority", Kind: "select", Options: []string{"3", "1", "2", "4", "5"}, Default: "4"},
@@ -221,7 +342,7 @@ var Providers = []Provider{
} }
return c.do(ctx, http.MethodPost, server+"/"+url.PathEscape(cfg["topic"]), h, strings.NewReader(m.Body)) return c.do(ctx, http.MethodPost, server+"/"+url.PathEscape(cfg["topic"]), h, strings.NewReader(m.Body))
}}, }},
{Type: "gotify", Fields: []Field{ {Type: "gotify", Group: "push", Fields: []Field{
{Name: "server_url", Required: true, Kind: "url"}, {Name: "server_url", Required: true, Kind: "url"},
{Name: "app_token", Required: true, Secret: true, Kind: "text"}, {Name: "app_token", Required: true, Secret: true, Kind: "text"},
{Name: "priority", Kind: "number", Default: "8"}, {Name: "priority", Kind: "number", Default: "8"},
@@ -231,7 +352,7 @@ var Providers = []Provider{
return c.json(ctx, http.MethodPost, trimURL(cfg["server_url"])+"/message", h, return c.json(ctx, http.MethodPost, trimURL(cfg["server_url"])+"/message", h,
map[string]any{"title": m.Title, "message": m.Body + "\n" + m.URL, "priority": prio}) map[string]any{"title": m.Title, "message": m.Body + "\n" + m.URL, "priority": prio})
}}, }},
{Type: "pushover", Fields: []Field{ {Type: "pushover", Group: "push", Fields: []Field{
{Name: "user_key", Required: true, Secret: true, Kind: "text"}, {Name: "user_key", Required: true, Secret: true, Kind: "text"},
{Name: "app_token", Required: true, Secret: true, Kind: "text"}, {Name: "app_token", Required: true, Secret: true, Kind: "text"},
{Name: "priority", Kind: "select", Options: []string{"0", "-1", "1"}, Default: "1"}, {Name: "priority", Kind: "select", Options: []string{"0", "-1", "1"}, Default: "1"},
@@ -247,13 +368,13 @@ var Providers = []Provider{
h := http.Header{"Content-Type": {"application/x-www-form-urlencoded"}} h := http.Header{"Content-Type": {"application/x-www-form-urlencoded"}}
return c.do(ctx, http.MethodPost, pushoverURL, h, strings.NewReader(form.Encode())) return c.do(ctx, http.MethodPost, pushoverURL, h, strings.NewReader(form.Encode()))
}}, }},
{Type: "pushbullet", Fields: []Field{{Name: "access_token", Required: true, Secret: true, Kind: "text"}}, {Type: "pushbullet", Group: "push", Fields: []Field{{Name: "access_token", Required: true, Secret: true, Kind: "text"}},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error { send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
h := http.Header{"Access-Token": {cfg["access_token"]}} h := http.Header{"Access-Token": {cfg["access_token"]}}
return c.json(ctx, http.MethodPost, pushbulletURL, h, return c.json(ctx, http.MethodPost, pushbulletURL, h,
map[string]any{"type": "note", "title": m.Title, "body": m.Body + "\n" + m.URL}) map[string]any{"type": "note", "title": m.Title, "body": m.Body + "\n" + m.URL})
}}, }},
{Type: "signal", Fields: []Field{ {Type: "signal", Group: "chat", Fields: []Field{
{Name: "api_url", Required: true, Kind: "url"}, {Name: "api_url", Required: true, Kind: "url"},
{Name: "number", Required: true, Kind: "text"}, {Name: "number", Required: true, Kind: "text"},
{Name: "recipients", Required: true, Kind: "text"}, {Name: "recipients", Required: true, Kind: "text"},
@@ -269,7 +390,7 @@ var Providers = []Provider{
return c.json(ctx, http.MethodPost, trimURL(cfg["api_url"])+"/v2/send", nil, return c.json(ctx, http.MethodPost, trimURL(cfg["api_url"])+"/v2/send", nil,
map[string]any{"message": m.text(), "number": cfg["number"], "recipients": recipients}) map[string]any{"message": m.text(), "number": cfg["number"], "recipients": recipients})
}}, }},
{Type: "pagerduty", Fields: []Field{ {Type: "pagerduty", Group: "incident", Fields: []Field{
{Name: "routing_key", Required: true, Secret: true, Kind: "text"}, {Name: "routing_key", Required: true, Secret: true, Kind: "text"},
{Name: "severity", Kind: "select", Options: []string{"critical", "error", "warning", "info"}, Default: "critical"}, {Name: "severity", Kind: "select", Options: []string{"critical", "error", "warning", "info"}, Default: "critical"},
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error { }, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
@@ -288,7 +409,7 @@ var Providers = []Provider{
} }
return c.json(ctx, http.MethodPost, pagerdutyURL, nil, body) return c.json(ctx, http.MethodPost, pagerdutyURL, nil, body)
}}, }},
{Type: "opsgenie", Fields: []Field{ {Type: "opsgenie", Group: "incident", Fields: []Field{
{Name: "api_key", Required: true, Secret: true, Kind: "text"}, {Name: "api_key", Required: true, Secret: true, Kind: "text"},
{Name: "region", Kind: "select", Options: []string{"us", "eu"}, Default: "us"}, {Name: "region", Kind: "select", Options: []string{"us", "eu"}, Default: "us"},
{Name: "priority", Kind: "select", Options: []string{"P1", "P2", "P3", "P4", "P5"}, Default: "P2"}, {Name: "priority", Kind: "select", Options: []string{"P1", "P2", "P3", "P4", "P5"}, Default: "P2"},
@@ -307,7 +428,7 @@ var Providers = []Provider{
"priority": cfg["priority"], "source": "UptimeSebi", "priority": cfg["priority"], "source": "UptimeSebi",
}) })
}}, }},
{Type: "apprise", Fields: []Field{ {Type: "apprise", Group: "other", Fields: []Field{
{Name: "api_url", Required: true, Kind: "url"}, {Name: "api_url", Required: true, Kind: "url"},
{Name: "urls", Secret: true, Kind: "text"}, {Name: "urls", Secret: true, Kind: "text"},
{Name: "config_key", Kind: "text"}, {Name: "config_key", Kind: "text"},
+171
View File
@@ -0,0 +1,171 @@
package notify
import (
"context"
"fmt"
"net/http"
"net/url"
"regexp"
)
// Push services for phones and desktops.
var serverChanTurbo = regexp.MustCompile(`^(?i)sctp(\d+)t`)
var pushProviders = []Provider{
{Type: "bark", Group: "push", Fields: []Field{secretURL("endpoint_url"), text("group", false), text("sound", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// The endpoint includes the device key, e.g.
// https://api.day.app/KEY.
return c.json(ctx, http.MethodPost, trimURL(cfg["endpoint_url"]), nil, map[string]any{
"title": m.Title, "body": m.Body, "url": m.URL,
"group": or(cfg["group"], "UptimeSebi"), "sound": or(cfg["sound"], "telegraph"),
})
}},
{Type: "gorush", Group: "push", Fields: []Field{
urlField("server_url", true, ""), secret("device_token", true),
{Name: "platform", Kind: "select", Options: []string{"ios", "android", "huawei"}, Default: "ios"},
text("topic", false),
{Name: "priority", Kind: "select", Options: []string{"high", "normal"}, Default: "high"},
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
platform := map[string]int{"ios": 1, "android": 2, "huawei": 3}[cfg["platform"]]
return c.json(ctx, http.MethodPost, trimURL(cfg["server_url"])+"/api/push", nil, map[string]any{
"notifications": []map[string]any{{
"tokens": []string{cfg["device_token"]}, "platform": platform, "title": m.Title, "message": m.Body,
"priority": or(cfg["priority"], "high"), "topic": cfg["topic"],
}},
})
}},
{Type: "lunasea", Group: "push", Fields: []Field{
{Name: "target", Kind: "select", Options: []string{"device", "user"}, Default: "device"},
secret("target_id", true),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
target := "device"
if cfg["target"] == "user" {
target = "user"
}
return c.json(ctx, http.MethodPost, "https://notify.lunasea.app/v1/custom/"+target+"/"+url.PathEscape(cfg["target_id"]), nil,
map[string]any{"title": m.Title, "body": m.Body})
}},
{Type: "notifery", Group: "push", Fields: []Field{secret("api_key", true), text("group", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
body := map[string]any{"title": m.Title, "message": m.Body + "\n" + m.URL}
if cfg["group"] != "" {
body["group"] = cfg["group"]
}
switch m.Event {
case Opened:
body["code"] = 1
case Resolved:
body["code"] = 0
}
return c.json(ctx, http.MethodPost, "https://api.notifery.com/event", http.Header{"x-api-key": {cfg["api_key"]}}, body)
}},
{Type: "notifyapp", Group: "push", Fields: []Field{text("device_id", true), secret("token", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
u := "https://push.getnotifyapp.com/notify-json/" + url.PathEscape(cfg["device_id"]) + "?token=" + url.QueryEscape(cfg["token"])
return c.json(ctx, http.MethodPost, u, nil, map[string]any{"title": m.Title, "text": m.Body, "timeSensitive": m.Event == Opened})
}},
{Type: "pushdeer", Group: "push", Fields: []Field{secret("push_key", true), urlField("server_url", false, "https://api2.pushdeer.com")},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
reply, err := c.callJSON(ctx, http.MethodPost, trimURL(or(cfg["server_url"], "https://api2.pushdeer.com"))+"/message/push", nil,
map[string]any{"pushkey": cfg["push_key"], "text": m.Title, "desp": m.Body + "\n\n" + m.URL, "type": "markdown"})
return replyCheck(reply, err, func(v map[string]any) string {
if e := str(v["error"]); e != "" {
return "PushDeer: " + e
}
return ""
})
}},
{Type: "pushplus", Group: "push", Fields: []Field{secret("send_key", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
reply, err := c.callJSON(ctx, http.MethodPost, "https://www.pushplus.plus/send", nil,
map[string]any{"token": cfg["send_key"], "title": m.Title, "content": m.Body + "\n" + m.URL, "template": "txt"})
return replyCheck(reply, err, func(v map[string]any) string {
if str(v["code"]) != "200" {
return "PushPlus: " + str(v["msg"])
}
return ""
})
}},
{Type: "pushy", Group: "push", Fields: []Field{secret("api_key", true), text("device_token", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, "https://api.pushy.me/push?api_key="+url.QueryEscape(cfg["api_key"]), nil, map[string]any{
"to": cfg["device_token"], "data": map[string]any{"message": m.Title, "url": m.URL},
"notification": map[string]any{"title": m.Title, "body": m.Body, "badge": 1, "sound": "ping.aiff"},
})
}},
{Type: "serverchan", Group: "push", Fields: []Field{secret("send_key", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
key := cfg["send_key"]
u := "https://sctapi.ftqq.com/" + url.PathEscape(key) + ".send"
// ServerChan³ keys name their own host.
if g := serverChanTurbo.FindStringSubmatch(key); g != nil {
u = "https://" + g[1] + ".push.ft07.com/send/" + url.PathEscape(key) + ".send"
}
return c.json(ctx, http.MethodPost, u, nil, map[string]any{"title": m.Title, "desp": m.Body + "\n\n" + m.URL})
}},
{Type: "signalgrid", Group: "push", Fields: []Field{secret("client_key", true), text("channel", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
typ := map[string]string{"down": "CRIT", "up": "SUCCESS"}[m.status()]
reply, err := c.form(ctx, "https://api.signalgrid.co/v1/push", nil, url.Values{
"client_key": {cfg["client_key"]}, "channel": {cfg["channel"]}, "title": {m.Title},
"body": {m.Body + "\n" + m.URL}, "type": {or(typ, "INFO")}, "critical": {"false"},
})
return replyCheck(reply, err, func(v map[string]any) string {
if code := str(v["code"]); code != "" && code != "200" {
return "Signalgrid: " + str(v["text"])
}
return ""
})
}},
{Type: "spugpush", Group: "push", Fields: []Field{secret("template_key", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, "https://push.spug.cc/send/"+url.PathEscape(cfg["template_key"]), nil,
map[string]any{"title": m.Title, "content": m.Body + "\n" + m.URL})
}},
{Type: "techulus", Group: "push", Fields: []Field{secret("api_key", true), text("channel", false), text("sound", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
body := map[string]any{"title": m.Title, "body": m.Body + "\n" + m.URL, "timeSensitive": m.Event == Opened}
if cfg["channel"] != "" {
body["channel"] = cfg["channel"]
}
if cfg["sound"] != "" {
body["sound"] = cfg["sound"]
}
return c.json(ctx, http.MethodPost, "https://push.techulus.com/api/v1/notify/"+url.PathEscape(cfg["api_key"]), nil, body)
}},
{Type: "wpush", Group: "push", Fields: []Field{secret("api_key", true), text("channel", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
reply, err := c.callJSON(ctx, http.MethodPost, "https://api.wpush.cn/api/v1/send", nil,
map[string]any{"title": m.Title, "content": m.Body + "\n" + m.URL, "apikey": cfg["api_key"], "channel": cfg["channel"]})
return replyCheck(reply, err, func(v map[string]any) string {
if str(v["code"]) != "0" {
return "WPush: " + str(v["message"])
}
return ""
})
}},
{Type: "wxpusher", Group: "push", Fields: []Field{secret("spt", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// Simple push tokens, up to ten per request.
spts := list(cfg["spt"])
for i := 0; i < len(spts); i += 10 {
reply, err := c.callJSON(ctx, http.MethodPost, "https://wxpusher.zjiecode.com/api/send/message/simple-push", nil, map[string]any{
"content": m.text(), "summary": truncate(m.Title, 100), "contentType": 1, "sptList": spts[i:min(i+10, len(spts))],
})
if err := replyCheck(reply, err, func(v map[string]any) string {
if str(v["code"]) != "1000" {
return "WxPusher: " + str(v["msg"])
}
return ""
}); err != nil {
return err
}
}
if len(spts) == 0 {
return fmt.Errorf("no SPT set")
}
return nil
}},
}
+392
View File
@@ -0,0 +1,392 @@
package notify
import (
"context"
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"encoding/json"
"io"
"net"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"sync"
"testing"
"github.com/coder/websocket"
"github.com/google/uuid"
"github.com/nbd-wtf/go-nostr"
"github.com/nbd-wtf/go-nostr/nip19"
"github.com/nbd-wtf/go-nostr/nip44"
"github.com/nbd-wtf/go-nostr/nip59"
)
// call is a request a fake service received, with the host it was meant
// for.
type call struct {
Method, Host, Path string
Query url.Values
Header http.Header
Body string
}
func (c call) form() url.Values { v, _ := url.ParseQuery(c.Body); return v }
func (c call) json() map[string]any {
var v map[string]any
_ = json.Unmarshal([]byte(c.Body), &v)
return v
}
// services routes every request to one fake server, whatever host it was
// addressed to, and answers with reply.
func services(t *testing.T, reply func(call) (int, string)) func() []call {
t.Helper()
var mu sync.Mutex
var calls []call
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
b, _ := io.ReadAll(r.Body)
c := call{r.Method, r.Header.Get("X-Test-Host"), r.URL.Path, r.URL.Query(), r.Header.Clone(), string(b)}
mu.Lock()
calls = append(calls, c)
mu.Unlock()
status, body := reply(c)
w.WriteHeader(status)
_, _ = io.WriteString(w, body)
}))
t.Cleanup(srv.Close)
target, _ := url.Parse(srv.URL)
old := transport
transport = func(*net.Dialer) http.RoundTripper {
return roundTrip(func(r *http.Request) (*http.Response, error) {
r = r.Clone(r.Context())
r.Header.Set("X-Test-Host", r.URL.Host)
r.URL.Scheme, r.URL.Host, r.Host = "http", target.Host, target.Host
return http.DefaultTransport.RoundTrip(r)
})
}
t.Cleanup(func() { transport = old })
return func() []call { mu.Lock(); defer mu.Unlock(); return append([]call(nil), calls...) }
}
type roundTrip func(*http.Request) (*http.Response, error)
func (f roundTrip) RoundTrip(r *http.Request) (*http.Response, error) { return f(r) }
var (
testKey = uuid.MustParse("00000000-0000-0000-0000-0000000000aa")
testOpened = Message{Event: Opened, Title: "Shop is down", Body: "eu: unexpected status 502", URL: "https://uptime.example/monitors/1", Key: testKey, Monitor: "Shop", Target: "https://shop.example"}
testResolve = func() Message { m := testOpened; m.Event, m.Title = Resolved, "Shop is up again"; return m }()
)
// serviceCase sends msg through typ with cfg; check inspects the requests.
type serviceCase struct {
typ string
cfg map[string]string
msg Message
reply string
check func(t *testing.T, calls []call)
}
// one asserts a single request to host and path containing all of want in
// its URL, headers or body.
func one(host, path string, want ...string) func(*testing.T, []call) {
return func(t *testing.T, calls []call) {
t.Helper()
if len(calls) != 1 {
t.Fatalf("%d requests, want 1", len(calls))
}
c := calls[0]
if c.Host != host || !strings.HasPrefix(c.Path, path) {
t.Errorf("request to %s%s, want %s%s", c.Host, c.Path, host, path)
}
all := c.Path + "?" + c.Query.Encode() + "\n" + c.Body
for k, v := range c.Header {
all += "\n" + k + ": " + strings.Join(v, ",")
}
decoded, _ := url.QueryUnescape(all)
for _, w := range want {
if !strings.Contains(all, w) && !strings.Contains(decoded, w) {
t.Errorf("request lacks %q:\n%s", w, all)
}
}
}
}
func TestServices(t *testing.T) {
var current *serviceCase
calls := services(t, func(call) (int, string) {
if current.reply != "" {
return http.StatusOK, current.reply
}
return http.StatusOK, "{}"
})
basicAuth := func(u, p string) string { return "Basic " + base64.StdEncoding.EncodeToString([]byte(u+":"+p)) }
cases := []serviceCase{
// Chat and messengers.
{typ: "bale", cfg: map[string]string{"bot_token": "b0t", "chat_id": "42"}, check: one("tapi.bale.ai", "/botb0t/sendMessage", `"chat_id":"42"`, "Shop is down")},
{typ: "bitrix", cfg: map[string]string{"webhook_url": "https://corp.bitrix24.de/rest/1/k3y", "user_id": "7"}, check: one("corp.bitrix24.de", "/rest/1/k3y/im.notify.system.add.json", "user_id=7", "Shop is down")},
{typ: "clickup", cfg: map[string]string{"api_token": "pk_1", "workspace_id": "w1", "channel_id": "c1"}, check: one("api.clickup.com", "/api/v3/workspaces/w1/chat/channels/c1/messages", "Authorization: pk_1", "Shop is down")},
{typ: "dingtalk", cfg: map[string]string{"webhook_url": "https://oapi.dingtalk.com/robot/send?access_token=at", "sign_secret": "SECabc"}, reply: `{"errcode":0,"errmsg":"ok"}`,
check: func(t *testing.T, calls []call) {
one("oapi.dingtalk.com", "/robot/send", "access_token=at", "Shop is down")(t, calls)
ts, sign := calls[0].Query.Get("timestamp"), calls[0].Query.Get("sign")
mac := hmac.New(sha256.New, []byte("SECabc"))
mac.Write([]byte(ts + "\nSECabc"))
if sign != base64.StdEncoding.EncodeToString(mac.Sum(nil)) {
t.Error("DingTalk signature does not verify")
}
}},
{typ: "feishu", cfg: map[string]string{"webhook_url": "https://open.feishu.cn/open-apis/bot/v2/hook/x"}, reply: `{"code":0}`, check: one("open.feishu.cn", "/open-apis/bot/v2/hook/x", `"msg_type":"text"`, "Shop is down")},
{typ: "fluxer", cfg: map[string]string{"webhook_url": "https://api.fluxer.app/webhooks/1/t"}, check: one("api.fluxer.app", "/webhooks/1/t", `"content":"Shop is down`)},
{typ: "kook", cfg: map[string]string{"bot_token": "kt", "channel_id": "ch"}, reply: `{"code":0}`, check: one("www.kookapp.cn", "/api/v3/message/create", "Authorization: Bot kt", `"target_id":"ch"`)},
{typ: "line", cfg: map[string]string{"access_token": "lt", "user_id": "U1"}, check: one("api.line.me", "/v2/bot/message/push", "Bearer lt", `"to":"U1"`, "Shop is down")},
{typ: "max", cfg: map[string]string{"bot_token": "mt", "chat_id": "-5"}, check: one("platform-api.max.ru", "/messages", "chat_id=-5", "Authorization: mt", "Shop is down")},
{typ: "milky", cfg: map[string]string{"api_url": "http://qq.lan:3000", "access_token": "mk", "message_type": "group", "receiver_id": "123"}, check: one("qq.lan:3000", "/api/send_group_message", `"group_id":123`, "Bearer mk")},
{typ: "onebot", cfg: map[string]string{"api_url": "http://qq.lan:5700", "message_type": "private", "receiver_id": "9"}, check: one("qq.lan:5700", "/send_msg", `"message_type":"private"`, `"user_id":"9"`)},
{typ: "onechat", cfg: map[string]string{"access_token": "oc", "receiver_id": "r", "bot_id": "b"}, check: one("chat-api.one.th", "/message/api/v1/push_message", "Bearer oc", `"bot_id":"b"`)},
{typ: "nextcloudtalk", cfg: map[string]string{"server_url": "https://cloud.example", "conversation_token": "ct", "bot_secret": "bs"},
check: func(t *testing.T, calls []call) {
one("cloud.example", "/ocs/v2.php/apps/spreed/api/v1/bot/ct/message", "Shop is down")(t, calls)
c := calls[0]
mac := hmac.New(sha256.New, []byte("bs"))
mac.Write([]byte(c.Header.Get("X-Nextcloud-Talk-Bot-Random") + c.json()["message"].(string)))
if c.Header.Get("X-Nextcloud-Talk-Bot-Signature") != hex.EncodeToString(mac.Sum(nil)) {
t.Error("Nextcloud Talk signature does not verify")
}
}},
{typ: "pumble", cfg: map[string]string{"webhook_url": "https://api.pumble.com/workspaces/w/x"}, check: one("api.pumble.com", "/workspaces/w/x", `"color":"#DC3645"`)},
{typ: "stackfield", cfg: map[string]string{"webhook_url": "https://www.stackfield.com/apiwebhook/x"}, check: one("www.stackfield.com", "/apiwebhook/x", `"Title":"Shop is down`)},
{typ: "vk", cfg: map[string]string{"access_token": "vt", "peer_id": "2000000001"}, reply: `{"response":1}`, check: one("api.vk.ru", "/method/messages.send", "access_token=vt", "v=5.199", "peer_id=2000000001")},
{typ: "vkteams", cfg: map[string]string{"bot_token": "vkt", "chat_id": "c@chat"}, reply: `{"ok":true}`, check: one("myteam.mail.ru", "/bot/v1/messages/sendText", "token=vkt", "chatId=c@chat")},
{typ: "wecom", cfg: map[string]string{"bot_key": "wk", "mentioned_mobiles": "138, 139"}, reply: `{"errcode":0}`, check: one("qyapi.weixin.qq.com", "/cgi-bin/webhook/send", "key=wk", `"mentioned_mobile_list":["138","139"]`)},
{typ: "yunzhijia", cfg: map[string]string{"webhook_url": "https://www.yunzhijia.com/gateway/robot/webhook/send", "token": "yt"}, reply: `{"success":true}`, check: one("www.yunzhijia.com", "/gateway/robot/webhook/send", "yzjtoken=yt", "Shop is down")},
{typ: "zohocliq", cfg: map[string]string{"webhook_url": "https://cliq.zoho.eu/api/v2/channelsbyname/ops/message?zapikey=z"}, check: one("cliq.zoho.eu", "/api/v2/channelsbyname/ops/message", `"text":"Shop is down`)},
{typ: "threema", cfg: map[string]string{"gateway_id": "*UPTIME1", "gateway_secret": "ts", "recipient_type": "phone", "recipient": "41791234567"}, check: one("msgapi.threema.ch", "/send_simple", "from=*UPTIME1", "phone=41791234567", "secret=ts")},
{typ: "evolution", cfg: map[string]string{"api_url": "https://evo.example", "api_key": "ek", "instance": "main", "recipient": "4917"}, check: one("evo.example", "/message/sendText/main", "Apikey: ek", `"number":"4917"`)},
{typ: "waha", cfg: map[string]string{"api_url": "http://waha.lan:3000", "api_key": "wk", "session": "default", "chat_id": "49@c.us"}, check: one("waha.lan:3000", "/api/sendText", "X-Api-Key: wk", `"chatId":"49@c.us"`)},
{typ: "whapi", cfg: map[string]string{"api_token": "wt", "recipient": "4917"}, check: one("gate.whapi.cloud", "/messages/text", "Bearer wt", `"to":"4917"`)},
{typ: "openwa", cfg: map[string]string{"api_url": "http://wa.lan", "api_key": "ok", "session": "s1", "chat_ids": "1@c.us"}, check: one("wa.lan", "/api/sessions/s1/messages/send-text", "X-Api-Key: ok", `"chatId":"1@c.us"`)},
{typ: "onesender", cfg: map[string]string{"api_url": "https://os.example/api/v1/messages", "api_token": "ot", "message_type": "group", "recipient": "123"}, check: one("os.example", "/api/v1/messages", "Bearer ot", `"to":"123@g.us"`)},
{typ: "messenger360", cfg: map[string]string{"api_token": "m3", "recipients": "4917"}, check: one("api.360messenger.com", "/v2/sendMessage", "Bearer m3", `"phonenumber":"4917"`)},
{typ: "homeassistant", cfg: map[string]string{"server_url": "http://ha.lan:8123", "access_token": "ha", "service": "mobile_app_phone"}, check: one("ha.lan:8123", "/api/services/notify/mobile_app_phone", "Bearer ha", "Shop is down")},
{typ: "indigo", cfg: map[string]string{"server_url": "https://indigo.lan", "api_key": "ik", "variable_id": "12"}, check: one("indigo.lan", "/v2/api/command", "indigo.variable.updateValue", `"objectId":12`)},
{typ: "googlesheets", cfg: map[string]string{"webhook_url": "https://script.google.com/macros/s/x/exec"}, check: one("script.google.com", "/macros/s/x/exec", `"status":"DOWN"`, `"monitorName":"Shop"`)},
{typ: "callmebot", cfg: map[string]string{"endpoint_url": "https://api.callmebot.com/whatsapp.php?phone=49&apikey=cb"}, check: one("api.callmebot.com", "/whatsapp.php", "apikey=cb", "text=Shop is down")},
// Push.
{typ: "bark", cfg: map[string]string{"endpoint_url": "https://api.day.app/devkey"}, check: one("api.day.app", "/devkey", `"title":"Shop is down"`, `"group":"UptimeSebi"`)},
{typ: "gorush", cfg: map[string]string{"server_url": "https://push.example", "device_token": "dt", "platform": "android"}, check: one("push.example", "/api/push", `"platform":2`, `"tokens":["dt"]`)},
{typ: "lunasea", cfg: map[string]string{"target": "user", "target_id": "u1"}, check: one("notify.lunasea.app", "/v1/custom/user/u1", "Shop is down")},
{typ: "notifery", cfg: map[string]string{"api_key": "nk"}, check: one("api.notifery.com", "/event", "X-Api-Key: nk", `"code":1`)},
{typ: "notifyapp", cfg: map[string]string{"device_id": "d1", "token": "nt"}, check: one("push.getnotifyapp.com", "/notify-json/d1", "token=nt", `"timeSensitive":true`)},
{typ: "pushdeer", cfg: map[string]string{"push_key": "PDU1"}, reply: `{"code":0}`, check: one("api2.pushdeer.com", "/message/push", `"pushkey":"PDU1"`)},
{typ: "pushplus", cfg: map[string]string{"send_key": "pp"}, reply: `{"code":200}`, check: one("www.pushplus.plus", "/send", `"token":"pp"`)},
{typ: "pushy", cfg: map[string]string{"api_key": "pk", "device_token": "dt"}, check: one("api.pushy.me", "/push", "api_key=pk", `"to":"dt"`)},
{typ: "serverchan", cfg: map[string]string{"send_key": "sctp123tABC"}, check: one("123.push.ft07.com", "/send/sctp123tABC.send", `"title":"Shop is down"`)},
{typ: "signalgrid", cfg: map[string]string{"client_key": "sg", "channel": "ops"}, reply: `{"code":200}`, check: one("api.signalgrid.co", "/v1/push", "client_key=sg", "type=CRIT")},
{typ: "spugpush", cfg: map[string]string{"template_key": "tk"}, check: one("push.spug.cc", "/send/tk", "Shop is down")},
{typ: "techulus", cfg: map[string]string{"api_key": "tk", "channel": "ops"}, check: one("push.techulus.com", "/api/v1/notify/tk", `"channel":"ops"`)},
{typ: "wpush", cfg: map[string]string{"api_key": "wk", "channel": "wechat"}, reply: `{"code":0}`, check: one("api.wpush.cn", "/api/v1/send", `"apikey":"wk"`)},
{typ: "wxpusher", cfg: map[string]string{"spt": "SPT_1, SPT_2"}, reply: `{"code":1000}`, check: one("wxpusher.zjiecode.com", "/api/send/message/simple-push", `"sptList":["SPT_1","SPT_2"]`)},
// SMS and calls.
{typ: "elks46", cfg: map[string]string{"username": "u", "auth_token": "p", "sender": "Uptime", "phone_number": "+4670"}, check: one("api.46elks.com", "/a1/sms", basicAuth("u", "p"), "to=+4670")},
{typ: "aliyunsms", cfg: map[string]string{"access_key_id": "id", "access_key_secret": "sk", "sign_name": "S", "template_code": "T1", "phone_number": "138"}, reply: `{"Code":"OK"}`,
check: func(t *testing.T, calls []call) {
one("dysmsapi.aliyuncs.com", "/", "PhoneNumbers=138", "TemplateCode=T1")(t, calls)
v := calls[0].form()
sig := v.Get("Signature")
v.Del("Signature")
if aliyunSign(v, "sk") != sig || sig == "" {
t.Error("Alibaba Cloud signature does not verify")
}
}},
{typ: "amootsms", cfg: map[string]string{"api_token": "at", "line_number": "9821", "phone_numbers": "0912"}, reply: `{"Status":"Success"}`, check: one("portal.amootsms.com", "/rest/SendSimple", "Authorization: at", "Mobiles=0912")},
{typ: "bearsms", cfg: map[string]string{"username": "u", "hash_key": "h", "phone_number": "88017"}, reply: `{"status":"OK","data":[{"status":"OK"}]}`, check: one("app.bearsms.com", "/index.php", "u=u", "h=h", "to=88017")},
{typ: "cellsynt", cfg: map[string]string{"username": "u", "password": "p", "phone_number": "0046", "sender": "Uptime"}, reply: "OK: abc", check: one("se-1.cellsynt.net", "/sms.php", "destination=0046", "originator=Uptime")},
{typ: "clicksend", cfg: map[string]string{"username": "u", "api_key": "k", "phone_number": "+61"}, reply: `{"data":{"messages":[{"status":"SUCCESS"}]}}`, check: one("rest.clicksend.com", "/v3/sms/send", basicAuth("u", "k"), `"to":"+61"`)},
{typ: "egosms", cfg: map[string]string{"username": "u", "password": "p", "phone_number": "256"}, check: one("www.egosms.co", "/api/v1/plain/", "number=256", "sender=EGOSMS")},
{typ: "freemobile", cfg: map[string]string{"username": "123", "password": "fp"}, check: one("smsapi.free-mobile.fr", "/sendmsg", `"user":"123"`, "msg=Shop is down")},
{typ: "gtxmessaging", cfg: map[string]string{"api_key": "gk", "sender": "Uptime", "phone_number": "49"}, check: one("rest.gtx-messaging.net", "/smsc/sendsms/gk/json", "to=49")},
{typ: "octopush", cfg: map[string]string{"username": "me@x", "api_key": "ok", "phone_number": "+33"}, check: one("api.octopush.com", "/v1/public/sms-campaign/send", "Api-Key: ok", "Api-Login: me@x", `"phone_number":"+33"`)},
{typ: "ooredoo", cfg: map[string]string{"username": "u", "access_key": "ak", "api_token": "bt", "phone_numbers": "7771234, 9607771235"}, reply: `{"response_code":0}`, check: one("o-papi1-lb01.ooredoo.mv", "/bulk_sms/v2", "Bearer bt", "batch=7771234 9607771235")},
{typ: "plivo", cfg: map[string]string{"auth_id": "MA1", "auth_token": "pt", "sender": "+1", "phone_number": "+2"}, check: one("api.plivo.com", "/v1/Account/MA1/Message/", basicAuth("MA1", "pt"), `"dst":"+2"`)},
{typ: "promosms", cfg: map[string]string{"username": "u", "password": "p", "phone_number": "48", "sms_type": "3"}, reply: `{"response":{"status":0}}`, check: one("promosms.com", "/api/rest/v3_2/sms", basicAuth("u", "p"), `"type":3`)},
{typ: "serwersms", cfg: map[string]string{"username": "u", "password": "p", "phone_number": "48"}, reply: `{"success":true}`, check: one("api2.serwersms.pl", "/messages/send_sms", `"phone":"48"`)},
{typ: "sevenio", cfg: map[string]string{"api_key": "sk", "phone_number": "49"}, check: one("gateway.seven.io", "/api/sms", "X-Api-Key: sk", `"to":"49"`)},
{typ: "smsgateway", cfg: map[string]string{"api_url": "http://phone.lan:8080", "api_key": "gk", "phone_numbers": "49"}, reply: `{"status":"sent"}`, check: one("phone.lan:8080", "/api/v1/sms/send", "X-Api-Key: gk")},
{typ: "smsplanet", cfg: map[string]string{"api_token": "st", "sender": "Uptime", "phone_numbers": "48"}, reply: `{"messageId":1}`, check: one("api2.smsplanet.pl", "/sms", "Bearer st", "to=48")},
{typ: "smsc", cfg: map[string]string{"username": "u", "password": "p", "phone_number": "7"}, reply: `{"id":1}`, check: one("smsc.kz", "/sys/send.php", "login=u", "phones=7")},
{typ: "smseagle", cfg: map[string]string{"api_url": "https://eagle.lan", "access_token": "et", "phone_numbers": "48, 49"}, check: one("eagle.lan", "/api/v2/messages/sms", "Access-Token: et", `"to":["48","49"]`)},
{typ: "smsir", cfg: map[string]string{"api_key": "ik", "template_id": "100", "phone_numbers": "09121234567"}, check: one("api.sms.ir", "/v1/send/verify", "X-Api-Key: ik", `"mobile":"9121234567"`, `"templateId":100`)},
{typ: "smsmanager", cfg: map[string]string{"api_key": "mk", "phone_numbers": "420"}, check: one("http-api.smsmanager.cz", "/Send", "apikey=mk", "gateway=high")},
{typ: "smspartner", cfg: map[string]string{"api_key": "pk", "phone_numbers": "33", "sender": "Uptime"}, reply: `{"success":true}`, check: one("api.smspartner.fr", "/v1/send", `"apiKey":"pk"`)},
{typ: "telnyx", cfg: map[string]string{"api_key": "tk", "sender": "+1", "phone_number": "+2"}, check: one("api.telnyx.com", "/v2/messages", "Bearer tk", `"to":"+2"`)},
{typ: "teltonika", cfg: map[string]string{"server_url": "https://192.168.1.1/x", "username": "admin", "password": "rp", "modem": "1-1", "phone_number": "+49"}, reply: `{"success":true,"data":{"token":"tt"}}`,
check: func(t *testing.T, calls []call) {
if len(calls) != 2 || calls[0].Path != "/api/login" || calls[1].Path != "/api/messages/actions/send" || calls[1].Header.Get("Authorization") != "Bearer tt" {
t.Errorf("calls = %+v", calls)
}
}},
{typ: "twilio", cfg: map[string]string{"account_sid": "AC1", "auth_token": "tt", "sender": "+1", "phone_number": "+2"}, check: one("api.twilio.com", "/2010-04-01/Accounts/AC1/Messages.json", basicAuth("AC1", "tt"), "To=+2", "From=+1")},
// Email.
{typ: "brevo", cfg: map[string]string{"api_key": "bk", "from_email": "a@x", "to_email": "b@x, c@x", "cc_email": "d@x"}, check: one("api.brevo.com", "/v3/smtp/email", "Api-Key: bk", `"to":[{"email":"b@x"},{"email":"c@x"}]`, `"cc":[{"email":"d@x"}]`)},
{typ: "resend", cfg: map[string]string{"api_key": "rk", "from_email": "a@x", "to_email": "b@x"}, check: one("api.resend.com", "/emails", "Bearer rk", `"from":"UptimeSebi \u003ca@x\u003e"`, `"subject":"Shop is down"`)},
{typ: "sendgrid", cfg: map[string]string{"api_key": "sg", "from_email": "a@x", "to_email": "b@x", "subject": "Alert"}, check: one("api.sendgrid.com", "/v3/mail/send", "Bearer sg", `"subject":"Alert"`)},
{typ: "turbosmtp", cfg: map[string]string{"consumer_key": "ck", "consumer_secret": "cs", "region": "eu", "from_email": "a@x", "to_email": "b@x, c@x"}, check: one("api.eu.turbo-smtp.com", "/api/v2/mail/send", "Consumerkey: ck", `"to":"b@x,c@x"`)},
{typ: "microsoftgraph", cfg: map[string]string{"tenant_id": "t1", "client_id": "c1", "client_secret": "cs", "mailbox": "alerts@x", "to_email": "b@x"}, reply: `{"access_token":"gt"}`,
check: func(t *testing.T, calls []call) {
if len(calls) != 2 || calls[0].Host != "login.microsoftonline.com" || calls[0].form().Get("client_secret") != "cs" ||
calls[1].Path != "/v1.0/users/alerts@x/sendMail" || calls[1].Header.Get("Authorization") != "Bearer gt" {
t.Errorf("calls = %+v", calls)
}
}},
// Incident management.
{typ: "alerta", cfg: map[string]string{"api_url": "https://alerta.example/api/alert", "api_key": "ak", "environment": "Production"}, check: one("alerta.example", "/api/alert", "Authorization: Key ak", `"resource":"Shop"`, `"severity":"critical"`)},
{typ: "alerta", msg: testResolve, cfg: map[string]string{"api_url": "https://alerta.example/api/alert", "api_key": "ak", "environment": "Production"}, check: one("alerta.example", "/api/alert", `"severity":"normal"`)},
{typ: "alertnow", cfg: map[string]string{"webhook_url": "https://alertnowitgr.opsnow.com/x"}, check: one("alertnowitgr.opsnow.com", "/x", `"status":"open"`, testKey.String())},
{typ: "flashduty", cfg: map[string]string{"integration_key": "fk"}, check: one("api.flashcat.cloud", "/event/push/alert/standard", "integration_key=fk", `"event_status":"Critical"`)},
{typ: "goalert", msg: testResolve, cfg: map[string]string{"server_url": "https://goalert.example", "token": "gt"}, check: one("goalert.example", "/api/v2/generic/incoming", "token=gt", "action=close", "dedup="+testKey.String())},
{typ: "grafanaoncall", cfg: map[string]string{"webhook_url": "https://oncall.example/integrations/v1/formatted_webhook/x/"}, check: one("oncall.example", "/integrations/v1/formatted_webhook/x/", `"state":"alerting"`, `"alert_uid":"`+testKey.String())},
{typ: "heiioncall", msg: testResolve, cfg: map[string]string{"api_key": "hk", "trigger_id": "tr"}, check: one("heiioncall.com", "/triggers/tr/resolve", "Bearer hk")},
{typ: "jsm", cfg: map[string]string{"cloud_id": "cid", "email": "a@x", "api_token": "jt", "priority": "P2"}, check: one("api.atlassian.com", "/jsm/ops/api/cid/v1/alerts", basicAuth("a@x", "jt"), `"alias":"`+testKey.String(), `"priority":"P2"`)},
{typ: "jsm", msg: testResolve, cfg: map[string]string{"cloud_id": "cid", "email": "a@x", "api_token": "jt"}, reply: `{"id":"al1"}`,
check: func(t *testing.T, calls []call) {
if len(calls) != 2 || calls[0].Query.Get("alias") != testKey.String() || calls[1].Path != "/jsm/ops/api/cid/v1/alerts/al1/close" {
t.Errorf("calls = %+v", calls)
}
}},
{typ: "pagertree", msg: testResolve, cfg: map[string]string{"integration_url": "https://api.pagertree.com/integration/int_x"}, check: one("api.pagertree.com", "/integration/int_x", `"event_type":"resolve"`, `"id":"`+testKey.String())},
{typ: "signl4", cfg: map[string]string{"webhook_url": "https://connect.signl4.com/webhook/team"}, check: one("connect.signl4.com", "/webhook/team", `"X-S4-Status":"new"`, `"X-S4-ExternalID":"UptimeSebi-`+testKey.String())},
{typ: "splunk", msg: testResolve, cfg: map[string]string{"rest_url": "https://alert.victorops.com/integrations/generic/20131114/alert/k/route"}, check: one("alert.victorops.com", "/integrations/generic/20131114/alert/k/route", `"message_type":"RECOVERY"`)},
{typ: "squadcast", cfg: map[string]string{"webhook_url": "https://api.squadcast.com/v2/incidents/api/x"}, check: one("api.squadcast.com", "/v2/incidents/api/x", `"status":"trigger"`, `"event_id":"`+testKey.String())},
{typ: "trigv", cfg: map[string]string{"api_key": "tv"}, check: one("api.trigv.com", "/v1/events", "Bearer tv", `"level":"error"`, `"channel":"general"`)},
{typ: "halopsa", cfg: map[string]string{"webhook_url": "https://halo.example/api/webhook", "username": "u", "password": "p"}, check: one("halo.example", "/api/webhook", basicAuth("u", "p"), `"status":"DOWN"`)},
{typ: "flowtriq", cfg: map[string]string{"webhook_url": "https://flowtriq.example/hook", "api_key": "fk"}, check: one("flowtriq.example", "/hook", "X-Api-Key: fk", `"status":"down"`)},
{typ: "keep", cfg: map[string]string{"server_url": "https://keep.example", "api_key": "kk"}, check: one("keep.example", "/alerts/event/uptimekuma", "X-Api-Key: kk", `"status":0`, `"name":"Shop"`)},
{typ: "opsimate", cfg: map[string]string{"server_url": "https://opsimate.example", "api_token": "ot"}, check: one("opsimate.example", "/api/v1/alerts/custom/uptimekuma", "X-Api-Token: ot")},
{typ: "pinglet", cfg: map[string]string{"publish_url": "https://pinglet.example/p/x", "api_key": "pk"}, check: one("pinglet.example", "/p/x", "rewrite=uptimekuma", "Bearer pk")},
}
for i := range cases {
tc := &cases[i]
t.Run(tc.typ, func(t *testing.T) {
current = tc
p, ok := Lookup(tc.typ)
if !ok {
t.Fatalf("unknown provider %s", tc.typ)
}
before := len(calls())
msg := tc.msg
if msg.Event == "" {
msg = testOpened
}
if err := p.Send(context.Background(), tc.cfg, msg, true); err != nil {
t.Fatalf("Send: %v", err)
}
tc.check(t, calls()[before:])
})
}
// Every provider is exercised here or in TestProviders.
tested := map[string]bool{"slack": true, "discord": true, "teams": true, "googlechat": true, "mattermost": true, "rocketchat": true,
"telegram": true, "matrix": true, "ntfy": true, "gotify": true, "pushover": true, "pushbullet": true, "signal": true,
"pagerduty": true, "opsgenie": true, "apprise": true, "nostr": true}
for _, tc := range cases {
tested[tc.typ] = true
}
for _, p := range Providers {
if !tested[p.Type] {
t.Errorf("%s has no test", p.Type)
}
}
}
// Services that answer 200 to failed requests are reported as failed.
func TestServicesReportRefusals(t *testing.T) {
var reply string
services(t, func(call) (int, string) { return http.StatusOK, reply })
for typ, tc := range map[string]struct {
cfg map[string]string
reply string
want string
}{
"dingtalk": {map[string]string{"webhook_url": "https://oapi.dingtalk.com/robot/send?access_token=x"}, `{"errcode":310000,"errmsg":"keywords not in content"}`, "keywords not in content"},
"vk": {map[string]string{"access_token": "x", "peer_id": "1"}, `{"error":{"error_code":5,"error_msg":"User authorization failed"}}`, "User authorization failed"},
"clicksend": {map[string]string{"username": "u", "api_key": "k", "phone_number": "1"}, `{"data":{"messages":[{"status":"INVALID_RECIPIENT"}]}}`, "INVALID_RECIPIENT"},
"cellsynt": {map[string]string{"username": "u", "password": "p", "phone_number": "1", "sender": "x"}, "Error: Invalid username", "Invalid username"},
"wxpusher": {map[string]string{"spt": "x"}, `{"code":1001,"msg":"spt invalid"}`, "spt invalid"},
} {
reply = tc.reply
p, _ := Lookup(typ)
if err := p.Send(context.Background(), tc.cfg, testOpened, true); err == nil || !strings.Contains(err.Error(), tc.want) {
t.Errorf("%s: err = %v, want %q", typ, err, tc.want)
}
}
}
func TestNostr(t *testing.T) {
senderSK, recipientSK := nostr.GeneratePrivateKey(), nostr.GeneratePrivateKey()
nsec, _ := nip19.EncodePrivateKey(senderSK)
recipientPub, _ := nostr.GetPublicKey(recipientSK)
npub, _ := nip19.EncodePublicKey(recipientPub)
got := make(chan nostr.Event, 1)
relay := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
conn, err := websocket.Accept(w, r, nil)
if err != nil {
return
}
defer func() { _ = conn.CloseNow() }()
_, data, err := conn.Read(r.Context())
if err != nil {
return
}
var msg []json.RawMessage
var e nostr.Event
if json.Unmarshal(data, &msg) != nil || len(msg) != 2 || json.Unmarshal(msg[1], &e) != nil {
return
}
ok, _ := e.CheckSignature()
reply, _ := json.Marshal([]any{"OK", e.ID, ok, ""})
_ = conn.Write(r.Context(), websocket.MessageText, reply)
got <- e
_, _, _ = conn.Read(r.Context())
}))
t.Cleanup(relay.Close)
services(t, func(call) (int, string) { return http.StatusNotFound, "" })
old := transport
transport = func(*net.Dialer) http.RoundTripper { return http.DefaultTransport }
t.Cleanup(func() { transport = old })
p, _ := Lookup("nostr")
cfg := map[string]string{"sender_nsec": nsec, "recipients": npub, "relays": "ws://" + strings.TrimPrefix(relay.URL, "http://")}
if err := p.Send(context.Background(), cfg, testOpened, true); err != nil {
t.Fatalf("Send: %v", err)
}
wrap := <-got
if wrap.Kind != nostr.KindGiftWrap {
t.Fatalf("kind = %d, want gift wrap", wrap.Kind)
}
rumor, err := nip59.GiftUnwrap(wrap, func(otherPub, ciphertext string) (string, error) {
key, err := nip44.GenerateConversationKey(otherPub, recipientSK)
if err != nil {
return "", err
}
return nip44.Decrypt(ciphertext, key)
})
if err != nil || !strings.Contains(rumor.Content, "Shop is down") || rumor.Kind != nostr.KindDirectMessage {
t.Errorf("unwrapped = %+v, %v", rumor, err)
}
cfg["sender_nsec"] = npub
if err := p.Send(context.Background(), cfg, testOpened, true); err == nil {
t.Error("a public key accepted as sender")
}
}
+413
View File
@@ -0,0 +1,413 @@
package notify
import (
"context"
"crypto/hmac"
"crypto/sha1" //nolint:gosec // Alibaba Cloud's API signature is HMAC-SHA1
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/url"
"sort"
"strings"
"time"
"github.com/google/uuid"
)
// SMS gateways and phone calls. Messages are cut to what several SMS
// parts hold.
func (m Message) sms() string { return truncate(m.text(), 600) }
// ascii drops characters GSM gateways without Unicode support reject.
func ascii(s string) string {
return strings.Map(func(r rune) rune {
if r > 127 {
return -1
}
return r
}, s)
}
func senderField(required bool) Field { return text("sender", required) }
var smsProviders = []Provider{
{Type: "elks46", Group: "sms", Fields: []Field{text("username", true), secret("auth_token", true), senderField(true), text("phone_number", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
_, err := c.form(ctx, "https://api.46elks.com/a1/sms", basic(cfg["username"], cfg["auth_token"]),
url.Values{"from": {cfg["sender"]}, "to": {cfg["phone_number"]}, "message": {m.sms()}})
return err
}},
{Type: "aliyunsms", Group: "sms", Fields: []Field{
text("access_key_id", true), secret("access_key_secret", true), text("sign_name", true), text("template_code", true), text("phone_number", true),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// The template receives name, time, status and msg.
param, _ := json.Marshal(map[string]string{
"name": m.Monitor, "time": time.Now().UTC().Format(time.DateTime), "status": strings.ToUpper(m.status()), "msg": truncate(m.Body, 100),
})
v := url.Values{
"PhoneNumbers": {cfg["phone_number"]}, "TemplateCode": {cfg["template_code"]}, "SignName": {cfg["sign_name"]},
"TemplateParam": {string(param)}, "AccessKeyId": {cfg["access_key_id"]}, "Format": {"JSON"},
"SignatureMethod": {"HMAC-SHA1"}, "SignatureVersion": {"1.0"}, "SignatureNonce": {uuid.NewString()},
"Timestamp": {time.Now().UTC().Format("2006-01-02T15:04:05Z")}, "Action": {"SendSms"}, "Version": {"2017-05-25"},
}
v.Set("Signature", aliyunSign(v, cfg["access_key_secret"]))
reply, err := c.form(ctx, "https://dysmsapi.aliyuncs.com/", nil, v)
return replyCheck(reply, err, func(r map[string]any) string {
if str(r["Code"]) != "OK" {
return "Alibaba Cloud SMS: " + str(r["Message"])
}
return ""
})
}},
{Type: "amootsms", Group: "sms", Fields: []Field{secret("api_token", true), text("line_number", true), text("phone_numbers", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
reply, err := c.form(ctx, "https://portal.amootsms.com/rest/SendSimple", http.Header{"Authorization": {cfg["api_token"]}}, url.Values{
"SendDateTime": {time.Now().In(tehran()).Format(time.DateTime)}, "SMSMessageText": {m.sms()},
"LineNumber": {cfg["line_number"]}, "Mobiles": {strings.Join(list(cfg["phone_numbers"]), ",")},
})
return replyCheck(reply, err, func(v map[string]any) string {
if s := str(v["Status"]); s != "" && s != "Success" {
return "Amoot SMS: " + s + " " + str(v["ErrorMessage"])
}
return ""
})
}},
{Type: "bearsms", Group: "sms", Fields: []Field{text("username", true), secret("hash_key", true), text("phone_number", true), senderField(false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
msg := m.sms()
q := url.Values{"app": {"ws"}, "u": {cfg["username"]}, "h": {cfg["hash_key"]}, "op": {"pv"}, "to": {cfg["phone_number"]}, "msg": {msg}}
if cfg["sender"] != "" {
q.Set("from", cfg["sender"])
}
if ascii(msg) != msg {
q.Set("unicode", "1")
}
reply, err := c.get(ctx, "https://app.bearsms.com/index.php", nil, q)
return replyCheck(reply, err, func(v map[string]any) string {
if str(v["status"]) == "ERR" || str(v["error_string"]) != "" {
return "BearSMS: " + or(str(v["error_string"]), "failed")
}
return ""
})
}},
{Type: "cellsynt", Group: "sms", Fields: []Field{
text("username", true), secret("password", true), text("phone_number", true),
{Name: "originator_type", Kind: "select", Options: []string{"alpha", "numeric"}, Default: "alpha"}, senderField(true),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
q := url.Values{
"username": {cfg["username"]}, "password": {cfg["password"]}, "destination": {cfg["phone_number"]},
"text": {ascii(m.sms())}, "originatortype": {or(cfg["originator_type"], "alpha")}, "originator": {cfg["sender"]}, "allowconcat": {"6"},
}
reply, err := c.call(ctx, http.MethodPost, "https://se-1.cellsynt.net/sms.php?"+q.Encode(), nil, nil)
if err == nil && strings.Contains(string(reply), "Error:") {
return errors.New("Cellsynt: " + strings.TrimSpace(strings.ReplaceAll(string(reply), "Error:", "")))
}
return err
}},
{Type: "clicksend", Group: "sms", Fields: []Field{text("username", true), secret("api_key", true), text("phone_number", true), senderField(false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
reply, err := c.callJSON(ctx, http.MethodPost, "https://rest.clicksend.com/v3/sms/send", basic(cfg["username"], cfg["api_key"]), map[string]any{
"messages": []map[string]any{{"body": ascii(m.sms()), "to": cfg["phone_number"], "source": "uptimesebi", "from": cfg["sender"]}},
})
return replyCheck(reply, err, func(v map[string]any) string {
data, _ := v["data"].(map[string]any)
msgs, _ := data["messages"].([]any)
if len(msgs) > 0 {
if st := str(msgs[0].(map[string]any)["status"]); st != "SUCCESS" {
return "ClickSend: " + st
}
}
return ""
})
}},
{Type: "egosms", Group: "sms", Fields: []Field{text("username", true), secret("password", true), text("phone_number", true), senderField(false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
_, err := c.get(ctx, "https://www.egosms.co/api/v1/plain/", nil, url.Values{
"number": {cfg["phone_number"]}, "message": {m.sms()}, "username": {cfg["username"]},
"password": {cfg["password"]}, "sender": {or(cfg["sender"], "EGOSMS")}, "priority": {"0"},
})
return err
}},
{Type: "freemobile", Group: "sms", Fields: []Field{text("username", true), secret("password", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// Free Mobile texts the account's own number.
return c.json(ctx, http.MethodPost, "https://smsapi.free-mobile.fr/sendmsg?msg="+url.QueryEscape(m.sms()), nil,
map[string]any{"user": cfg["username"], "pass": cfg["password"]})
}},
{Type: "gtxmessaging", Group: "sms", Fields: []Field{secret("api_key", true), senderField(true), text("phone_number", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
_, err := c.form(ctx, "https://rest.gtx-messaging.net/smsc/sendsms/"+url.PathEscape(cfg["api_key"])+"/json", nil,
url.Values{"from": {cfg["sender"]}, "to": {cfg["phone_number"]}, "text": {m.sms()}})
return err
}},
{Type: "octopush", Group: "sms", Fields: []Field{
text("username", true), secret("api_key", true), text("phone_number", true),
{Name: "sms_type", Kind: "select", Options: []string{"sms_premium", "sms_low_cost"}, Default: "sms_premium"}, senderField(false),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
h := http.Header{"api-key": {cfg["api_key"]}, "api-login": {cfg["username"]}}
return c.json(ctx, http.MethodPost, "https://api.octopush.com/v1/public/sms-campaign/send", h, map[string]any{
"recipients": []map[string]any{{"phone_number": cfg["phone_number"]}}, "text": ascii(m.sms()),
"type": or(cfg["sms_type"], "sms_premium"), "purpose": "alert", "sender": cfg["sender"],
})
}},
{Type: "ooredoo", Group: "sms", Fields: []Field{
text("username", true), secret("access_key", true), secret("api_token", true), text("phone_numbers", true),
urlField("api_url", false, "https://o-papi1-lb01.ooredoo.mv/bulk_sms/v2"),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
numbers := list(strings.ReplaceAll(cfg["phone_numbers"], " ", ","))
for i := 0; i < len(numbers); i += 20 {
reply, err := c.form(ctx, or(cfg["api_url"], "https://o-papi1-lb01.ooredoo.mv/bulk_sms/v2"), bearer(cfg["api_token"]), url.Values{
"username": {cfg["username"]}, "access_key": {base64.StdEncoding.EncodeToString([]byte(cfg["access_key"]))},
"message": {m.sms()}, "batch": {strings.Join(numbers[i:min(i+20, len(numbers))], " ")},
})
if err := replyCheck(reply, err, func(v map[string]any) string {
if str(v["response_code"]) != "0" {
return "Ooredoo: " + or(str(v["response_message"]), "rejected")
}
return ""
}); err != nil {
return err
}
}
return nil
}},
{Type: "plivo", Group: "sms", Fields: []Field{
text("auth_id", true), secret("auth_token", true), senderField(true), text("phone_number", true),
{Name: "message_type", Kind: "select", Options: []string{"sms", "call"}, Default: "sms"}, urlField("answer_url", false, ""),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
base := "https://api.plivo.com/v1/Account/" + url.PathEscape(cfg["auth_id"])
h := basic(cfg["auth_id"], cfg["auth_token"])
if cfg["message_type"] == "call" {
// The answer URL returns Plivo XML that reads the message out.
answer, err := url.Parse(cfg["answer_url"])
if err != nil || cfg["answer_url"] == "" {
return errors.New("calls need an answer URL")
}
q := answer.Query()
q.Set("message", m.Title)
answer.RawQuery = q.Encode()
return c.json(ctx, http.MethodPost, base+"/Call/", h, map[string]any{
"from": cfg["sender"], "to": cfg["phone_number"], "answer_url": answer.String(), "answer_method": "GET",
})
}
return c.json(ctx, http.MethodPost, base+"/Message/", h, map[string]any{"src": cfg["sender"], "dst": cfg["phone_number"], "text": m.sms()})
}},
{Type: "promosms", Group: "sms", Fields: []Field{
text("username", true), secret("password", true), text("phone_number", true),
{Name: "sms_type", Kind: "select", Options: []string{"1", "3", "4", "0"}, Default: "1"}, senderField(false),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
typ := 1
_, _ = fmt.Sscan(cfg["sms_type"], &typ)
reply, err := c.callJSON(ctx, http.MethodPost, "https://promosms.com/api/rest/v3_2/sms", basic(cfg["username"], cfg["password"]), map[string]any{
"recipients": []string{cfg["phone_number"]}, "text": truncate(ascii(m.sms()), 639), "long-sms": true, "type": typ, "sender": cfg["sender"],
})
return replyCheck(reply, err, func(v map[string]any) string {
resp, _ := v["response"].(map[string]any)
if st := str(resp["status"]); st != "0" {
return "PromoSMS: status " + st
}
return ""
})
}},
{Type: "serwersms", Group: "sms", Fields: []Field{text("username", true), secret("password", true), text("phone_number", true), senderField(false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
reply, err := c.callJSON(ctx, http.MethodPost, "https://api2.serwersms.pl/messages/send_sms", nil, map[string]any{
"username": cfg["username"], "password": cfg["password"], "text": ascii(m.sms()), "sender": cfg["sender"], "phone": cfg["phone_number"],
})
return replyCheck(reply, err, func(v map[string]any) string {
if v["success"] != true {
e, _ := v["error"].(map[string]any)
return "SerwerSMS: " + or(str(e["message"]), "failed")
}
return ""
})
}},
{Type: "sevenio", Group: "sms", Fields: []Field{secret("api_key", true), text("phone_number", true), senderField(false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
return c.json(ctx, http.MethodPost, "https://gateway.seven.io/api/sms", http.Header{"X-API-Key": {cfg["api_key"]}},
map[string]any{"to": cfg["phone_number"], "from": or(cfg["sender"], "UptimeSebi"), "text": m.sms()})
}},
{Type: "smsgateway", Group: "sms", Fields: []Field{urlField("api_url", true, ""), secret("api_key", true), text("phone_numbers", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// SMS Gateway for Android.
for _, to := range list(cfg["phone_numbers"]) {
reply, err := c.callJSON(ctx, http.MethodPost, trimURL(cfg["api_url"])+"/api/v1/sms/send", http.Header{"X-API-Key": {cfg["api_key"]}},
map[string]any{"to": to, "body": m.sms()})
if err := replyCheck(reply, err, func(v map[string]any) string {
if str(v["status"]) == "failed" {
return to + ": " + or(str(v["message"]), "failed")
}
return ""
}); err != nil {
return err
}
}
return nil
}},
{Type: "smsplanet", Group: "sms", Fields: []Field{secret("api_token", true), senderField(true), text("phone_numbers", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
reply, err := c.form(ctx, "https://api2.smsplanet.pl/sms", bearer(cfg["api_token"]),
url.Values{"from": {cfg["sender"]}, "to": {cfg["phone_numbers"]}, "msg": {m.sms()}})
return replyCheck(reply, err, func(v map[string]any) string {
if str(v["messageId"]) == "" {
return "SMSPlanet: " + or(str(v["errorMsg"]), "no message ID")
}
return ""
})
}},
{Type: "smsc", Group: "sms", Fields: []Field{text("username", true), secret("password", true), text("phone_number", true), senderField(false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
q := url.Values{"fmt": {"3"}, "translit": {"0"}, "login": {cfg["username"]}, "psw": {cfg["password"]},
"phones": {cfg["phone_number"]}, "mes": {ascii(m.sms())}}
if cfg["sender"] != "" {
q.Set("sender", cfg["sender"])
}
reply, err := c.get(ctx, "https://smsc.kz/sys/send.php", nil, q)
return replyCheck(reply, err, func(v map[string]any) string {
if v["id"] == nil {
return fmt.Sprintf("SMSC: %s (%s)", str(v["error"]), str(v["error_code"]))
}
return ""
})
}},
{Type: "smseagle", Group: "sms", Fields: []Field{
urlField("api_url", true, ""), secret("access_token", true), text("phone_numbers", true),
{Name: "api_version", Kind: "select", Options: []string{"2", "1"}, Default: "2"},
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
base := trimURL(cfg["api_url"])
if cfg["api_version"] == "1" {
reply, err := c.get(ctx, base+"/http_api/send_sms", nil, url.Values{
"access_token": {cfg["access_token"]}, "to": {strings.Join(list(cfg["phone_numbers"]), ",")}, "message": {m.sms()}, "unicode": {"1"},
})
if err == nil && !strings.Contains(string(reply), "OK") {
return errors.New("SMSEagle: " + truncate(string(reply), 200))
}
return err
}
return c.json(ctx, http.MethodPost, base+"/api/v2/messages/sms", http.Header{"access-token": {cfg["access_token"]}},
map[string]any{"to": list(cfg["phone_numbers"]), "text": m.sms(), "encoding": "unicode"})
}},
{Type: "smsir", Group: "sms", Fields: []Field{secret("api_key", true), text("template_id", true), text("phone_numbers", true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// sms.ir verify templates take one parameter, uptkumaalert, of
// at most 20 characters.
var template int
_, _ = fmt.Sscan(cfg["template_id"], &template)
msg := truncate(strings.ReplaceAll(m.Monitor+" "+m.status(), " ", ""), 20)
for _, mobile := range list(cfg["phone_numbers"]) {
if len(mobile) == 11 && strings.HasPrefix(mobile, "09") {
mobile = mobile[1:]
}
if err := c.json(ctx, http.MethodPost, "https://api.sms.ir/v1/send/verify", http.Header{"X-API-Key": {cfg["api_key"]}}, map[string]any{
"mobile": mobile, "templateId": template, "parameters": []map[string]any{{"name": "uptkumaalert", "value": msg}},
}); err != nil {
return err
}
}
return nil
}},
{Type: "smsmanager", Group: "sms", Fields: []Field{
secret("api_key", true), text("phone_numbers", true),
{Name: "gateway", Kind: "select", Options: []string{"high", "economy"}, Default: "high"},
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
_, err := c.get(ctx, "https://http-api.smsmanager.cz/Send", nil, url.Values{
"apikey": {cfg["api_key"]}, "message": {ascii(m.sms())}, "number": {cfg["phone_numbers"]}, "gateway": {or(cfg["gateway"], "high")},
})
return err
}},
{Type: "smspartner", Group: "sms", Fields: []Field{secret("api_key", true), text("phone_numbers", true), senderField(true)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
reply, err := c.callJSON(ctx, http.MethodPost, "https://api.smspartner.fr/v1/send", nil, map[string]any{
"apiKey": cfg["api_key"], "sender": truncate(cfg["sender"], 11), "phoneNumbers": cfg["phone_numbers"], "message": truncate(ascii(m.sms()), 639),
})
return replyCheck(reply, err, func(v map[string]any) string {
if v["success"] != true {
return "SMSPartner: " + str(v["message"])
}
return ""
})
}},
{Type: "telnyx", Group: "sms", Fields: []Field{secret("api_key", true), senderField(true), text("phone_number", true), text("messaging_profile_id", false)},
send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
body := map[string]any{"from": cfg["sender"], "to": cfg["phone_number"], "text": m.sms()}
if cfg["messaging_profile_id"] != "" {
body["messaging_profile_id"] = cfg["messaging_profile_id"]
}
return c.json(ctx, http.MethodPost, "https://api.telnyx.com/v2/messages", bearer(cfg["api_key"]), body)
}},
{Type: "teltonika", Group: "sms", Fields: []Field{
urlField("server_url", true, ""), text("username", true), secret("password", true), text("modem", true), text("phone_number", true),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// Teltonika routers (RutOS): sign in, then send through a modem.
u, err := url.Parse(cfg["server_url"])
if err != nil {
return err
}
base := u.Scheme + "://" + u.Host
reply, err := c.callJSON(ctx, http.MethodPost, base+"/api/login", nil, map[string]any{"username": cfg["username"], "password": cfg["password"]})
var login struct {
Success bool `json:"success"`
Data struct {
Token string `json:"token"`
} `json:"data"`
}
if err != nil || json.Unmarshal(reply, &login) != nil || !login.Success {
return errors.Join(errors.New("Teltonika: sign-in failed"), err)
}
reply, err = c.callJSON(ctx, http.MethodPost, base+"/api/messages/actions/send", bearer(login.Data.Token), map[string]any{
"data": map[string]any{"modem": cfg["modem"], "number": cfg["phone_number"], "message": truncate(m.sms(), 159)},
})
return replyCheck(reply, err, func(v map[string]any) string {
if v["success"] != true {
return "Teltonika: " + str(v["errors"])
}
return ""
})
}},
{Type: "twilio", Group: "sms", Fields: []Field{
text("account_sid", true), secret("auth_token", true), text("api_key", false), senderField(false), text("phone_number", true),
text("messaging_service_sid", false),
}, send: func(ctx context.Context, c *client, cfg map[string]string, m Message) error {
// With an API key, the token is that key's secret.
v := url.Values{"To": {cfg["phone_number"]}, "Body": {m.sms()}}
if cfg["sender"] != "" {
v.Set("From", cfg["sender"])
}
if cfg["messaging_service_sid"] != "" {
v.Set("MessagingServiceSid", cfg["messaging_service_sid"])
}
_, err := c.form(ctx, "https://api.twilio.com/2010-04-01/Accounts/"+url.PathEscape(cfg["account_sid"])+"/Messages.json",
basic(or(cfg["api_key"], cfg["account_sid"]), cfg["auth_token"]), v)
return err
}},
}
// aliyunSign signs Alibaba Cloud RPC parameters (signature version 1.0).
func aliyunSign(v url.Values, secret string) string {
keys := make([]string, 0, len(v))
for k := range v {
keys = append(keys, k)
}
sort.Strings(keys)
enc := func(s string) string {
return strings.NewReplacer("+", "%20", "*", "%2A", "%7E", "~").Replace(url.QueryEscape(s))
}
pairs := make([]string, len(keys))
for i, k := range keys {
pairs[i] = enc(k) + "=" + enc(v.Get(k))
}
mac := hmac.New(sha1.New, []byte(secret+"&"))
mac.Write([]byte("POST&" + enc("/") + "&" + enc(strings.Join(pairs, "&"))))
return base64.StdEncoding.EncodeToString(mac.Sum(nil))
}
func tehran() *time.Location {
if l, err := time.LoadLocation("Asia/Tehran"); err == nil {
return l
}
return time.FixedZone("IRST", 3*3600+1800)
}
+21 -2
View File
@@ -1,6 +1,7 @@
package web package web
import ( import (
"slices"
"context" "context"
"strconv" "strconv"
"strings" "strings"
@@ -956,8 +957,14 @@ templ ChannelsPage(p Page, me Me, v ChannelsView) {
<label class="mb-4 block"> <label class="mb-4 block">
<span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "channels.service") }</span> <span class="mb-1 block text-xs font-medium uppercase tracking-wider text-muted">{ i18n.T(ctx, "channels.service") }</span>
<select name="type" data-type-select class="w-full border border-rule bg-transparent px-2 py-1.5 text-sm"> <select name="type" data-type-select class="w-full border border-rule bg-transparent px-2 py-1.5 text-sm">
for _, pr := range v.Providers { for _, g := range providerGroups(v.Providers) {
<option value={ pr.Type }>{ i18n.T(ctx, "channels.type_"+pr.Type) }</option> <optgroup label={ i18n.T(ctx, "channels.group_"+g) }>
for _, pr := range v.Providers {
if pr.Group == g {
<option value={ pr.Type }>{ i18n.T(ctx, "channels.type_"+pr.Type) }</option>
}
}
</optgroup>
} }
</select> </select>
</label> </label>
@@ -994,6 +1001,7 @@ templ ChannelsPage(p Page, me Me, v ChannelsView) {
// ProviderOption is a notification service the form offers. // ProviderOption is a notification service the form offers.
type ProviderOption struct { type ProviderOption struct {
Type string Type string
Group string
Help string Help string
Fields []ProviderField Fields []ProviderField
} }
@@ -1232,3 +1240,14 @@ func condKey(c string) string {
} }
return c return c
} }
// providerGroups lists the groups of providers in the order they come.
func providerGroups(ps []ProviderOption) []string {
var out []string
for _, p := range ps {
if !slices.Contains(out, p.Group) {
out = append(out, p.Group)
}
}
return out
}
File diff suppressed because it is too large. Load diff