mirror of
https://github.com/AlistGo/alist.git
synced 2025-05-07 07:12:31 +08:00

* feat(qbittorrent): authorization and logging in support * feat(qbittorrent/client): support `AddFromLink` * refactor(qbittorrent/client): check authorization when getting a new client * feat(qbittorrent/client): support `GetInfo` * test(qbittorrent/client): update test cases * feat(qbittorrent): init qbittorrent client on bootstrap * feat(qbittorrent): support setting webui url via gin * feat(qbittorrent/client): support deleting * feat(qbittorrent/client): parse `TorrentStatus` enum when unmarshalling json in `GetInfo()` * feat(qbittorrent/client): support getting files by id * feat(qbittorrent): support adding qbittorrent tasks via gin * refactor(qbittorrent/client): return a `Client` interface in `New()` instead of `*client` * refactor: task handle * chore: fix typo * chore: change path --------- Co-authored-by: Andy Hsu <i@nn.ci>
24 lines
448 B
Go
24 lines
448 B
Go
package qbittorrent
|
|
|
|
import (
|
|
"github.com/alist-org/alist/v3/internal/conf"
|
|
"github.com/alist-org/alist/v3/internal/setting"
|
|
"github.com/alist-org/alist/v3/pkg/task"
|
|
)
|
|
|
|
var DownTaskManager = task.NewTaskManager[string](3)
|
|
var qbclient Client
|
|
|
|
func InitClient() error {
|
|
var err error
|
|
qbclient = nil
|
|
|
|
url := setting.GetStr(conf.QbittorrentUrl)
|
|
qbclient, err = New(url)
|
|
return err
|
|
}
|
|
|
|
func IsQbittorrentReady() bool {
|
|
return qbclient != nil
|
|
}
|