feat: add bark encrypt message

This commit is contained in:
engigu
2026-01-22 19:16:24 +08:00
parent f0bbef5541
commit ea6af44f0c
4 changed files with 65 additions and 3 deletions
@@ -37,6 +37,8 @@ func (c *BarkChannel) SendUnified(msgObj interface{}, ins models.SendTasksIns, c
Icon: auth.Icon,
Level: auth.Level,
URL: auth.URL,
Key: auth.Key,
IV: auth.IV,
}
res, err := cli.Request(content.Title, content.Text)
+5 -1
View File
@@ -297,6 +297,8 @@ type WayDetailBark struct {
Icon string `json:"icon" validate:"max=200" label:"推送图标"`
Level string `json:"level" validate:"max=20" label:"推送时效性"`
URL string `json:"url" validate:"max=200" label:"推送跳转URL"`
Key string `json:"key" validate:"max=100" label:"加密Key"`
IV string `json:"iv" validate:"max=100" label:"加密IV"`
}
func (w *WayDetailBark) Validate(authJson string) (string, interface{}) {
@@ -319,6 +321,8 @@ func (w *WayDetailBark) Test() (string, string) {
Icon: w.Icon,
Level: w.Level,
URL: w.URL,
Key: w.Key,
IV: w.IV,
}
res, err := cli.Request("Test Message", testMsg)
if err != nil {
@@ -376,7 +380,7 @@ func (sw *SendWay) Delete() error {
for _, task := range tasks {
names = append(names, task.Name)
}
return errors.New(fmt.Sprintf("已经存在使用的任务,删除失败!任务名:%s", strings.Join(names, ", ")))
return fmt.Errorf("已经存在使用的任务,删除失败!任务名:%s", strings.Join(names, ", "))
}
return models.DeleteMsgWay(sw.ID)
}