diff --git a/channel/custom.go b/channel/custom.go index 830f96abf..7e96daacc 100644 --- a/channel/custom.go +++ b/channel/custom.go @@ -3,6 +3,7 @@ package channel import ( "bytes" "errors" + "message-pusher/common" "message-pusher/model" "net/http" "strings" @@ -13,6 +14,9 @@ func SendCustomMessage(message *model.Message, user *model.User, channel_ *model if strings.HasPrefix(url, "http:") { return errors.New("自定义通道必须使用 HTTPS 协议") } + if strings.HasPrefix(url, common.ServerAddress) { + return errors.New("自定义通道不能使用本服务地址") + } template := channel_.Other template = strings.Replace(template, "$url", message.URL, -1) template = strings.Replace(template, "$to", message.To, -1)