add category & savepath params for torrents

This commit is contained in:
2026-03-19 22:36:52 +03:00
parent b92a1216f0
commit 5fda73a258

10
main.go
View File

@@ -373,7 +373,15 @@ func main() {
return
}
if err := torrentClient.AddTorrentFromMemory(data, map[string]string{}); err != nil {
opts := make(map[string]string)
if category, ok := os.LookupEnv("QBITTORRENT_CATEGORY"); ok {
opts["category"] = category
}
if savePath, ok := os.LookupEnv("QBITTORRENT_SAVEPATH"); ok {
opts["savepath"] = savePath
}
if err := torrentClient.AddTorrentFromMemory(data, opts); err != nil {
http.Error(w, err.Error(), 500)
return
}