feat: improve subscription and download cards

This commit is contained in:
ShukeBta
2026-05-28 23:27:34 +08:00
parent f457d0050e
commit c1b5dac784
20 changed files with 1239 additions and 204 deletions
+18 -1
View File
@@ -247,13 +247,30 @@ func (q *QBitClient) addTorrentLocked(ctx context.Context, magnetOrURL string, t
}
}
q.log.Info("qbittorrent: torrent added",
zap.String("url", magnetOrURL),
zap.String("url", redactTorrentURL(magnetOrURL)),
zap.String("save_path", savePath),
zap.Bool("file_upload", useFileUpload),
zap.String("body", bodyText))
return nil
}
func redactTorrentURL(raw string) string {
raw = strings.TrimSpace(raw)
if raw == "" {
return ""
}
if strings.HasPrefix(strings.ToLower(raw), "magnet:") {
return "magnet:?xt=***"
}
u, err := url.Parse(raw)
if err != nil || u.Host == "" {
return "[redacted-download-url]"
}
u.RawQuery = ""
u.Fragment = ""
return u.String()
}
func (q *QBitClient) fetchTorrentFile(ctx context.Context, raw string) ([]byte, string, error) {
u, err := url.Parse(strings.TrimSpace(raw))
if err != nil || u.Host == "" {