Apply compat patch

This commit is contained in:
yusing
2026-03-10 15:01:07 +08:00
parent 291fe67c31
commit 0bd134cf47
59 changed files with 261 additions and 266 deletions

View File

@@ -2,12 +2,12 @@ package notif
import (
_ "embed"
"encoding/json"
"errors"
"io"
"net/http"
"strings"
"github.com/bytedance/sonic"
gperr "github.com/yusing/goutils/errs"
)
@@ -101,7 +101,7 @@ func (webhook *Webhook) fmtError(respBody io.Reader) error {
}
func (webhook *Webhook) MarshalMessage(logMsg *LogMessage) ([]byte, error) {
title, err := sonic.Marshal(logMsg.Title)
title, err := json.Marshal(logMsg.Title)
if err != nil {
return nil, err
}
@@ -120,7 +120,7 @@ func (webhook *Webhook) MarshalMessage(logMsg *LogMessage) ([]byte, error) {
return nil, err
}
if webhook.MIMEType == MimeTypeJSON {
message, err = sonic.Marshal(string(message))
message, err = json.Marshal(string(message))
if err != nil {
return nil, err
}
@@ -149,5 +149,5 @@ func validateJSONPayload(payload string) bool {
"$color", "",
)
payload = replacer.Replace(payload)
return sonic.Valid([]byte(payload))
return json.Valid([]byte(payload))
}