fix: resolve message sending failure when containing "\n" using webhook and custom channel (#111)

* 使用webhook和custom通道发送消息时如果内容中包含\n会推送失败的问题

* 消息查看页面增加markdown内容解析,访问链接页面增加GFM拓展解析

* 访问链接页面GFM footnote支持
This commit is contained in:
fghwett
2024-11-10 10:58:12 +08:00
committed by GitHub
parent d5cceb9589
commit ef7c2d0a9d
4 changed files with 21 additions and 8 deletions
+5 -5
View File
@@ -18,11 +18,11 @@ func SendCustomMessage(message *model.Message, user *model.User, channel_ *model
return errors.New("自定义通道不能使用本服务地址")
}
template := channel_.Other
template = strings.Replace(template, "$url", message.URL, -1)
template = strings.Replace(template, "$to", message.To, -1)
template = strings.Replace(template, "$title", message.Title, -1)
template = strings.Replace(template, "$description", message.Description, -1)
template = strings.Replace(template, "$content", message.Content, -1)
template = common.Replace(template, "$url", message.URL, -1)
template = common.Replace(template, "$to", message.To, -1)
template = common.Replace(template, "$title", message.Title, -1)
template = common.Replace(template, "$description", message.Description, -1)
template = common.Replace(template, "$content", message.Content, -1)
reqBody := []byte(template)
resp, err := http.Post(url, "application/json", bytes.NewReader(reqBody))
if err != nil {