mirror of
https://github.com/usual2970/certimate.git
synced 2025-08-17 06:41:45 +00:00
go.modgo.sum
internal
domain
notify
pkg
core
deployer
providers
webhook
notifier
providers
bark
dingtalkbot
gotify
larkbot
mattermost
pushover
pushplus
serverchan
telegrambot
webhook
wecombot
sdk3rd
1panel
baishan
btpanel
bunny
cachefly
cdnfly
dnsla
edgio
edgio-api@v0.0.0-workspace
applications
gname
goedge
netlify
rainyun
safeline
upyun
wangsu
openapi
ui/src
components
access
workflow
domain
i18n
10
go.mod
10
go.mod
@@ -30,8 +30,10 @@ require (
|
|||||||
github.com/aws/aws-sdk-go-v2/service/acm v1.32.0
|
github.com/aws/aws-sdk-go-v2/service/acm v1.32.0
|
||||||
github.com/aws/aws-sdk-go-v2/service/cloudfront v1.46.1
|
github.com/aws/aws-sdk-go-v2/service/cloudfront v1.46.1
|
||||||
github.com/baidubce/bce-sdk-go v0.9.226
|
github.com/baidubce/bce-sdk-go v0.9.226
|
||||||
|
github.com/blinkbean/dingtalk v1.1.3
|
||||||
github.com/byteplus-sdk/byteplus-sdk-golang v1.0.46
|
github.com/byteplus-sdk/byteplus-sdk-golang v1.0.46
|
||||||
github.com/go-acme/lego/v4 v4.23.1
|
github.com/go-acme/lego/v4 v4.23.1
|
||||||
|
github.com/go-lark/lark v1.16.0
|
||||||
github.com/go-resty/resty/v2 v2.16.5
|
github.com/go-resty/resty/v2 v2.16.5
|
||||||
github.com/go-viper/mapstructure/v2 v2.2.1
|
github.com/go-viper/mapstructure/v2 v2.2.1
|
||||||
github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.148
|
github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.148
|
||||||
@@ -39,7 +41,6 @@ require (
|
|||||||
github.com/libdns/dynv6 v1.0.0
|
github.com/libdns/dynv6 v1.0.0
|
||||||
github.com/libdns/libdns v0.2.3
|
github.com/libdns/libdns v0.2.3
|
||||||
github.com/luthermonson/go-proxmox v0.2.2
|
github.com/luthermonson/go-proxmox v0.2.2
|
||||||
github.com/nikoksr/notify v1.3.0
|
|
||||||
github.com/pavlo-v-chernykh/keystore-go/v4 v4.5.0
|
github.com/pavlo-v-chernykh/keystore-go/v4 v4.5.0
|
||||||
github.com/pkg/sftp v1.13.9
|
github.com/pkg/sftp v1.13.9
|
||||||
github.com/pocketbase/dbx v1.11.0
|
github.com/pocketbase/dbx v1.11.0
|
||||||
@@ -84,13 +85,11 @@ require (
|
|||||||
github.com/alibabacloud-go/tea-utils/v2 v2.0.7 // indirect
|
github.com/alibabacloud-go/tea-utils/v2 v2.0.7 // indirect
|
||||||
github.com/avast/retry-go v3.0.0+incompatible // indirect
|
github.com/avast/retry-go v3.0.0+incompatible // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/route53 v1.50.0 // indirect
|
github.com/aws/aws-sdk-go-v2/service/route53 v1.50.0 // indirect
|
||||||
github.com/blinkbean/dingtalk v1.1.3 // indirect
|
|
||||||
github.com/buger/goterm v1.0.4 // indirect
|
github.com/buger/goterm v1.0.4 // indirect
|
||||||
github.com/diskfs/go-diskfs v1.5.0 // indirect
|
github.com/diskfs/go-diskfs v1.5.0 // indirect
|
||||||
github.com/djherbis/times v1.6.0 // indirect
|
github.com/djherbis/times v1.6.0 // indirect
|
||||||
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
|
github.com/emicklei/go-restful/v3 v3.12.1 // indirect
|
||||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
||||||
github.com/go-lark/lark v1.15.1 // indirect
|
|
||||||
github.com/go-logr/logr v1.4.2 // indirect
|
github.com/go-logr/logr v1.4.2 // indirect
|
||||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||||
@@ -99,7 +98,6 @@ require (
|
|||||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
github.com/go-playground/validator/v10 v10.16.0 // indirect
|
github.com/go-playground/validator/v10 v10.16.0 // indirect
|
||||||
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
github.com/go-sql-driver/mysql v1.8.1 // indirect
|
||||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible // indirect
|
|
||||||
github.com/gofrs/uuid v4.4.0+incompatible // indirect
|
github.com/gofrs/uuid v4.4.0+incompatible // indirect
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
|
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
|
||||||
@@ -126,7 +124,6 @@ require (
|
|||||||
github.com/qiniu/x v1.10.5 // indirect
|
github.com/qiniu/x v1.10.5 // indirect
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||||
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af // indirect
|
github.com/sirupsen/logrus v1.9.4-0.20230606125235-dd1b4c2e81af // indirect
|
||||||
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
|
|
||||||
github.com/x448/float16 v0.8.4 // indirect
|
github.com/x448/float16 v0.8.4 // indirect
|
||||||
go.mongodb.org/mongo-driver v1.17.2 // indirect
|
go.mongodb.org/mongo-driver v1.17.2 // indirect
|
||||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
||||||
@@ -195,12 +192,9 @@ require (
|
|||||||
github.com/nrdcg/namesilo v0.2.1 // indirect
|
github.com/nrdcg/namesilo v0.2.1 // indirect
|
||||||
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
|
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
|
||||||
github.com/spf13/cast v1.8.0 // indirect
|
github.com/spf13/cast v1.8.0 // indirect
|
||||||
github.com/spf13/cobra v1.9.1 // indirect
|
github.com/spf13/cobra v1.9.1 // indirect
|
||||||
github.com/spf13/pflag v1.0.6 // indirect
|
github.com/spf13/pflag v1.0.6 // indirect
|
||||||
github.com/stretchr/objx v0.5.2 // indirect
|
|
||||||
github.com/stretchr/testify v1.10.0 // indirect
|
|
||||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.1128 // indirect
|
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.1128 // indirect
|
||||||
github.com/tjfoc/gmsm v1.4.1 // indirect
|
github.com/tjfoc/gmsm v1.4.1 // indirect
|
||||||
golang.org/x/image v0.27.0 // indirect
|
golang.org/x/image v0.27.0 // indirect
|
||||||
|
12
go.sum
12
go.sum
@@ -360,8 +360,8 @@ github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
|
|||||||
github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs=
|
github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs=
|
||||||
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
|
||||||
github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
|
github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
|
||||||
github.com/go-lark/lark v1.15.1 h1:fo6PQKBJht/71N9Zn3/xjknOYx0TmdVuP+VP8NrUCsI=
|
github.com/go-lark/lark v1.16.0 h1:U6BwkLM9wrZedSM7cIiMofganr8PCvJN+M75w2lf2Gg=
|
||||||
github.com/go-lark/lark v1.15.1/go.mod h1:6ltbSztPZRT6IaO9ZIQyVaY5pVp/KeMizDYtfZkU+vM=
|
github.com/go-lark/lark v1.16.0/go.mod h1:6ltbSztPZRT6IaO9ZIQyVaY5pVp/KeMizDYtfZkU+vM=
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||||
@@ -400,8 +400,6 @@ github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8Wd
|
|||||||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
|
||||||
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
|
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
|
||||||
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
|
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
|
||||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU=
|
|
||||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM=
|
|
||||||
github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=
|
github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM=
|
||||||
github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
|
github.com/go-test/deep v1.0.8/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
|
||||||
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
|
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
|
||||||
@@ -569,8 +567,6 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw
|
|||||||
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
|
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
|
||||||
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
|
||||||
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
|
||||||
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible h1:jdpOPRN1zP63Td1hDQbZW73xKmzDvZHzVdNYxhnTMDA=
|
|
||||||
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible/go.mod h1:1c7szIrayyPPB/987hsnvNzLushdWf4o/79s3P08L8A=
|
|
||||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
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/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||||
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
|
||||||
@@ -679,8 +675,6 @@ github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OS
|
|||||||
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
|
||||||
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
github.com/nikoksr/notify v1.3.0 h1:UxzfxzAYGQD9a5JYLBTVx0lFMxeHCke3rPCkfWdPgLs=
|
|
||||||
github.com/nikoksr/notify v1.3.0/go.mod h1:Xor2hMmkvrCfkCKvXGbcrESez4brac2zQjhd6U2BbeM=
|
|
||||||
github.com/nrdcg/bunny-go v0.0.0-20240207213615-dde5bf4577a3 h1:ouZ2JWDl8IW5k1qugYbmpbmW8hn85Ig6buSMBRlz3KI=
|
github.com/nrdcg/bunny-go v0.0.0-20240207213615-dde5bf4577a3 h1:ouZ2JWDl8IW5k1qugYbmpbmW8hn85Ig6buSMBRlz3KI=
|
||||||
github.com/nrdcg/bunny-go v0.0.0-20240207213615-dde5bf4577a3/go.mod h1:ZwadWt7mVhMHMbAQ1w8IhDqtWO3eWqWq72W7trnaiE8=
|
github.com/nrdcg/bunny-go v0.0.0-20240207213615-dde5bf4577a3/go.mod h1:ZwadWt7mVhMHMbAQ1w8IhDqtWO3eWqWq72W7trnaiE8=
|
||||||
github.com/nrdcg/desec v0.10.0 h1:qrEDiqnsvNU9QE7lXIXi/tIHAfyaFXKxF2/8/52O8uM=
|
github.com/nrdcg/desec v0.10.0 h1:qrEDiqnsvNU9QE7lXIXi/tIHAfyaFXKxF2/8/52O8uM=
|
||||||
@@ -830,8 +824,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
|
|||||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
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/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQDeX7m2XsSOlQEnM=
|
|
||||||
github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog=
|
|
||||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn v1.0.1155 h1:ildxJtjnqiKZxWDVKHT/ncIknGDijtg60MuFELON8bY=
|
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn v1.0.1155 h1:ildxJtjnqiKZxWDVKHT/ncIknGDijtg60MuFELON8bY=
|
||||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn v1.0.1155/go.mod h1:iLASpooTdyXtx642E5Ws7cfWENsp4/uZ/78TFoln7OI=
|
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cdn v1.0.1155/go.mod h1:iLASpooTdyXtx642E5Ws7cfWENsp4/uZ/78TFoln7OI=
|
||||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1161 h1:yGFg9/6j3NP10r9PfSWHfekuq4SwPyqblWnfISfKANo=
|
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.1161 h1:yGFg9/6j3NP10r9PfSWHfekuq4SwPyqblWnfISfKANo=
|
||||||
|
@@ -260,7 +260,7 @@ type AccessConfigForSSLCom struct {
|
|||||||
EabHmacKey string `json:"eabHmacKey"`
|
EabHmacKey string `json:"eabHmacKey"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AccessConfigForTelegram struct {
|
type AccessConfigForTelegramBot struct {
|
||||||
BotToken string `json:"botToken"`
|
BotToken string `json:"botToken"`
|
||||||
DefaultChatId int64 `json:"defaultChatId,omitempty"`
|
DefaultChatId int64 `json:"defaultChatId,omitempty"`
|
||||||
}
|
}
|
||||||
|
@@ -67,7 +67,7 @@ const (
|
|||||||
AccessProviderTypeSafeLine = AccessProviderType("safeline")
|
AccessProviderTypeSafeLine = AccessProviderType("safeline")
|
||||||
AccessProviderTypeSSH = AccessProviderType("ssh")
|
AccessProviderTypeSSH = AccessProviderType("ssh")
|
||||||
AccessProviderTypeSSLCOM = AccessProviderType("sslcom")
|
AccessProviderTypeSSLCOM = AccessProviderType("sslcom")
|
||||||
AccessProviderTypeTelegram = AccessProviderType("telegram")
|
AccessProviderTypeTelegramBot = AccessProviderType("telegrambot")
|
||||||
AccessProviderTypeTencentCloud = AccessProviderType("tencentcloud")
|
AccessProviderTypeTencentCloud = AccessProviderType("tencentcloud")
|
||||||
AccessProviderTypeUCloud = AccessProviderType("ucloud")
|
AccessProviderTypeUCloud = AccessProviderType("ucloud")
|
||||||
AccessProviderTypeUpyun = AccessProviderType("upyun")
|
AccessProviderTypeUpyun = AccessProviderType("upyun")
|
||||||
@@ -259,7 +259,7 @@ const (
|
|||||||
NotificationProviderTypeEmail = NotificationProviderType(AccessProviderTypeEmail)
|
NotificationProviderTypeEmail = NotificationProviderType(AccessProviderTypeEmail)
|
||||||
NotificationProviderTypeLarkBot = NotificationProviderType(AccessProviderTypeLarkBot)
|
NotificationProviderTypeLarkBot = NotificationProviderType(AccessProviderTypeLarkBot)
|
||||||
NotificationProviderTypeMattermost = NotificationProviderType(AccessProviderTypeMattermost)
|
NotificationProviderTypeMattermost = NotificationProviderType(AccessProviderTypeMattermost)
|
||||||
NotificationProviderTypeTelegram = NotificationProviderType(AccessProviderTypeTelegram)
|
NotificationProviderTypeTelegramBot = NotificationProviderType(AccessProviderTypeTelegramBot)
|
||||||
NotificationProviderTypeWebhook = NotificationProviderType(AccessProviderTypeWebhook)
|
NotificationProviderTypeWebhook = NotificationProviderType(AccessProviderTypeWebhook)
|
||||||
NotificationProviderTypeWeComBot = NotificationProviderType(AccessProviderTypeWeComBot)
|
NotificationProviderTypeWeComBot = NotificationProviderType(AccessProviderTypeWeComBot)
|
||||||
)
|
)
|
||||||
|
@@ -6,13 +6,13 @@ import (
|
|||||||
|
|
||||||
"github.com/usual2970/certimate/internal/domain"
|
"github.com/usual2970/certimate/internal/domain"
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
||||||
pDingTalk "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/dingtalk"
|
pDingTalkBot "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/dingtalkbot"
|
||||||
pEmail "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/email"
|
pEmail "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/email"
|
||||||
pLark "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/lark"
|
pLarkBot "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/larkbot"
|
||||||
pMattermost "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/mattermost"
|
pMattermost "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/mattermost"
|
||||||
pTelegram "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/telegram"
|
pTelegramBot "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/telegrambot"
|
||||||
pWebhook "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/webhook"
|
pWebhook "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/webhook"
|
||||||
pWeCom "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/wecom"
|
pWeComBot "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/wecombot"
|
||||||
httputil "github.com/usual2970/certimate/internal/pkg/utils/http"
|
httputil "github.com/usual2970/certimate/internal/pkg/utils/http"
|
||||||
maputil "github.com/usual2970/certimate/internal/pkg/utils/map"
|
maputil "github.com/usual2970/certimate/internal/pkg/utils/map"
|
||||||
)
|
)
|
||||||
@@ -36,7 +36,7 @@ func createNotifierProvider(options *notifierProviderOptions) (notifier.Notifier
|
|||||||
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
|
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pDingTalk.NewNotifier(&pDingTalk.NotifierConfig{
|
return pDingTalkBot.NewNotifier(&pDingTalkBot.NotifierConfig{
|
||||||
WebhookUrl: access.WebhookUrl,
|
WebhookUrl: access.WebhookUrl,
|
||||||
Secret: access.Secret,
|
Secret: access.Secret,
|
||||||
})
|
})
|
||||||
@@ -67,7 +67,7 @@ func createNotifierProvider(options *notifierProviderOptions) (notifier.Notifier
|
|||||||
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
|
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pLark.NewNotifier(&pLark.NotifierConfig{
|
return pLarkBot.NewNotifier(&pLarkBot.NotifierConfig{
|
||||||
WebhookUrl: access.WebhookUrl,
|
WebhookUrl: access.WebhookUrl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -87,14 +87,14 @@ func createNotifierProvider(options *notifierProviderOptions) (notifier.Notifier
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
case domain.NotificationProviderTypeTelegram:
|
case domain.NotificationProviderTypeTelegramBot:
|
||||||
{
|
{
|
||||||
access := domain.AccessConfigForTelegram{}
|
access := domain.AccessConfigForTelegramBot{}
|
||||||
if err := maputil.Populate(options.ProviderAccessConfig, &access); err != nil {
|
if err := maputil.Populate(options.ProviderAccessConfig, &access); err != nil {
|
||||||
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
|
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pTelegram.NewNotifier(&pTelegram.NotifierConfig{
|
return pTelegramBot.NewNotifier(&pTelegramBot.NotifierConfig{
|
||||||
BotToken: access.BotToken,
|
BotToken: access.BotToken,
|
||||||
ChatId: maputil.GetOrDefaultInt64(options.ProviderExtendedConfig, "chatId", access.DefaultChatId),
|
ChatId: maputil.GetOrDefaultInt64(options.ProviderExtendedConfig, "chatId", access.DefaultChatId),
|
||||||
})
|
})
|
||||||
@@ -143,7 +143,7 @@ func createNotifierProvider(options *notifierProviderOptions) (notifier.Notifier
|
|||||||
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
|
return nil, fmt.Errorf("failed to populate provider access config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pWeCom.NewNotifier(&pWeCom.NotifierConfig{
|
return pWeComBot.NewNotifier(&pWeComBot.NotifierConfig{
|
||||||
WebhookUrl: access.WebhookUrl,
|
WebhookUrl: access.WebhookUrl,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -6,17 +6,17 @@ import (
|
|||||||
"github.com/usual2970/certimate/internal/domain"
|
"github.com/usual2970/certimate/internal/domain"
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
||||||
pBark "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/bark"
|
pBark "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/bark"
|
||||||
pDingTalk "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/dingtalk"
|
pDingTalk "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/dingtalkbot"
|
||||||
pEmail "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/email"
|
pEmail "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/email"
|
||||||
pGotify "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/gotify"
|
pGotify "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/gotify"
|
||||||
pLark "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/lark"
|
pLark "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/larkbot"
|
||||||
pMattermost "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/mattermost"
|
pMattermost "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/mattermost"
|
||||||
pPushover "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/pushover"
|
pPushover "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/pushover"
|
||||||
pPushPlus "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/pushplus"
|
pPushPlus "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/pushplus"
|
||||||
pServerChan "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/serverchan"
|
pServerChan "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/serverchan"
|
||||||
pTelegram "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/telegram"
|
pTelegram "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/telegrambot"
|
||||||
pWebhook "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/webhook"
|
pWebhook "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/webhook"
|
||||||
pWeCom "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/wecom"
|
pWeCom "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/wecombot"
|
||||||
maputil "github.com/usual2970/certimate/internal/pkg/utils/map"
|
maputil "github.com/usual2970/certimate/internal/pkg/utils/map"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ func createNotifierProviderUseGlobalSettings(channel domain.NotifyChannelType, c
|
|||||||
|
|
||||||
case domain.NotifyChannelTypeGotify:
|
case domain.NotifyChannelTypeGotify:
|
||||||
return pGotify.NewNotifier(&pGotify.NotifierConfig{
|
return pGotify.NewNotifier(&pGotify.NotifierConfig{
|
||||||
Url: maputil.GetString(channelConfig, "url"),
|
ServerUrl: maputil.GetString(channelConfig, "url"),
|
||||||
Token: maputil.GetString(channelConfig, "token"),
|
Token: maputil.GetString(channelConfig, "token"),
|
||||||
Priority: maputil.GetOrDefaultInt64(channelConfig, "priority", 1),
|
Priority: maputil.GetOrDefaultInt64(channelConfig, "priority", 1),
|
||||||
})
|
})
|
||||||
@@ -83,7 +83,7 @@ func createNotifierProviderUseGlobalSettings(channel domain.NotifyChannelType, c
|
|||||||
|
|
||||||
case domain.NotifyChannelTypeServerChan:
|
case domain.NotifyChannelTypeServerChan:
|
||||||
return pServerChan.NewNotifier(&pServerChan.NotifierConfig{
|
return pServerChan.NewNotifier(&pServerChan.NotifierConfig{
|
||||||
Url: maputil.GetString(channelConfig, "url"),
|
ServerUrl: maputil.GetString(channelConfig, "url"),
|
||||||
})
|
})
|
||||||
|
|
||||||
case domain.NotifyChannelTypeTelegram:
|
case domain.NotifyChannelTypeTelegram:
|
||||||
|
@@ -159,9 +159,7 @@ func (d *DeployerProvider) Deploy(ctx context.Context, certPEM string, privkeyPE
|
|||||||
|
|
||||||
// 生成请求
|
// 生成请求
|
||||||
// 其中 GET 请求需转换为查询参数
|
// 其中 GET 请求需转换为查询参数
|
||||||
req := d.httpClient.R().
|
req := d.httpClient.R().SetHeaderMultiValues(webhookHeaders)
|
||||||
SetContext(ctx).
|
|
||||||
SetHeaderMultiValues(webhookHeaders)
|
|
||||||
req.URL = webhookUrl.String()
|
req.URL = webhookUrl.String()
|
||||||
req.Method = webhookMethod
|
req.Method = webhookMethod
|
||||||
if webhookMethod == http.MethodGet {
|
if webhookMethod == http.MethodGet {
|
||||||
|
@@ -2,10 +2,11 @@ package bark
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/nikoksr/notify"
|
"github.com/go-resty/resty/v2"
|
||||||
"github.com/nikoksr/notify/service/bark"
|
|
||||||
|
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
||||||
)
|
)
|
||||||
@@ -21,6 +22,7 @@ type NotifierConfig struct {
|
|||||||
type NotifierProvider struct {
|
type NotifierProvider struct {
|
||||||
config *NotifierConfig
|
config *NotifierConfig
|
||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
|
httpClient *resty.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
||||||
@@ -30,9 +32,12 @@ func NewNotifier(config *NotifierConfig) (*NotifierProvider, error) {
|
|||||||
panic("config is nil")
|
panic("config is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client := resty.New()
|
||||||
|
|
||||||
return &NotifierProvider{
|
return &NotifierProvider{
|
||||||
config: config,
|
config: config,
|
||||||
logger: slog.Default(),
|
logger: slog.Default(),
|
||||||
|
httpClient: client,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,16 +51,25 @@ func (n *NotifierProvider) WithLogger(logger *slog.Logger) notifier.Notifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
||||||
var srv notify.Notifier
|
const defaultServerURL = "https://api.day.app/"
|
||||||
if n.config.ServerUrl == "" {
|
serverUrl := defaultServerURL
|
||||||
srv = bark.New(n.config.DeviceKey)
|
if n.config.ServerUrl != "" {
|
||||||
} else {
|
serverUrl = n.config.ServerUrl
|
||||||
srv = bark.NewWithServers(n.config.DeviceKey, n.config.ServerUrl)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = srv.Send(ctx, subject, message)
|
// REF: https://bark.day.app/#/tutorial
|
||||||
|
req := n.httpClient.R().
|
||||||
|
SetHeader("Content-Type", "application/json").
|
||||||
|
SetBody(map[string]any{
|
||||||
|
"title": subject,
|
||||||
|
"body": message,
|
||||||
|
"device_key": n.config.DeviceKey,
|
||||||
|
})
|
||||||
|
resp, err := req.Execute(http.MethodPost, serverUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("bark api error: failed to send request: %w", err)
|
||||||
|
} else if resp.IsError() {
|
||||||
|
return nil, fmt.Errorf("bark api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return ¬ifier.NotifyResult{}, nil
|
return ¬ifier.NotifyResult{}, nil
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
package dingtalk
|
package dingtalkbot
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
"log/slog"
|
"log/slog"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github.com/nikoksr/notify/service/dingding"
|
"github.com/blinkbean/dingtalk"
|
||||||
|
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
||||||
)
|
)
|
||||||
@@ -48,17 +48,18 @@ func (n *NotifierProvider) WithLogger(logger *slog.Logger) notifier.Notifier {
|
|||||||
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
||||||
webhookUrl, err := url.Parse(n.config.WebhookUrl)
|
webhookUrl, err := url.Parse(n.config.WebhookUrl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid webhook url: %w", err)
|
return nil, fmt.Errorf("dingtalk api error: invalid webhook url: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
srv := dingding.New(&dingding.Config{
|
var bot *dingtalk.DingTalk
|
||||||
Token: webhookUrl.Query().Get("access_token"),
|
if n.config.Secret == "" {
|
||||||
Secret: n.config.Secret,
|
bot = dingtalk.InitDingTalk([]string{webhookUrl.Query().Get("access_token")}, "")
|
||||||
})
|
} else {
|
||||||
|
bot = dingtalk.InitDingTalkWithSecret(webhookUrl.Query().Get("access_token"), n.config.Secret)
|
||||||
|
}
|
||||||
|
|
||||||
err = srv.Send(ctx, subject, message)
|
if err := bot.SendTextMessage(subject + "\n" + message); err != nil {
|
||||||
if err != nil {
|
return nil, fmt.Errorf("dingtalk api error: %w", err)
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ¬ifier.NotifyResult{}, nil
|
return ¬ifier.NotifyResult{}, nil
|
@@ -1,4 +1,4 @@
|
|||||||
package dingtalk_test
|
package dingtalkbot_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
provider "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/dingtalk"
|
provider "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/dingtalkbot"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -16,22 +16,23 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
fAccessToken string
|
fWebhookUrl string
|
||||||
fSecret string
|
fSecret string
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
argsPrefix := "CERTIMATE_NOTIFIER_DINGTALK_"
|
argsPrefix := "CERTIMATE_NOTIFIER_DINGTALKBOT_"
|
||||||
|
|
||||||
flag.StringVar(&fAccessToken, argsPrefix+"ACCESSTOKEN", "", "")
|
flag.StringVar(&fWebhookUrl, argsPrefix+"WEBHOOKURL", "", "")
|
||||||
flag.StringVar(&fSecret, argsPrefix+"SECRET", "", "")
|
flag.StringVar(&fSecret, argsPrefix+"SECRET", "", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Shell command to run this test:
|
Shell command to run this test:
|
||||||
|
|
||||||
go test -v ./dingtalk_test.go -args \
|
go test -v ./dingtalkbot_test.go -args \
|
||||||
--CERTIMATE_NOTIFIER_DINGTALK_URL="https://example.com/your-webhook-url"
|
--CERTIMATE_NOTIFIER_DINGTALKBOT_WEBHOOKURL="https://example.com/your-webhook-url" \
|
||||||
|
--CERTIMATE_NOTIFIER_DINGTALKBOT_SECRET="your-secret"
|
||||||
*/
|
*/
|
||||||
func TestNotify(t *testing.T) {
|
func TestNotify(t *testing.T) {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
@@ -39,12 +40,12 @@ func TestNotify(t *testing.T) {
|
|||||||
t.Run("Notify", func(t *testing.T) {
|
t.Run("Notify", func(t *testing.T) {
|
||||||
t.Log(strings.Join([]string{
|
t.Log(strings.Join([]string{
|
||||||
"args:",
|
"args:",
|
||||||
fmt.Sprintf("ACCESSTOKEN: %v", fAccessToken),
|
fmt.Sprintf("WEBHOOKURL: %v", fWebhookUrl),
|
||||||
fmt.Sprintf("SECRET: %v", fSecret),
|
fmt.Sprintf("SECRET: %v", fSecret),
|
||||||
}, "\n"))
|
}, "\n"))
|
||||||
|
|
||||||
notifier, err := provider.NewNotifier(&provider.NotifierConfig{
|
notifier, err := provider.NewNotifier(&provider.NotifierConfig{
|
||||||
AccessToken: fAccessToken,
|
WebhookUrl: fWebhookUrl,
|
||||||
Secret: fSecret,
|
Secret: fSecret,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
@@ -1,20 +1,20 @@
|
|||||||
package gotify
|
package gotify
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/go-resty/resty/v2"
|
||||||
|
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NotifierConfig struct {
|
type NotifierConfig struct {
|
||||||
// Gotify 服务地址。
|
// Gotify 服务地址。
|
||||||
Url string `json:"url"`
|
ServerUrl string `json:"serverUrl"`
|
||||||
// Gotify Token。
|
// Gotify Token。
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
// Gotify 消息优先级。
|
// Gotify 消息优先级。
|
||||||
@@ -24,7 +24,7 @@ type NotifierConfig struct {
|
|||||||
type NotifierProvider struct {
|
type NotifierProvider struct {
|
||||||
config *NotifierConfig
|
config *NotifierConfig
|
||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
httpClient *http.Client
|
httpClient *resty.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
||||||
@@ -34,10 +34,12 @@ func NewNotifier(config *NotifierConfig) (*NotifierProvider, error) {
|
|||||||
panic("config is nil")
|
panic("config is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client := resty.New()
|
||||||
|
|
||||||
return &NotifierProvider{
|
return &NotifierProvider{
|
||||||
config: config,
|
config: config,
|
||||||
logger: slog.Default(),
|
logger: slog.Default(),
|
||||||
httpClient: http.DefaultClient,
|
httpClient: client,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,45 +53,22 @@ func (n *NotifierProvider) WithLogger(logger *slog.Logger) notifier.Notifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
||||||
reqBody := &struct {
|
serverUrl := strings.TrimRight(n.config.ServerUrl, "/")
|
||||||
Title string `json:"title"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
Priority int64 `json:"priority"`
|
|
||||||
}{
|
|
||||||
Title: subject,
|
|
||||||
Message: message,
|
|
||||||
Priority: n.config.Priority,
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err := json.Marshal(reqBody)
|
// REF: https://gotify.net/api-docs#/message/createMessage
|
||||||
if err != nil {
|
req := n.httpClient.R().
|
||||||
return nil, fmt.Errorf("gotify api error: failed to encode message body: %w", err)
|
SetHeader("Content-Type", "application/json").
|
||||||
}
|
SetHeader("Authorization", "Bearer "+n.config.Token).
|
||||||
|
SetBody(map[string]any{
|
||||||
req, err := http.NewRequestWithContext(
|
"title": subject,
|
||||||
ctx,
|
"message": message,
|
||||||
http.MethodPost,
|
"priority": n.config.Priority,
|
||||||
fmt.Sprintf("%s/message", n.config.Url),
|
})
|
||||||
bytes.NewReader(body),
|
resp, err := req.Execute(http.MethodPost, fmt.Sprintf("%s/message", serverUrl))
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("gotify api error: failed to create new request: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", n.config.Token))
|
|
||||||
req.Header.Set("Content-Type", "application/json; charset=utf-8")
|
|
||||||
|
|
||||||
resp, err := n.httpClient.Do(req)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("gotify api error: failed to send request: %w", err)
|
return nil, fmt.Errorf("gotify api error: failed to send request: %w", err)
|
||||||
}
|
} else if resp.IsError() {
|
||||||
defer resp.Body.Close()
|
return nil, fmt.Errorf("gotify api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
|
|
||||||
result, err := io.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("gotify api error: failed to read response: %w", err)
|
|
||||||
} else if resp.StatusCode != http.StatusOK {
|
|
||||||
return nil, fmt.Errorf("gotify api error: unexpected status code: %d, resp: %s", resp.StatusCode, string(result))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ¬ifier.NotifyResult{}, nil
|
return ¬ifier.NotifyResult{}, nil
|
||||||
|
@@ -48,7 +48,7 @@ func TestNotify(t *testing.T) {
|
|||||||
}, "\n"))
|
}, "\n"))
|
||||||
|
|
||||||
notifier, err := provider.NewNotifier(&provider.NotifierConfig{
|
notifier, err := provider.NewNotifier(&provider.NotifierConfig{
|
||||||
Url: fUrl,
|
ServerUrl: fUrl,
|
||||||
Token: fToken,
|
Token: fToken,
|
||||||
Priority: fPriority,
|
Priority: fPriority,
|
||||||
})
|
})
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
package lark
|
package larkbot
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
|
||||||
"github.com/nikoksr/notify/service/lark"
|
"github.com/go-lark/lark"
|
||||||
|
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
||||||
)
|
)
|
||||||
@@ -42,11 +43,17 @@ func (n *NotifierProvider) WithLogger(logger *slog.Logger) notifier.Notifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
||||||
srv := lark.NewWebhookService(n.config.WebhookUrl)
|
bot := lark.NewNotificationBot(n.config.WebhookUrl)
|
||||||
|
content := lark.NewPostBuilder().
|
||||||
err = srv.Send(ctx, subject, message)
|
Title(subject).
|
||||||
|
TextTag(message, 1, false).
|
||||||
|
Render()
|
||||||
|
msg := lark.NewMsgBuffer(lark.MsgPost).Post(content)
|
||||||
|
resp, err := bot.PostNotificationV2(msg.Build())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("lark api error: %w", err)
|
||||||
|
} else if resp.Code != 0 {
|
||||||
|
return nil, fmt.Errorf("lark api error: code='%d', message='%s'", resp.Code, resp.Msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ¬ifier.NotifyResult{}, nil
|
return ¬ifier.NotifyResult{}, nil
|
@@ -1,4 +1,4 @@
|
|||||||
package serverchan_test
|
package larkbot_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
provider "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/wecom"
|
provider "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/larkbot"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -18,7 +18,7 @@ const (
|
|||||||
var fWebhookUrl string
|
var fWebhookUrl string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
argsPrefix := "CERTIMATE_NOTIFIER_WECOM_"
|
argsPrefix := "CERTIMATE_NOTIFIER_LARKBOT_"
|
||||||
|
|
||||||
flag.StringVar(&fWebhookUrl, argsPrefix+"WEBHOOKURL", "", "")
|
flag.StringVar(&fWebhookUrl, argsPrefix+"WEBHOOKURL", "", "")
|
||||||
}
|
}
|
||||||
@@ -26,8 +26,8 @@ func init() {
|
|||||||
/*
|
/*
|
||||||
Shell command to run this test:
|
Shell command to run this test:
|
||||||
|
|
||||||
go test -v ./wecom_test.go -args \
|
go test -v ./larkbot_test.go -args \
|
||||||
--CERTIMATE_NOTIFIER_WECOM_WEBHOOKURL="https://example.com/your-webhook-url" \
|
--CERTIMATE_NOTIFIER_LARKBOT_WEBHOOKURL="https://example.com/your-webhook-url"
|
||||||
*/
|
*/
|
||||||
func TestNotify(t *testing.T) {
|
func TestNotify(t *testing.T) {
|
||||||
flag.Parse()
|
flag.Parse()
|
@@ -1,15 +1,14 @@
|
|||||||
package mattermost
|
package mattermost
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"fmt"
|
||||||
"io"
|
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/nikoksr/notify/service/mattermost"
|
"github.com/go-resty/resty/v2"
|
||||||
|
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -27,6 +26,7 @@ type NotifierConfig struct {
|
|||||||
type NotifierProvider struct {
|
type NotifierProvider struct {
|
||||||
config *NotifierConfig
|
config *NotifierConfig
|
||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
|
httpClient *resty.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
||||||
@@ -36,9 +36,12 @@ func NewNotifier(config *NotifierConfig) (*NotifierProvider, error) {
|
|||||||
panic("config is nil")
|
panic("config is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client := resty.New()
|
||||||
|
|
||||||
return &NotifierProvider{
|
return &NotifierProvider{
|
||||||
config: config,
|
config: config,
|
||||||
logger: slog.Default(),
|
logger: slog.Default(),
|
||||||
|
httpClient: client,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,17 +55,29 @@ func (n *NotifierProvider) WithLogger(logger *slog.Logger) notifier.Notifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
||||||
srv := mattermost.New(strings.TrimRight(n.config.ServerUrl, "/"))
|
serverUrl := strings.TrimRight(n.config.ServerUrl, "/")
|
||||||
|
|
||||||
if err := srv.LoginWithCredentials(ctx, n.config.Username, n.config.Password); err != nil {
|
// REF: https://developers.mattermost.com/api-documentation/#/operations/Login
|
||||||
return nil, err
|
loginReq := n.httpClient.R().
|
||||||
|
SetHeader("Content-Type", "application/json").
|
||||||
|
SetBody(map[string]any{
|
||||||
|
"login_id": n.config.Username,
|
||||||
|
"password": n.config.Password,
|
||||||
|
})
|
||||||
|
loginResp, err := loginReq.Execute(http.MethodPost, fmt.Sprintf("%s/api/v4/users/login", serverUrl))
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("mattermost api error: failed to send request: %w", err)
|
||||||
|
} else if loginResp.IsError() {
|
||||||
|
return nil, fmt.Errorf("mattermost api error: unexpected status code: %d, resp: %s", loginResp.StatusCode(), loginResp.String())
|
||||||
|
} else if loginResp.Header().Get("Token") == "" {
|
||||||
|
return nil, fmt.Errorf("mattermost api error: received empty login token")
|
||||||
}
|
}
|
||||||
|
|
||||||
srv.AddReceivers(n.config.ChannelId)
|
// REF: https://developers.mattermost.com/api-documentation/#/operations/CreatePost
|
||||||
|
postReq := n.httpClient.R().
|
||||||
// 复写消息样式
|
SetHeader("Content-Type", "application/json").
|
||||||
srv.PreSend(func(req *http.Request) error {
|
SetHeader("Authorization", "Bearer "+loginResp.Header().Get("Token")).
|
||||||
m := map[string]interface{}{
|
SetBody(map[string]any{
|
||||||
"channel_id": n.config.ChannelId,
|
"channel_id": n.config.ChannelId,
|
||||||
"props": map[string]interface{}{
|
"props": map[string]interface{}{
|
||||||
"attachments": []map[string]interface{}{
|
"attachments": []map[string]interface{}{
|
||||||
@@ -72,20 +87,12 @@ func (n *NotifierProvider) Notify(ctx context.Context, subject string, message s
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
|
|
||||||
if body, err := json.Marshal(m); err != nil {
|
|
||||||
return err
|
|
||||||
} else {
|
|
||||||
req.ContentLength = int64(len(body))
|
|
||||||
req.Body = io.NopCloser(bytes.NewReader(body))
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
})
|
||||||
|
postResp, err := postReq.Execute(http.MethodPost, fmt.Sprintf("%s/api/v4/posts", serverUrl))
|
||||||
if err = srv.Send(ctx, subject, message); err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("mattermost api error: failed to send request: %w", err)
|
||||||
|
} else if postResp.IsError() {
|
||||||
|
return nil, fmt.Errorf("mattermost api error: unexpected status code: %d, resp: %s", postResp.StatusCode(), postResp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return ¬ifier.NotifyResult{}, nil
|
return ¬ifier.NotifyResult{}, nil
|
||||||
|
@@ -1,14 +1,13 @@
|
|||||||
package pushover
|
package pushover
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/go-resty/resty/v2"
|
||||||
|
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,7 +21,7 @@ type NotifierConfig struct {
|
|||||||
type NotifierProvider struct {
|
type NotifierProvider struct {
|
||||||
config *NotifierConfig
|
config *NotifierConfig
|
||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
httpClient *http.Client
|
httpClient *resty.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
||||||
@@ -32,10 +31,12 @@ func NewNotifier(config *NotifierConfig) (*NotifierProvider, error) {
|
|||||||
panic("config is nil")
|
panic("config is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client := resty.New()
|
||||||
|
|
||||||
return &NotifierProvider{
|
return &NotifierProvider{
|
||||||
config: config,
|
config: config,
|
||||||
logger: slog.Default(),
|
logger: slog.Default(),
|
||||||
httpClient: http.DefaultClient,
|
httpClient: client,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,46 +51,19 @@ func (n *NotifierProvider) WithLogger(logger *slog.Logger) notifier.Notifier {
|
|||||||
|
|
||||||
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
||||||
// REF: https://pushover.net/api
|
// REF: https://pushover.net/api
|
||||||
reqBody := &struct {
|
req := n.httpClient.R().
|
||||||
Token string `json:"token"`
|
SetHeader("Content-Type", "application/json").
|
||||||
User string `json:"user"`
|
SetBody(map[string]any{
|
||||||
Title string `json:"title"`
|
"title": subject,
|
||||||
Message string `json:"message"`
|
"message": message,
|
||||||
}{
|
"token": n.config.Token,
|
||||||
Token: n.config.Token,
|
"user": n.config.User,
|
||||||
User: n.config.User,
|
})
|
||||||
Title: subject,
|
resp, err := req.Execute(http.MethodPost, "https://api.pushover.net/1/messages.json")
|
||||||
Message: message,
|
|
||||||
}
|
|
||||||
|
|
||||||
body, err := json.Marshal(reqBody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("pushover api error: failed to encode message body: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(
|
|
||||||
ctx,
|
|
||||||
http.MethodPost,
|
|
||||||
"https://api.pushover.net/1/messages.json",
|
|
||||||
bytes.NewReader(body),
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("pushover api error: failed to create new request: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
req.Header.Set("Content-Type", "application/json; charset=utf-8")
|
|
||||||
|
|
||||||
resp, err := n.httpClient.Do(req)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("pushover api error: failed to send request: %w", err)
|
return nil, fmt.Errorf("pushover api error: failed to send request: %w", err)
|
||||||
}
|
} else if resp.IsError() {
|
||||||
defer resp.Body.Close()
|
return nil, fmt.Errorf("pushover api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
|
|
||||||
result, err := io.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("pushover api error: failed to read response: %w", err)
|
|
||||||
} else if resp.StatusCode != http.StatusOK {
|
|
||||||
return nil, fmt.Errorf("pushover api error: unexpected status code: %d, resp: %s", resp.StatusCode, string(result))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ¬ifier.NotifyResult{}, nil
|
return ¬ifier.NotifyResult{}, nil
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
package pushplus
|
package pushplus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/go-resty/resty/v2"
|
||||||
|
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ type NotifierConfig struct {
|
|||||||
type NotifierProvider struct {
|
type NotifierProvider struct {
|
||||||
config *NotifierConfig
|
config *NotifierConfig
|
||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
httpClient *http.Client
|
httpClient *resty.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
||||||
@@ -30,10 +30,12 @@ func NewNotifier(config *NotifierConfig) (*NotifierProvider, error) {
|
|||||||
panic("config is nil")
|
panic("config is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client := resty.New()
|
||||||
|
|
||||||
return &NotifierProvider{
|
return &NotifierProvider{
|
||||||
config: config,
|
config: config,
|
||||||
logger: slog.Default(),
|
logger: slog.Default(),
|
||||||
httpClient: http.DefaultClient,
|
httpClient: client,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,55 +49,29 @@ func (n *NotifierProvider) WithLogger(logger *slog.Logger) notifier.Notifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
||||||
// REF: https://pushplus.plus/doc/guide/api.html
|
// REF: https://pushplus.plus/doc/guide/api.html#%E4%B8%80%E3%80%81%E5%8F%91%E9%80%81%E6%B6%88%E6%81%AF%E6%8E%A5%E5%8F%A3
|
||||||
reqBody := &struct {
|
req := n.httpClient.R().
|
||||||
Token string `json:"token"`
|
SetHeader("Content-Type", "application/json").
|
||||||
Title string `json:"title"`
|
SetBody(map[string]any{
|
||||||
Content string `json:"content"`
|
"title": subject,
|
||||||
}{
|
"content": message,
|
||||||
Token: n.config.Token,
|
"token": n.config.Token,
|
||||||
Title: subject,
|
})
|
||||||
Content: message,
|
resp, err := req.Execute(http.MethodPost, "https://www.pushplus.plus/send")
|
||||||
}
|
|
||||||
|
|
||||||
body, err := json.Marshal(reqBody)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("pushplus api error: failed to encode message body: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(
|
|
||||||
ctx,
|
|
||||||
http.MethodPost,
|
|
||||||
"https://www.pushplus.plus/send",
|
|
||||||
bytes.NewReader(body),
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("pushplus api error: failed to create new request: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
req.Header.Set("Content-Type", "application/json; charset=utf-8")
|
|
||||||
|
|
||||||
resp, err := n.httpClient.Do(req)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("pushplus api error: failed to send request: %w", err)
|
return nil, fmt.Errorf("pushplus api error: failed to send request: %w", err)
|
||||||
}
|
} else if resp.IsError() {
|
||||||
defer resp.Body.Close()
|
return nil, fmt.Errorf("pushplus api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
|
|
||||||
result, err := io.ReadAll(resp.Body)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("pushplus api error: failed to read response: %w", err)
|
|
||||||
} else if resp.StatusCode != http.StatusOK {
|
|
||||||
return nil, fmt.Errorf("pushplus api error: unexpected status code: %d, resp: %s", resp.StatusCode, string(result))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var errorResponse struct {
|
var errorResponse struct {
|
||||||
Code int `json:"code"`
|
Code int `json:"code"`
|
||||||
Msg string `json:"msg"`
|
Message string `json:"msg"`
|
||||||
}
|
}
|
||||||
if err := json.Unmarshal(result, &errorResponse); err != nil {
|
if err := json.Unmarshal(resp.Body(), &errorResponse); err != nil {
|
||||||
return nil, fmt.Errorf("pushplus api error: failed to decode response: %w", err)
|
return nil, fmt.Errorf("pushplus api error: failed to unmarshal response: %w", err)
|
||||||
} else if errorResponse.Code != 200 {
|
} else if errorResponse.Code != 200 {
|
||||||
return nil, fmt.Errorf("pushplus api error: unexpected response code: %d, msg: %s", errorResponse.Code, errorResponse.Msg)
|
return nil, fmt.Errorf("pushplus api error: code='%d', message='%s'", errorResponse.Code, errorResponse.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ¬ifier.NotifyResult{}, nil
|
return ¬ifier.NotifyResult{}, nil
|
||||||
|
@@ -2,22 +2,24 @@ package serverchan
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
notifyHttp "github.com/nikoksr/notify/service/http"
|
"github.com/go-resty/resty/v2"
|
||||||
|
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NotifierConfig struct {
|
type NotifierConfig struct {
|
||||||
// ServerChan 服务地址。
|
// ServerChan 服务地址。
|
||||||
Url string `json:"url"`
|
ServerUrl string `json:"serverUrl"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type NotifierProvider struct {
|
type NotifierProvider struct {
|
||||||
config *NotifierConfig
|
config *NotifierConfig
|
||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
|
httpClient *resty.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
||||||
@@ -27,9 +29,12 @@ func NewNotifier(config *NotifierConfig) (*NotifierProvider, error) {
|
|||||||
panic("config is nil")
|
panic("config is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client := resty.New()
|
||||||
|
|
||||||
return &NotifierProvider{
|
return &NotifierProvider{
|
||||||
config: config,
|
config: config,
|
||||||
logger: slog.Default(),
|
logger: slog.Default(),
|
||||||
|
httpClient: client,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,24 +48,18 @@ func (n *NotifierProvider) WithLogger(logger *slog.Logger) notifier.Notifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
||||||
srv := notifyHttp.New()
|
// REF: https://sct.ftqq.com/
|
||||||
|
req := n.httpClient.R().
|
||||||
srv.AddReceivers(¬ifyHttp.Webhook{
|
SetHeader("Content-Type", "application/json").
|
||||||
URL: n.config.Url,
|
SetBody(map[string]any{
|
||||||
Header: http.Header{},
|
|
||||||
ContentType: "application/json",
|
|
||||||
Method: http.MethodPost,
|
|
||||||
BuildPayload: func(subject, message string) (payload any) {
|
|
||||||
return map[string]string{
|
|
||||||
"text": subject,
|
"text": subject,
|
||||||
"desp": message,
|
"desp": message,
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
resp, err := req.Execute(http.MethodPost, n.config.ServerUrl)
|
||||||
err = srv.Send(ctx, subject, message)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("serverchan api error: failed to send request: %w", err)
|
||||||
|
} else if resp.IsError() {
|
||||||
|
return nil, fmt.Errorf("serverchan api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return ¬ifier.NotifyResult{}, nil
|
return ¬ifier.NotifyResult{}, nil
|
||||||
|
@@ -39,7 +39,7 @@ func TestNotify(t *testing.T) {
|
|||||||
}, "\n"))
|
}, "\n"))
|
||||||
|
|
||||||
notifier, err := provider.NewNotifier(&provider.NotifierConfig{
|
notifier, err := provider.NewNotifier(&provider.NotifierConfig{
|
||||||
Url: fUrl,
|
ServerUrl: fUrl,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("err: %+v", err)
|
t.Errorf("err: %+v", err)
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
package telegram
|
package telegrambot
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/nikoksr/notify/service/telegram"
|
"github.com/go-resty/resty/v2"
|
||||||
|
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
||||||
)
|
)
|
||||||
@@ -19,6 +21,7 @@ type NotifierConfig struct {
|
|||||||
type NotifierProvider struct {
|
type NotifierProvider struct {
|
||||||
config *NotifierConfig
|
config *NotifierConfig
|
||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
|
httpClient *resty.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
||||||
@@ -28,9 +31,12 @@ func NewNotifier(config *NotifierConfig) (*NotifierProvider, error) {
|
|||||||
panic("config is nil")
|
panic("config is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client := resty.New()
|
||||||
|
|
||||||
return &NotifierProvider{
|
return &NotifierProvider{
|
||||||
config: config,
|
config: config,
|
||||||
logger: slog.Default(),
|
logger: slog.Default(),
|
||||||
|
httpClient: client,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,16 +50,18 @@ func (n *NotifierProvider) WithLogger(logger *slog.Logger) notifier.Notifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
||||||
srv, err := telegram.New(n.config.BotToken)
|
// REF: https://core.telegram.org/bots/api#sendmessage
|
||||||
|
req := n.httpClient.R().
|
||||||
|
SetHeader("Content-Type", "application/json").
|
||||||
|
SetBody(map[string]any{
|
||||||
|
"chat_id": n.config.ChatId,
|
||||||
|
"text": subject + "\n" + message,
|
||||||
|
})
|
||||||
|
resp, err := req.Execute(http.MethodPost, fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage", n.config.BotToken))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("telegram api error: failed to send request: %w", err)
|
||||||
}
|
} else if resp.IsError() {
|
||||||
|
return nil, fmt.Errorf("telegram api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
srv.AddReceivers(n.config.ChatId)
|
|
||||||
|
|
||||||
err = srv.Send(ctx, subject, message)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ¬ifier.NotifyResult{}, nil
|
return ¬ifier.NotifyResult{}, nil
|
@@ -1,4 +1,4 @@
|
|||||||
package telegram_test
|
package telegrambot_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
provider "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/telegram"
|
provider "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/telegrambot"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -21,7 +21,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
argsPrefix := "CERTIMATE_NOTIFIER_TELEGRAM_"
|
argsPrefix := "CERTIMATE_NOTIFIER_TELEGRAMBOT_"
|
||||||
|
|
||||||
flag.StringVar(&fApiToken, argsPrefix+"APITOKEN", "", "")
|
flag.StringVar(&fApiToken, argsPrefix+"APITOKEN", "", "")
|
||||||
flag.Int64Var(&fChartId, argsPrefix+"CHATID", 0, "")
|
flag.Int64Var(&fChartId, argsPrefix+"CHATID", 0, "")
|
||||||
@@ -30,9 +30,9 @@ func init() {
|
|||||||
/*
|
/*
|
||||||
Shell command to run this test:
|
Shell command to run this test:
|
||||||
|
|
||||||
go test -v ./telegram_test.go -args \
|
go test -v ./telegrambot_test.go -args \
|
||||||
--CERTIMATE_NOTIFIER_TELEGRAM_APITOKEN="your-api-token" \
|
--CERTIMATE_NOTIFIER_TELEGRAMBOT_APITOKEN="your-api-token" \
|
||||||
--CERTIMATE_NOTIFIER_TELEGRAM_CHATID=123456
|
--CERTIMATE_NOTIFIER_TELEGRAMBOT_CHATID=123456
|
||||||
*/
|
*/
|
||||||
func TestNotify(t *testing.T) {
|
func TestNotify(t *testing.T) {
|
||||||
flag.Parse()
|
flag.Parse()
|
@@ -139,9 +139,7 @@ func (n *NotifierProvider) Notify(ctx context.Context, subject string, message s
|
|||||||
|
|
||||||
// 生成请求
|
// 生成请求
|
||||||
// 其中 GET 请求需转换为查询参数
|
// 其中 GET 请求需转换为查询参数
|
||||||
req := n.httpClient.R().
|
req := n.httpClient.R().SetHeaderMultiValues(webhookHeaders)
|
||||||
SetContext(ctx).
|
|
||||||
SetHeaderMultiValues(webhookHeaders)
|
|
||||||
req.URL = webhookUrl.String()
|
req.URL = webhookUrl.String()
|
||||||
req.Method = webhookMethod
|
req.Method = webhookMethod
|
||||||
if webhookMethod == http.MethodGet {
|
if webhookMethod == http.MethodGet {
|
||||||
@@ -160,12 +158,12 @@ func (n *NotifierProvider) Notify(ctx context.Context, subject string, message s
|
|||||||
// 发送请求
|
// 发送请求
|
||||||
resp, err := req.Send()
|
resp, err := req.Send()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to send webhook request: %w", err)
|
return nil, fmt.Errorf("webhook error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return nil, fmt.Errorf("unexpected webhook response status code: %d", resp.StatusCode())
|
return nil, fmt.Errorf("webhook error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
n.logger.Debug("webhook responded", slog.Any("response", resp.String()))
|
n.logger.Debug("webhook responded", slog.String("response", resp.String()))
|
||||||
|
|
||||||
return ¬ifier.NotifyResult{}, nil
|
return ¬ifier.NotifyResult{}, nil
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,12 @@
|
|||||||
package serverchan
|
package wecombot
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
notifyHttp "github.com/nikoksr/notify/service/http"
|
"github.com/go-resty/resty/v2"
|
||||||
|
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
"github.com/usual2970/certimate/internal/pkg/core/notifier"
|
||||||
)
|
)
|
||||||
@@ -18,6 +19,7 @@ type NotifierConfig struct {
|
|||||||
type NotifierProvider struct {
|
type NotifierProvider struct {
|
||||||
config *NotifierConfig
|
config *NotifierConfig
|
||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
|
httpClient *resty.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
var _ notifier.Notifier = (*NotifierProvider)(nil)
|
||||||
@@ -27,8 +29,12 @@ func NewNotifier(config *NotifierConfig) (*NotifierProvider, error) {
|
|||||||
panic("config is nil")
|
panic("config is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client := resty.New()
|
||||||
|
|
||||||
return &NotifierProvider{
|
return &NotifierProvider{
|
||||||
config: config,
|
config: config,
|
||||||
|
logger: slog.Default(),
|
||||||
|
httpClient: client,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,26 +48,20 @@ func (n *NotifierProvider) WithLogger(logger *slog.Logger) notifier.Notifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
func (n *NotifierProvider) Notify(ctx context.Context, subject string, message string) (res *notifier.NotifyResult, err error) {
|
||||||
srv := notifyHttp.New()
|
// REF: https://developer.work.weixin.qq.com/document/path/91770
|
||||||
|
req := n.httpClient.R().
|
||||||
srv.AddReceivers(¬ifyHttp.Webhook{
|
SetHeader("Content-Type", "application/json").
|
||||||
URL: n.config.WebhookUrl,
|
SetBody(map[string]any{
|
||||||
Header: http.Header{},
|
|
||||||
ContentType: "application/json",
|
|
||||||
Method: http.MethodPost,
|
|
||||||
BuildPayload: func(subject, message string) (payload any) {
|
|
||||||
return map[string]any{
|
|
||||||
"msgtype": "text",
|
"msgtype": "text",
|
||||||
"text": map[string]string{
|
"text": map[string]string{
|
||||||
"content": subject + "\n\n" + message,
|
"content": subject + "\n\n" + message,
|
||||||
},
|
},
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
resp, err := req.Execute(http.MethodPost, n.config.WebhookUrl)
|
||||||
err = srv.Send(ctx, subject, message)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("wecom api error: failed to send request: %w", err)
|
||||||
|
} else if resp.IsError() {
|
||||||
|
return nil, fmt.Errorf("wecom api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return ¬ifier.NotifyResult{}, nil
|
return ¬ifier.NotifyResult{}, nil
|
@@ -1,4 +1,4 @@
|
|||||||
package lark_test
|
package wecombot_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -7,7 +7,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
provider "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/lark"
|
provider "github.com/usual2970/certimate/internal/pkg/core/notifier/providers/wecombot"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -18,7 +18,7 @@ const (
|
|||||||
var fWebhookUrl string
|
var fWebhookUrl string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
argsPrefix := "CERTIMATE_NOTIFIER_LARK_"
|
argsPrefix := "CERTIMATE_NOTIFIER_WECOMBOT_"
|
||||||
|
|
||||||
flag.StringVar(&fWebhookUrl, argsPrefix+"WEBHOOKURL", "", "")
|
flag.StringVar(&fWebhookUrl, argsPrefix+"WEBHOOKURL", "", "")
|
||||||
}
|
}
|
||||||
@@ -26,8 +26,8 @@ func init() {
|
|||||||
/*
|
/*
|
||||||
Shell command to run this test:
|
Shell command to run this test:
|
||||||
|
|
||||||
go test -v ./lark_test.go -args \
|
go test -v ./wecombot_test.go -args \
|
||||||
--CERTIMATE_NOTIFIER_LARK_WEBHOOKURL="https://example.com/your-webhook-url"
|
--CERTIMATE_NOTIFIER_WECOMBOT_WEBHOOKURL="https://example.com/your-webhook-url" \
|
||||||
*/
|
*/
|
||||||
func TestNotify(t *testing.T) {
|
func TestNotify(t *testing.T) {
|
||||||
flag.Parse()
|
flag.Parse()
|
@@ -79,7 +79,7 @@ func (c *Client) sendRequest(method string, path string, params interface{}) (*r
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("1panel api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("1panel api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("1panel api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("1panel api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -95,7 +95,7 @@ func (c *Client) sendRequestWithResult(method string, path string, params interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
||||||
return fmt.Errorf("1panel api error: failed to parse response: %w", err)
|
return fmt.Errorf("1panel api error: failed to unmarshal response: %w", err)
|
||||||
} else if errcode := result.GetCode(); errcode/100 != 2 {
|
} else if errcode := result.GetCode(); errcode/100 != 2 {
|
||||||
return fmt.Errorf("1panel api error: code='%d', message='%s'", errcode, result.GetMessage())
|
return fmt.Errorf("1panel api error: code='%d', message='%s'", errcode, result.GetMessage())
|
||||||
}
|
}
|
||||||
|
@@ -75,7 +75,7 @@ func (c *Client) sendRequest(method string, path string, params interface{}) (*r
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("baishan api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("baishan api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("baishan api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("baishan api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -91,7 +91,7 @@ func (c *Client) sendRequestWithResult(method string, path string, params interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
||||||
return fmt.Errorf("baishan api error: failed to parse response: %w", err)
|
return fmt.Errorf("baishan api error: failed to unmarshal response: %w", err)
|
||||||
} else if errcode := result.GetCode(); errcode != 0 {
|
} else if errcode := result.GetCode(); errcode != 0 {
|
||||||
return fmt.Errorf("baishan api error: code='%d', message='%s'", errcode, result.GetMessage())
|
return fmt.Errorf("baishan api error: code='%d', message='%s'", errcode, result.GetMessage())
|
||||||
}
|
}
|
||||||
|
@@ -86,7 +86,7 @@ func (c *Client) sendRequest(path string, params interface{}) (*resty.Response,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("baota api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("baota api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("baota api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("baota api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -99,7 +99,7 @@ func (c *Client) sendRequestWithResult(path string, params interface{}, result B
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
||||||
return fmt.Errorf("baota api error: failed to parse response: %w", err)
|
return fmt.Errorf("baota api error: failed to unmarshal response: %w", err)
|
||||||
} else if errstatus := result.GetStatus(); errstatus != nil && !*errstatus {
|
} else if errstatus := result.GetStatus(); errstatus != nil && !*errstatus {
|
||||||
if result.GetMessage() == nil {
|
if result.GetMessage() == nil {
|
||||||
return fmt.Errorf("baota api error: unknown error")
|
return fmt.Errorf("baota api error: unknown error")
|
||||||
|
@@ -59,7 +59,7 @@ func (c *Client) sendRequest(method string, path string, params interface{}) (*r
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("bunny api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("bunny api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("bunny api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("bunny api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
|
@@ -59,7 +59,7 @@ func (c *Client) sendRequest(method string, path string, params interface{}) (*r
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("cachefly api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("cachefly api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("cachefly api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("cachefly api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -75,7 +75,7 @@ func (c *Client) sendRequestWithResult(method string, path string, params interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
||||||
return fmt.Errorf("cachefly api error: failed to parse response: %w", err)
|
return fmt.Errorf("cachefly api error: failed to unmarshal response: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@@ -71,7 +71,7 @@ func (c *Client) sendRequest(method string, path string, params interface{}) (*r
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("cdnfly api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("cdnfly api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("cdnfly api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("cdnfly api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -87,7 +87,7 @@ func (c *Client) sendRequestWithResult(method string, path string, params interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
||||||
return fmt.Errorf("cdnfly api error: failed to parse response: %w", err)
|
return fmt.Errorf("cdnfly api error: failed to unmarshal response: %w", err)
|
||||||
} else if errcode := result.GetCode(); errcode != "" && errcode != "0" {
|
} else if errcode := result.GetCode(); errcode != "" && errcode != "0" {
|
||||||
return fmt.Errorf("cdnfly api error: code='%s', message='%s'", errcode, result.GetMessage())
|
return fmt.Errorf("cdnfly api error: code='%s', message='%s'", errcode, result.GetMessage())
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ func (c *Client) sendRequest(method string, path string, params interface{}) (*r
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("dnsla api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("dnsla api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("dnsla api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("dnsla api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -76,7 +76,7 @@ func (c *Client) sendRequestWithResult(method string, path string, params interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
||||||
return fmt.Errorf("dnsla api error: failed to parse response: %w", err)
|
return fmt.Errorf("dnsla api error: failed to unmarshal response: %w", err)
|
||||||
} else if errcode := result.GetCode(); errcode/100 != 2 {
|
} else if errcode := result.GetCode(); errcode/100 != 2 {
|
||||||
return fmt.Errorf("dnsla api error: code='%d', message='%s'", errcode, result.GetMessage())
|
return fmt.Errorf("dnsla api error: code='%d', message='%s'", errcode, result.GetMessage())
|
||||||
}
|
}
|
||||||
|
@@ -140,7 +140,7 @@ func (c *EdgioClient) GetProperties(page int, pageSize int, organizationID strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.IsError() {
|
if resp.IsError() {
|
||||||
return nil, fmt.Errorf("unexpected status code for getProperties: %d, %s", resp.StatusCode(), resp.Body())
|
return nil, fmt.Errorf("unexpected status code for getProperties: %d, %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return &propertiesResp, nil
|
return &propertiesResp, nil
|
||||||
@@ -512,7 +512,7 @@ func (c *EdgioClient) UploadCdnConfiguration(config *dtos.CDNConfiguration) (*dt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.IsError() {
|
if resp.IsError() {
|
||||||
return nil, fmt.Errorf("unexpected status code for uploadCdnConfiguration: %d, %s", resp.StatusCode(), resp.Body())
|
return nil, fmt.Errorf("unexpected status code for uploadCdnConfiguration: %d, %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return &response, nil
|
return &response, nil
|
||||||
|
@@ -82,7 +82,7 @@ func (c *Client) sendRequest(path string, params interface{}) (*resty.Response,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("gname api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("gname api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("gname api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("gname api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -95,7 +95,7 @@ func (c *Client) sendRequestWithResult(path string, params interface{}, result B
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
||||||
return fmt.Errorf("gname api error: failed to parse response: %w", err)
|
return fmt.Errorf("gname api error: failed to unmarshal response: %w", err)
|
||||||
} else if errcode := result.GetCode(); errcode != 1 {
|
} else if errcode := result.GetCode(); errcode != 1 {
|
||||||
return fmt.Errorf("gname api error: code='%d', message='%s'", errcode, result.GetMessage())
|
return fmt.Errorf("gname api error: code='%d', message='%s'", errcode, result.GetMessage())
|
||||||
}
|
}
|
||||||
|
@@ -20,7 +20,7 @@ func (c *Client) getAccessToken() error {
|
|||||||
|
|
||||||
resp := &getAPIAccessTokenResponse{}
|
resp := &getAPIAccessTokenResponse{}
|
||||||
if err := json.Unmarshal(res.Body(), &resp); err != nil {
|
if err := json.Unmarshal(res.Body(), &resp); err != nil {
|
||||||
return fmt.Errorf("goedge api error: failed to parse response: %w", err)
|
return fmt.Errorf("goedge api error: failed to unmarshal response: %w", err)
|
||||||
} else if resp.GetCode() != 200 {
|
} else if resp.GetCode() != 200 {
|
||||||
return fmt.Errorf("goedge get access token failed: code: %d, message: %s", resp.GetCode(), resp.GetMessage())
|
return fmt.Errorf("goedge get access token failed: code: %d, message: %s", resp.GetCode(), resp.GetMessage())
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ func (c *Client) sendRequest(method string, path string, params interface{}) (*r
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("goedge api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("goedge api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("goedge api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("goedge api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -94,7 +94,7 @@ func (c *Client) sendRequestWithResult(method string, path string, params interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
||||||
return fmt.Errorf("goedge api error: failed to parse response: %w", err)
|
return fmt.Errorf("goedge api error: failed to unmarshal response: %w", err)
|
||||||
} else if errcode := result.GetCode(); errcode != 200 {
|
} else if errcode := result.GetCode(); errcode != 200 {
|
||||||
return fmt.Errorf("goedge api error: code='%d', message='%s'", errcode, result.GetMessage())
|
return fmt.Errorf("goedge api error: code='%d', message='%s'", errcode, result.GetMessage())
|
||||||
}
|
}
|
||||||
|
@@ -72,7 +72,7 @@ func (c *Client) sendRequest(method string, path string, queryParams interface{}
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("netlify api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("netlify api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("netlify api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("netlify api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -88,7 +88,7 @@ func (c *Client) sendRequestWithResult(method string, path string, queryParams i
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
||||||
return fmt.Errorf("netlify api error: failed to parse response: %w", err)
|
return fmt.Errorf("netlify api error: failed to unmarshal response: %w", err)
|
||||||
} else if errcode := result.GetCode(); errcode != 0 {
|
} else if errcode := result.GetCode(); errcode != 0 {
|
||||||
return fmt.Errorf("netlify api error: code='%d', message='%s'", errcode, result.GetMessage())
|
return fmt.Errorf("netlify api error: code='%d', message='%s'", errcode, result.GetMessage())
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ func (c *Client) sendRequest(method string, path string, params interface{}) (*r
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("rainyun api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("rainyun api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("rainyun api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("rainyun api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -65,7 +65,7 @@ func (c *Client) sendRequestWithResult(method string, path string, params interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
||||||
return fmt.Errorf("rainyun api error: failed to parse response: %w", err)
|
return fmt.Errorf("rainyun api error: failed to unmarshal response: %w", err)
|
||||||
} else if errcode := result.GetCode(); errcode/100 != 2 {
|
} else if errcode := result.GetCode(); errcode/100 != 2 {
|
||||||
return fmt.Errorf("rainyun api error: code='%d', message='%s'", errcode, result.GetMessage())
|
return fmt.Errorf("rainyun api error: code='%d', message='%s'", errcode, result.GetMessage())
|
||||||
}
|
}
|
||||||
|
@@ -47,7 +47,7 @@ func (c *Client) sendRequest(path string, params interface{}) (*resty.Response,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("safeline api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("safeline api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("safeline api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("safeline api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -63,7 +63,7 @@ func (c *Client) sendRequestWithResult(path string, params interface{}, result B
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
||||||
return fmt.Errorf("safeline api error: failed to parse response: %w", err)
|
return fmt.Errorf("safeline api error: failed to unmarshal response: %w", err)
|
||||||
} else if errcode := result.GetErrCode(); errcode != nil && *errcode != "" {
|
} else if errcode := result.GetErrCode(); errcode != nil && *errcode != "" {
|
||||||
if result.GetErrMsg() == nil {
|
if result.GetErrMsg() == nil {
|
||||||
return fmt.Errorf("safeline api error: code='%s'", *errcode)
|
return fmt.Errorf("safeline api error: code='%s'", *errcode)
|
||||||
|
@@ -16,7 +16,7 @@ func (c *Client) getCookie() error {
|
|||||||
|
|
||||||
resp := &signinResponse{}
|
resp := &signinResponse{}
|
||||||
if err := json.Unmarshal(res.Body(), &resp); err != nil {
|
if err := json.Unmarshal(res.Body(), &resp); err != nil {
|
||||||
return fmt.Errorf("upyun api error: failed to parse response: %w", err)
|
return fmt.Errorf("upyun api error: failed to unmarshal response: %w", err)
|
||||||
} else if !resp.Data.Result {
|
} else if !resp.Data.Result {
|
||||||
return errors.New("upyun console signin failed")
|
return errors.New("upyun console signin failed")
|
||||||
}
|
}
|
||||||
|
@@ -65,7 +65,7 @@ func (c *Client) sendRequest(method string, path string, params interface{}) (*r
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("upyun api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("upyun api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("upyun api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("upyun api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -81,12 +81,12 @@ func (c *Client) sendRequestWithResult(method string, path string, params interf
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
if err := json.Unmarshal(resp.Body(), &result); err != nil {
|
||||||
return fmt.Errorf("upyun api error: failed to parse response: %w", err)
|
return fmt.Errorf("upyun api error: failed to unmarshal response: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
tresp := &baseResponse{}
|
tresp := &baseResponse{}
|
||||||
if err := json.Unmarshal(resp.Body(), &tresp); err != nil {
|
if err := json.Unmarshal(resp.Body(), &tresp); err != nil {
|
||||||
return fmt.Errorf("upyun api error: failed to parse response: %w", err)
|
return fmt.Errorf("upyun api error: failed to unmarshal response: %w", err)
|
||||||
} else if tdata := tresp.GetData(); tdata == nil {
|
} else if tdata := tresp.GetData(); tdata == nil {
|
||||||
return fmt.Errorf("upyun api error: empty data")
|
return fmt.Errorf("upyun api error: empty data")
|
||||||
} else if errcode := tdata.GetErrorCode(); errcode > 0 {
|
} else if errcode := tdata.GetErrorCode(); errcode > 0 {
|
||||||
|
@@ -162,7 +162,7 @@ func (c *Client) sendRequest(method string, path string, params interface{}, con
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, fmt.Errorf("wangsu api error: failed to send request: %w", err)
|
return resp, fmt.Errorf("wangsu api error: failed to send request: %w", err)
|
||||||
} else if resp.IsError() {
|
} else if resp.IsError() {
|
||||||
return resp, fmt.Errorf("wangsu api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.Body())
|
return resp, fmt.Errorf("wangsu api error: unexpected status code: %d, resp: %s", resp.StatusCode(), resp.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -181,7 +181,7 @@ func (c *Client) SendRequestWithResult(method string, path string, params interf
|
|||||||
respBody := resp.Body()
|
respBody := resp.Body()
|
||||||
if len(respBody) != 0 {
|
if len(respBody) != 0 {
|
||||||
if err := json.Unmarshal(respBody, &result); err != nil {
|
if err := json.Unmarshal(respBody, &result); err != nil {
|
||||||
return resp, fmt.Errorf("wangsu api error: failed to parse response: %w", err)
|
return resp, fmt.Errorf("wangsu api error: failed to unmarshal response: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ import AccessFormRainYunConfig from "./AccessFormRainYunConfig";
|
|||||||
import AccessFormSafeLineConfig from "./AccessFormSafeLineConfig";
|
import AccessFormSafeLineConfig from "./AccessFormSafeLineConfig";
|
||||||
import AccessFormSSHConfig from "./AccessFormSSHConfig";
|
import AccessFormSSHConfig from "./AccessFormSSHConfig";
|
||||||
import AccessFormSSLComConfig from "./AccessFormSSLComConfig";
|
import AccessFormSSLComConfig from "./AccessFormSSLComConfig";
|
||||||
import AccessFormTelegramConfig from "./AccessFormTelegramConfig";
|
import AccessFormTelegramBotConfig from "./AccessFormTelegramBotConfig";
|
||||||
import AccessFormTencentCloudConfig from "./AccessFormTencentCloudConfig";
|
import AccessFormTencentCloudConfig from "./AccessFormTencentCloudConfig";
|
||||||
import AccessFormUCloudConfig from "./AccessFormUCloudConfig";
|
import AccessFormUCloudConfig from "./AccessFormUCloudConfig";
|
||||||
import AccessFormUpyunConfig from "./AccessFormUpyunConfig";
|
import AccessFormUpyunConfig from "./AccessFormUpyunConfig";
|
||||||
@@ -264,8 +264,8 @@ const AccessForm = forwardRef<AccessFormInstance, AccessFormProps>(({ className,
|
|||||||
return <AccessFormSafeLineConfig {...nestedFormProps} />;
|
return <AccessFormSafeLineConfig {...nestedFormProps} />;
|
||||||
case ACCESS_PROVIDERS.SSH:
|
case ACCESS_PROVIDERS.SSH:
|
||||||
return <AccessFormSSHConfig {...nestedFormProps} />;
|
return <AccessFormSSHConfig {...nestedFormProps} />;
|
||||||
case ACCESS_PROVIDERS.TELEGRAM:
|
case ACCESS_PROVIDERS.TELEGRAMBOT:
|
||||||
return <AccessFormTelegramConfig {...nestedFormProps} />;
|
return <AccessFormTelegramBotConfig {...nestedFormProps} />;
|
||||||
case ACCESS_PROVIDERS.SSLCOM:
|
case ACCESS_PROVIDERS.SSLCOM:
|
||||||
return <AccessFormSSLComConfig {...nestedFormProps} />;
|
return <AccessFormSSLComConfig {...nestedFormProps} />;
|
||||||
case ACCESS_PROVIDERS.TENCENTCLOUD:
|
case ACCESS_PROVIDERS.TENCENTCLOUD:
|
||||||
|
@@ -3,25 +3,25 @@ import { Form, type FormInstance, Input } from "antd";
|
|||||||
import { createSchemaFieldRule } from "antd-zod";
|
import { createSchemaFieldRule } from "antd-zod";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { type AccessConfigForTelegram } from "@/domain/access";
|
import { type AccessConfigForTelegramBot } from "@/domain/access";
|
||||||
|
|
||||||
type AccessFormTelegramConfigFieldValues = Nullish<AccessConfigForTelegram>;
|
type AccessFormTelegramBotConfigFieldValues = Nullish<AccessConfigForTelegramBot>;
|
||||||
|
|
||||||
export type AccessFormTelegramConfigProps = {
|
export type AccessFormTelegramBotConfigProps = {
|
||||||
form: FormInstance;
|
form: FormInstance;
|
||||||
formName: string;
|
formName: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
initialValues?: AccessFormTelegramConfigFieldValues;
|
initialValues?: AccessFormTelegramBotConfigFieldValues;
|
||||||
onValuesChange?: (values: AccessFormTelegramConfigFieldValues) => void;
|
onValuesChange?: (values: AccessFormTelegramBotConfigFieldValues) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const initFormModel = (): AccessFormTelegramConfigFieldValues => {
|
const initFormModel = (): AccessFormTelegramBotConfigFieldValues => {
|
||||||
return {
|
return {
|
||||||
botToken: "",
|
botToken: "",
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const AccessFormTelegramConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: AccessFormTelegramConfigProps) => {
|
const AccessFormTelegramBotConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: AccessFormTelegramBotConfigProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
@@ -38,7 +38,7 @@ const AccessFormTelegramConfig = ({ form: formInst, formName, disabled, initialV
|
|||||||
.refine((v) => {
|
.refine((v) => {
|
||||||
if (v == null || v + "" === "") return true;
|
if (v == null || v + "" === "") return true;
|
||||||
return /^\d+$/.test(v + "") && +v! > 0;
|
return /^\d+$/.test(v + "") && +v! > 0;
|
||||||
}, t("access.form.telegram_default_chat_id.placeholder"))
|
}, t("access.form.telegram_bot_default_chat_id.placeholder"))
|
||||||
)
|
)
|
||||||
.nullish(),
|
.nullish(),
|
||||||
});
|
});
|
||||||
@@ -68,14 +68,14 @@ const AccessFormTelegramConfig = ({ form: formInst, formName, disabled, initialV
|
|||||||
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="defaultChatId"
|
name="defaultChatId"
|
||||||
label={t("access.form.telegram_default_chat_id.label")}
|
label={t("access.form.telegram_bot_default_chat_id.label")}
|
||||||
rules={[formRule]}
|
rules={[formRule]}
|
||||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.telegram_default_chat_id.tooltip") }}></span>}
|
tooltip={<span dangerouslySetInnerHTML={{ __html: t("access.form.telegram_bot_default_chat_id.tooltip") }}></span>}
|
||||||
>
|
>
|
||||||
<Input type="number" allowClear placeholder={t("access.form.telegram_default_chat_id.placeholder")} />
|
<Input type="number" allowClear placeholder={t("access.form.telegram_bot_default_chat_id.placeholder")} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AccessFormTelegramConfig;
|
export default AccessFormTelegramBotConfig;
|
@@ -142,8 +142,7 @@ const AccessFormWebhookConfig = ({ form: formInst, formName, disabled, initialVa
|
|||||||
{
|
{
|
||||||
title: "${SUBJECT}",
|
title: "${SUBJECT}",
|
||||||
body: "${MESSAGE}",
|
body: "${MESSAGE}",
|
||||||
group: "<your-bark-group>",
|
device_key: "<your-bark-device-key>",
|
||||||
device_keys: "<your-bark-device-key>",
|
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
2
|
2
|
||||||
|
@@ -19,7 +19,7 @@ import { useNotifyChannelsStore } from "@/stores/notify";
|
|||||||
|
|
||||||
import NotifyNodeConfigFormEmailConfig from "./NotifyNodeConfigFormEmailConfig";
|
import NotifyNodeConfigFormEmailConfig from "./NotifyNodeConfigFormEmailConfig";
|
||||||
import NotifyNodeConfigFormMattermostConfig from "./NotifyNodeConfigFormMattermostConfig";
|
import NotifyNodeConfigFormMattermostConfig from "./NotifyNodeConfigFormMattermostConfig";
|
||||||
import NotifyNodeConfigFormTelegramConfig from "./NotifyNodeConfigFormTelegramConfig";
|
import NotifyNodeConfigFormTelegramBotConfig from "./NotifyNodeConfigFormTelegramBotConfig";
|
||||||
import NotifyNodeConfigFormWebhookConfig from "./NotifyNodeConfigFormWebhookConfig";
|
import NotifyNodeConfigFormWebhookConfig from "./NotifyNodeConfigFormWebhookConfig";
|
||||||
|
|
||||||
type NotifyNodeConfigFormFieldValues = Partial<WorkflowNodeConfigForNotify>;
|
type NotifyNodeConfigFormFieldValues = Partial<WorkflowNodeConfigForNotify>;
|
||||||
@@ -114,8 +114,8 @@ const NotifyNodeConfigForm = forwardRef<NotifyNodeConfigFormInstance, NotifyNode
|
|||||||
return <NotifyNodeConfigFormEmailConfig {...nestedFormProps} />;
|
return <NotifyNodeConfigFormEmailConfig {...nestedFormProps} />;
|
||||||
case NOTIFICATION_PROVIDERS.MATTERMOST:
|
case NOTIFICATION_PROVIDERS.MATTERMOST:
|
||||||
return <NotifyNodeConfigFormMattermostConfig {...nestedFormProps} />;
|
return <NotifyNodeConfigFormMattermostConfig {...nestedFormProps} />;
|
||||||
case NOTIFICATION_PROVIDERS.TELEGRAM:
|
case NOTIFICATION_PROVIDERS.TELEGRAMBOT:
|
||||||
return <NotifyNodeConfigFormTelegramConfig {...nestedFormProps} />;
|
return <NotifyNodeConfigFormTelegramBotConfig {...nestedFormProps} />;
|
||||||
case NOTIFICATION_PROVIDERS.WEBHOOK:
|
case NOTIFICATION_PROVIDERS.WEBHOOK:
|
||||||
return <NotifyNodeConfigFormWebhookConfig {...nestedFormProps} />;
|
return <NotifyNodeConfigFormWebhookConfig {...nestedFormProps} />;
|
||||||
}
|
}
|
||||||
|
@@ -3,23 +3,29 @@ import { Form, type FormInstance, Input } from "antd";
|
|||||||
import { createSchemaFieldRule } from "antd-zod";
|
import { createSchemaFieldRule } from "antd-zod";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
type NotifyNodeConfigFormTelegramConfigFieldValues = Nullish<{
|
type NotifyNodeConfigFormTelegramBotConfigFieldValues = Nullish<{
|
||||||
chatId?: string | number;
|
chatId?: string | number;
|
||||||
}>;
|
}>;
|
||||||
|
|
||||||
export type NotifyNodeConfigFormTelegramConfigProps = {
|
export type NotifyNodeConfigFormTelegramBotConfigProps = {
|
||||||
form: FormInstance;
|
form: FormInstance;
|
||||||
formName: string;
|
formName: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
initialValues?: NotifyNodeConfigFormTelegramConfigFieldValues;
|
initialValues?: NotifyNodeConfigFormTelegramBotConfigFieldValues;
|
||||||
onValuesChange?: (values: NotifyNodeConfigFormTelegramConfigFieldValues) => void;
|
onValuesChange?: (values: NotifyNodeConfigFormTelegramBotConfigFieldValues) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const initFormModel = (): NotifyNodeConfigFormTelegramConfigFieldValues => {
|
const initFormModel = (): NotifyNodeConfigFormTelegramBotConfigFieldValues => {
|
||||||
return {};
|
return {};
|
||||||
};
|
};
|
||||||
|
|
||||||
const NotifyNodeConfigFormTelegramConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: NotifyNodeConfigFormTelegramConfigProps) => {
|
const NotifyNodeConfigFormTelegramBotConfig = ({
|
||||||
|
form: formInst,
|
||||||
|
formName,
|
||||||
|
disabled,
|
||||||
|
initialValues,
|
||||||
|
onValuesChange,
|
||||||
|
}: NotifyNodeConfigFormTelegramBotConfigProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
@@ -32,7 +38,7 @@ const NotifyNodeConfigFormTelegramConfig = ({ form: formInst, formName, disabled
|
|||||||
.refine((v) => {
|
.refine((v) => {
|
||||||
if (v == null || v + "" === "") return true;
|
if (v == null || v + "" === "") return true;
|
||||||
return /^\d+$/.test(v + "") && +v! > 0;
|
return /^\d+$/.test(v + "") && +v! > 0;
|
||||||
}, t("workflow_node.notify.form.telegram_chat_id.placeholder"))
|
}, t("workflow_node.notify.form.telegram_bot_chat_id.placeholder"))
|
||||||
)
|
)
|
||||||
.nullish(),
|
.nullish(),
|
||||||
});
|
});
|
||||||
@@ -53,14 +59,14 @@ const NotifyNodeConfigFormTelegramConfig = ({ form: formInst, formName, disabled
|
|||||||
>
|
>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name="chatId"
|
name="chatId"
|
||||||
label={t("workflow_node.notify.form.telegram_chat_id.label")}
|
label={t("workflow_node.notify.form.telegram_bot_chat_id.label")}
|
||||||
rules={[formRule]}
|
rules={[formRule]}
|
||||||
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.notify.form.telegram_chat_id.tooltip") }}></span>}
|
tooltip={<span dangerouslySetInnerHTML={{ __html: t("workflow_node.notify.form.telegram_bot_chat_id.tooltip") }}></span>}
|
||||||
>
|
>
|
||||||
<Input type="number" allowClear placeholder={t("workflow_node.notify.form.telegram_chat_id.placeholder")} />
|
<Input type="number" allowClear placeholder={t("workflow_node.notify.form.telegram_bot_chat_id.placeholder")} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default NotifyNodeConfigFormTelegramConfig;
|
export default NotifyNodeConfigFormTelegramBotConfig;
|
@@ -51,7 +51,7 @@ export interface AccessModel extends BaseModel {
|
|||||||
| AccessConfigForSafeLine
|
| AccessConfigForSafeLine
|
||||||
| AccessConfigForSSH
|
| AccessConfigForSSH
|
||||||
| AccessConfigForSSLCom
|
| AccessConfigForSSLCom
|
||||||
| AccessConfigForTelegram
|
| AccessConfigForTelegramBot
|
||||||
| AccessConfigForTencentCloud
|
| AccessConfigForTencentCloud
|
||||||
| AccessConfigForUCloud
|
| AccessConfigForUCloud
|
||||||
| AccessConfigForUpyun
|
| AccessConfigForUpyun
|
||||||
@@ -312,7 +312,7 @@ export type AccessConfigForSSLCom = {
|
|||||||
eabHmacKey: string;
|
eabHmacKey: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type AccessConfigForTelegram = {
|
export type AccessConfigForTelegramBot = {
|
||||||
botToken: string;
|
botToken: string;
|
||||||
defaultChatId?: number;
|
defaultChatId?: number;
|
||||||
};
|
};
|
||||||
|
@@ -54,7 +54,7 @@ export const ACCESS_PROVIDERS = Object.freeze({
|
|||||||
SAFELINE: "safeline",
|
SAFELINE: "safeline",
|
||||||
SSH: "ssh",
|
SSH: "ssh",
|
||||||
SSLCOM: "sslcom",
|
SSLCOM: "sslcom",
|
||||||
TELEGRAM: "telegram",
|
TELEGRAMBOT: "telegrambot",
|
||||||
TENCENTCLOUD: "tencentcloud",
|
TENCENTCLOUD: "tencentcloud",
|
||||||
UCLOUD: "ucloud",
|
UCLOUD: "ucloud",
|
||||||
UPYUN: "upyun",
|
UPYUN: "upyun",
|
||||||
@@ -157,7 +157,7 @@ export const accessProvidersMap: Map<AccessProvider["type"] | string, AccessProv
|
|||||||
[ACCESS_PROVIDERS.LARKBOT, "provider.larkbot", "/imgs/providers/lark.svg", [ACCESS_USAGES.NOTIFICATION]],
|
[ACCESS_PROVIDERS.LARKBOT, "provider.larkbot", "/imgs/providers/lark.svg", [ACCESS_USAGES.NOTIFICATION]],
|
||||||
[ACCESS_PROVIDERS.WECOMBOT, "provider.wecombot", "/imgs/providers/wecom.svg", [ACCESS_USAGES.NOTIFICATION]],
|
[ACCESS_PROVIDERS.WECOMBOT, "provider.wecombot", "/imgs/providers/wecom.svg", [ACCESS_USAGES.NOTIFICATION]],
|
||||||
[ACCESS_PROVIDERS.MATTERMOST, "provider.mattermost", "/imgs/providers/mattermost.svg", [ACCESS_USAGES.NOTIFICATION]],
|
[ACCESS_PROVIDERS.MATTERMOST, "provider.mattermost", "/imgs/providers/mattermost.svg", [ACCESS_USAGES.NOTIFICATION]],
|
||||||
[ACCESS_PROVIDERS.TELEGRAM, "provider.telegram", "/imgs/providers/telegram.svg", [ACCESS_USAGES.NOTIFICATION]],
|
[ACCESS_PROVIDERS.TELEGRAMBOT, "provider.telegrambot", "/imgs/providers/telegram.svg", [ACCESS_USAGES.NOTIFICATION]],
|
||||||
].map((e) => [
|
].map((e) => [
|
||||||
e[0] as string,
|
e[0] as string,
|
||||||
{
|
{
|
||||||
@@ -547,7 +547,7 @@ export const NOTIFICATION_PROVIDERS = Object.freeze({
|
|||||||
EMAIL: `${ACCESS_PROVIDERS.EMAIL}`,
|
EMAIL: `${ACCESS_PROVIDERS.EMAIL}`,
|
||||||
LARKBOT: `${ACCESS_PROVIDERS.LARKBOT}`,
|
LARKBOT: `${ACCESS_PROVIDERS.LARKBOT}`,
|
||||||
MATTERMOST: `${ACCESS_PROVIDERS.MATTERMOST}`,
|
MATTERMOST: `${ACCESS_PROVIDERS.MATTERMOST}`,
|
||||||
TELEGRAM: `${ACCESS_PROVIDERS.TELEGRAM}`,
|
TELEGRAMBOT: `${ACCESS_PROVIDERS.TELEGRAMBOT}`,
|
||||||
WEBHOOK: `${ACCESS_PROVIDERS.WEBHOOK}`,
|
WEBHOOK: `${ACCESS_PROVIDERS.WEBHOOK}`,
|
||||||
WECOMBOT: `${ACCESS_PROVIDERS.WECOMBOT}`,
|
WECOMBOT: `${ACCESS_PROVIDERS.WECOMBOT}`,
|
||||||
} as const);
|
} as const);
|
||||||
@@ -573,7 +573,7 @@ export const notificationProvidersMap: Map<NotificationProvider["type"] | string
|
|||||||
[NOTIFICATION_PROVIDERS.LARKBOT],
|
[NOTIFICATION_PROVIDERS.LARKBOT],
|
||||||
[NOTIFICATION_PROVIDERS.WECOMBOT],
|
[NOTIFICATION_PROVIDERS.WECOMBOT],
|
||||||
[NOTIFICATION_PROVIDERS.MATTERMOST],
|
[NOTIFICATION_PROVIDERS.MATTERMOST],
|
||||||
[NOTIFICATION_PROVIDERS.TELEGRAM],
|
[NOTIFICATION_PROVIDERS.TELEGRAMBOT],
|
||||||
].map(([type]) => [
|
].map(([type]) => [
|
||||||
type,
|
type,
|
||||||
{
|
{
|
||||||
|
@@ -343,9 +343,9 @@
|
|||||||
"access.form.telegram_bot_token.label": "Telegram bot token",
|
"access.form.telegram_bot_token.label": "Telegram bot token",
|
||||||
"access.form.telegram_bot_token.placeholder": "Please enter Telegram bot token",
|
"access.form.telegram_bot_token.placeholder": "Please enter Telegram bot token",
|
||||||
"access.form.telegram_bot_token.tooltip": "How to get the bot token? Please refer to <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
"access.form.telegram_bot_token.tooltip": "How to get the bot token? Please refer to <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
||||||
"access.form.telegram_default_chat_id.label": "Default Telegram chat ID (Optional)",
|
"access.form.telegram_bot_default_chat_id.label": "Default Telegram chat ID (Optional)",
|
||||||
"access.form.telegram_default_chat_id.placeholder": "Please enter default Telegram chat ID",
|
"access.form.telegram_bot_default_chat_id.placeholder": "Please enter default Telegram chat ID",
|
||||||
"access.form.telegram_default_chat_id.tooltip": "How to get the chat ID? Please refer to <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
"access.form.telegram_bot_default_chat_id.tooltip": "How to get the chat ID? Please refer to <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
||||||
"access.form.tencentcloud_secret_id.label": "Tencent Cloud SecretId",
|
"access.form.tencentcloud_secret_id.label": "Tencent Cloud SecretId",
|
||||||
"access.form.tencentcloud_secret_id.placeholder": "Please enter Tencent Cloud SecretId",
|
"access.form.tencentcloud_secret_id.placeholder": "Please enter Tencent Cloud SecretId",
|
||||||
"access.form.tencentcloud_secret_id.tooltip": "For more information, see <a href=\"https://cloud.tencent.com/document/product/598/40488?lang=en\" target=\"_blank\">https://cloud.tencent.com/document/product/598/40488?lang=en</a>",
|
"access.form.tencentcloud_secret_id.tooltip": "For more information, see <a href=\"https://cloud.tencent.com/document/product/598/40488?lang=en\" target=\"_blank\">https://cloud.tencent.com/document/product/598/40488?lang=en</a>",
|
||||||
|
@@ -106,7 +106,7 @@
|
|||||||
"provider.safeline": "SafeLine",
|
"provider.safeline": "SafeLine",
|
||||||
"provider.ssh": "SSH deployment",
|
"provider.ssh": "SSH deployment",
|
||||||
"provider.sslcom": "SSL.com",
|
"provider.sslcom": "SSL.com",
|
||||||
"provider.telegram": "Telegram",
|
"provider.telegrambot": "Telegram Bot",
|
||||||
"provider.tencentcloud": "Tencent Cloud",
|
"provider.tencentcloud": "Tencent Cloud",
|
||||||
"provider.tencentcloud.cdn": "Tencent Cloud - CDN (Content Delivery Network)",
|
"provider.tencentcloud.cdn": "Tencent Cloud - CDN (Content Delivery Network)",
|
||||||
"provider.tencentcloud.clb": "Tencent Cloud - CLB (Cloud Load Balancer)",
|
"provider.tencentcloud.clb": "Tencent Cloud - CLB (Cloud Load Balancer)",
|
||||||
|
@@ -776,9 +776,9 @@
|
|||||||
"workflow_node.notify.form.mattermost_channel_id.label": "Mattermost channel ID (Optional)",
|
"workflow_node.notify.form.mattermost_channel_id.label": "Mattermost channel ID (Optional)",
|
||||||
"workflow_node.notify.form.mattermost_channel_id.placeholder": "Please enter Mattermost channel ID to override the default value",
|
"workflow_node.notify.form.mattermost_channel_id.placeholder": "Please enter Mattermost channel ID to override the default value",
|
||||||
"workflow_node.notify.form.mattermost_channel_id.tooltip": "Leave it blank to use the default channel ID provided by the authorization.",
|
"workflow_node.notify.form.mattermost_channel_id.tooltip": "Leave it blank to use the default channel ID provided by the authorization.",
|
||||||
"workflow_node.notify.form.telegram_chat_id.label": "Telegram chat ID (Optional)",
|
"workflow_node.notify.form.telegram_bot_chat_id.label": "Telegram chat ID (Optional)",
|
||||||
"workflow_node.notify.form.telegram_chat_id.placeholder": "Please enter Telegram chat ID to override the default value",
|
"workflow_node.notify.form.telegram_bot_chat_id.placeholder": "Please enter Telegram chat ID to override the default value",
|
||||||
"workflow_node.notify.form.telegram_chat_id.tooltip": "Leave it blank to use the default chat ID provided by the selected authorization.",
|
"workflow_node.notify.form.telegram_bot_chat_id.tooltip": "Leave it blank to use the default chat ID provided by the selected authorization.",
|
||||||
"workflow_node.notify.form.webhook_data.label": "Webhook data (Optional)",
|
"workflow_node.notify.form.webhook_data.label": "Webhook data (Optional)",
|
||||||
"workflow_node.notify.form.webhook_data.placeholder": "Please enter Webhook data to override the default value",
|
"workflow_node.notify.form.webhook_data.placeholder": "Please enter Webhook data to override the default value",
|
||||||
"workflow_node.notify.form.webhook_data.tooltip": "Leave it blank to use the default Webhook data provided by the authorization.",
|
"workflow_node.notify.form.webhook_data.tooltip": "Leave it blank to use the default Webhook data provided by the authorization.",
|
||||||
|
@@ -334,12 +334,12 @@
|
|||||||
"access.form.sslcom_eab_hmac_key.label": "ACME EAB HMAC key",
|
"access.form.sslcom_eab_hmac_key.label": "ACME EAB HMAC key",
|
||||||
"access.form.sslcom_eab_hmac_key.placeholder": "请输入 ACME EAB HMAC key",
|
"access.form.sslcom_eab_hmac_key.placeholder": "请输入 ACME EAB HMAC key",
|
||||||
"access.form.sslcom_eab_hmac_key.tooltip": "这是什么?请参阅 <a href=\"https://www.ssl.com/how-to/generate-acme-credentials-for-reseller-customers/#ftoc-heading-6\" target=\"_blank\">https://www.ssl.com/how-to/generate-acme-credentials-for-reseller-customers/</a>",
|
"access.form.sslcom_eab_hmac_key.tooltip": "这是什么?请参阅 <a href=\"https://www.ssl.com/how-to/generate-acme-credentials-for-reseller-customers/#ftoc-heading-6\" target=\"_blank\">https://www.ssl.com/how-to/generate-acme-credentials-for-reseller-customers/</a>",
|
||||||
"access.form.telegram_bot_token.label": "Telegram 机器人 API Token",
|
"access.form.telegram_bot_token.label": "Telegram 群机器人 API Token",
|
||||||
"access.form.telegram_bot_token.placeholder": "请输入 Telegram 机器人 API Token",
|
"access.form.telegram_bot_token.placeholder": "请输入 Telegram 群机器人 API Token",
|
||||||
"access.form.telegram_bot_token.tooltip": "如何获取机器人 API Token?请参阅 <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
"access.form.telegram_bot_token.tooltip": "如何获取机器人 API Token?请参阅 <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
||||||
"access.form.telegram_default_chat_id.label": "默认的 Telegram 会话 ID(可选)",
|
"access.form.telegram_bot_default_chat_id.label": "默认的 Telegram 会话 ID(可选)",
|
||||||
"access.form.telegram_default_chat_id.placeholder": "请输入默认的 Telegram 会话 ID",
|
"access.form.telegram_bot_default_chat_id.placeholder": "请输入默认的 Telegram 会话 ID",
|
||||||
"access.form.telegram_default_chat_id.tooltip": "如何获取会话 ID?请参阅 <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
"access.form.telegram_bot_default_chat_id.tooltip": "如何获取会话 ID?请参阅 <a href=\"https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a\" target=\"_blank\">https://gist.github.com/nafiesl/4ad622f344cd1dc3bb1ecbe468ff9f8a</a>",
|
||||||
"access.form.tencentcloud_secret_id.label": "腾讯云 SecretId",
|
"access.form.tencentcloud_secret_id.label": "腾讯云 SecretId",
|
||||||
"access.form.tencentcloud_secret_id.placeholder": "请输入腾讯云 SecretId",
|
"access.form.tencentcloud_secret_id.placeholder": "请输入腾讯云 SecretId",
|
||||||
"access.form.tencentcloud_secret_id.tooltip": "这是什么?请参阅 <a href=\"https://cloud.tencent.com/document/product/598/40488\" target=\"_blank\">https://cloud.tencent.com/document/product/598/40488</a>",
|
"access.form.tencentcloud_secret_id.tooltip": "这是什么?请参阅 <a href=\"https://cloud.tencent.com/document/product/598/40488\" target=\"_blank\">https://cloud.tencent.com/document/product/598/40488</a>",
|
||||||
|
@@ -106,7 +106,7 @@
|
|||||||
"provider.safeline": "雷池",
|
"provider.safeline": "雷池",
|
||||||
"provider.ssh": "SSH 部署",
|
"provider.ssh": "SSH 部署",
|
||||||
"provider.sslcom": "SSL.com",
|
"provider.sslcom": "SSL.com",
|
||||||
"provider.telegram": "Telegram",
|
"provider.telegrambot": "Telegram 群机器人",
|
||||||
"provider.tencentcloud": "腾讯云",
|
"provider.tencentcloud": "腾讯云",
|
||||||
"provider.tencentcloud.cdn": "腾讯云 - 内容分发网络 CDN",
|
"provider.tencentcloud.cdn": "腾讯云 - 内容分发网络 CDN",
|
||||||
"provider.tencentcloud.clb": "腾讯云 - 负载均衡 CLB",
|
"provider.tencentcloud.clb": "腾讯云 - 负载均衡 CLB",
|
||||||
|
@@ -775,9 +775,9 @@
|
|||||||
"workflow_node.notify.form.mattermost_channel_id.label": "Mattermost 频道 ID(可选)",
|
"workflow_node.notify.form.mattermost_channel_id.label": "Mattermost 频道 ID(可选)",
|
||||||
"workflow_node.notify.form.mattermost_channel_id.placeholder": "请输入 Mattermost 频道 ID 以覆盖默认值",
|
"workflow_node.notify.form.mattermost_channel_id.placeholder": "请输入 Mattermost 频道 ID 以覆盖默认值",
|
||||||
"workflow_node.notify.form.mattermost_channel_id.tooltip": "不填写时,将使用所选通知渠道授权的默认频道 ID。",
|
"workflow_node.notify.form.mattermost_channel_id.tooltip": "不填写时,将使用所选通知渠道授权的默认频道 ID。",
|
||||||
"workflow_node.notify.form.telegram_chat_id.label": "Telegram 会话 ID(可选)",
|
"workflow_node.notify.form.telegram_bot_chat_id.label": "Telegram 会话 ID(可选)",
|
||||||
"workflow_node.notify.form.telegram_chat_id.placeholder": "请输入 Telegram 会话 ID 以覆盖默认值",
|
"workflow_node.notify.form.telegram_bot_chat_id.placeholder": "请输入 Telegram 会话 ID 以覆盖默认值",
|
||||||
"workflow_node.notify.form.telegram_chat_id.tooltip": "不填写时,将使用所选通知渠道授权的默认会话 ID。",
|
"workflow_node.notify.form.telegram_bot_chat_id.tooltip": "不填写时,将使用所选通知渠道授权的默认会话 ID。",
|
||||||
"workflow_node.notify.form.webhook_data.label": "Webhook 回调数据(可选)",
|
"workflow_node.notify.form.webhook_data.label": "Webhook 回调数据(可选)",
|
||||||
"workflow_node.notify.form.webhook_data.placeholder": "请输入 Webhook 回调数据以覆盖默认值",
|
"workflow_node.notify.form.webhook_data.placeholder": "请输入 Webhook 回调数据以覆盖默认值",
|
||||||
"workflow_node.notify.form.webhook_data.tooltip": "不填写时,将使用所选部署目标授权的默认 Webhook 回调数据。",
|
"workflow_node.notify.form.webhook_data.tooltip": "不填写时,将使用所选部署目标授权的默认 Webhook 回调数据。",
|
||||||
|
Reference in New Issue
Block a user