refactor: extract path logic to path.go and run go fmt on codebase

This commit is contained in:
duorameng
2026-05-22 14:52:51 +08:00
parent b6fd889661
commit 4c283a60d5
55 changed files with 409 additions and 420 deletions
+3 -3
View File
@@ -96,17 +96,17 @@ func (b *Bark) Request(title, content string) ([]byte, error) {
encryptData[k] = v
}
}
jsonData, err := json.Marshal(encryptData)
if err != nil {
return nil, err
}
ciphertext, err := b.encryptPayload(string(jsonData))
if err != nil {
return nil, fmt.Errorf("encryption failed: %v", err)
}
postData = map[string]interface{}{
"ciphertext": ciphertext,
"iv": b.IV,
+1 -1
View File
@@ -27,7 +27,7 @@ func (v *VoceChat) Request(title, content string) ([]byte, error) {
}
url := fmt.Sprintf("%s/api/bot/%s/%s", server, endpoint, v.TargetID)
// Use text/plain for now as requested
body := content
if title != "" {
+9 -9
View File
@@ -15,15 +15,15 @@ func (c *BarkChannel) Send(config ChannelConfig, msg *Message) (*Result, error)
}
cli := message.Bark{
PushKey: pushKey,
Archive: config.GetString("archive"),
Group: config.GetString("group"),
Sound: config.GetString("sound"),
Icon: config.GetString("icon"),
Level: config.GetString("level"),
URL: config.GetString("url"),
Key: config.GetString("key"),
IV: config.GetString("iv"),
PushKey: pushKey,
Archive: config.GetString("archive"),
Group: config.GetString("group"),
Sound: config.GetString("sound"),
Icon: config.GetString("icon"),
Level: config.GetString("level"),
URL: config.GetString("url"),
Key: config.GetString("key"),
IV: config.GetString("iv"),
Server: config.GetString("server"),
Badge: config.GetString("badge"),
Copy: config.GetString("copy"),
+1 -1
View File
@@ -22,7 +22,7 @@ func NewBaseChannel(channelType string, supportedFormats []string) *BaseChannel
return &BaseChannel{channelType: channelType, supportedFormats: supportedFormats}
}
func (c *BaseChannel) GetType() string { return c.channelType }
func (c *BaseChannel) GetType() string { return c.channelType }
func (c *BaseChannel) GetSupportedFormats() []string { return c.supportedFormats }
// FormatContent 根据渠道支持的格式选择最佳内容
+1 -1
View File
@@ -54,7 +54,7 @@ func (c *WxPusherChannel) Send(config ChannelConfig, msg *Message) (*Result, err
}
_, formattedContent := c.FormatContent(msg)
// 如果有标题,将标题和内容合并
content := formattedContent
if msg.Title != "" {