mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(downloadclients): Porla support preset (#978)
* Correctly omit download/upload limits * Prefix JWT correctly * Allow setting Porla preset
This commit is contained in:
parent
956225c108
commit
3d9839d234
4 changed files with 49 additions and 27 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/autobrr/autobrr/pkg/jsonrpc"
|
||||
|
@ -75,9 +76,15 @@ func NewClient(cfg Config) *Client {
|
|||
Transport: customTransport,
|
||||
}
|
||||
|
||||
token := cfg.AuthToken
|
||||
|
||||
if !strings.HasPrefix(token, "Bearer ") {
|
||||
token = "Bearer " + token
|
||||
}
|
||||
|
||||
c.rpcClient = jsonrpc.NewClientWithOpts(cfg.Hostname+"/api/v1/jsonrpc", &jsonrpc.ClientOpts{
|
||||
Headers: map[string]string{
|
||||
"X-Porla-Token": cfg.AuthToken,
|
||||
"X-Porla-Token": token,
|
||||
},
|
||||
HTTPClient: httpClient,
|
||||
BasicUser: cfg.BasicUser,
|
||||
|
|
|
@ -13,11 +13,12 @@ type SysVersionsPorla struct {
|
|||
}
|
||||
|
||||
type TorrentsAddReq struct {
|
||||
DownloadLimit int64 `json:"download_limit,omitempty"`
|
||||
SavePath string `json:"save_path,omitempty"`
|
||||
Ti string `json:"ti,omitempty"`
|
||||
MagnetUri string `json:"magnet_uri,omitempty"`
|
||||
UploadLimit int64 `json:"upload_limit,omitempty"`
|
||||
DownloadLimit *int64 `json:"download_limit,omitempty"`
|
||||
SavePath string `json:"save_path,omitempty"`
|
||||
Ti string `json:"ti,omitempty"`
|
||||
MagnetUri string `json:"magnet_uri,omitempty"`
|
||||
UploadLimit *int64 `json:"upload_limit,omitempty"`
|
||||
Preset *string `json:"preset,omitempty"`
|
||||
}
|
||||
|
||||
type TorrentsAddRes struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue