fix(189): enable `TlsInsecureSkipVerify` (close #4355)

pull/4360/head
Andy Hsu 2023-05-11 18:48:16 +08:00
parent ea88998325
commit e15755fef0
2 changed files with 7 additions and 5 deletions

View File

@ -30,11 +30,8 @@ func (d *Cloud189) GetAddition() driver.Additional {
}
func (d *Cloud189) Init(ctx context.Context) error {
d.client = resty.New().
SetTimeout(base.DefaultTimeout).
SetRetryCount(3).
SetHeader("Referer", "https://cloud.189.cn/").
SetHeader("User-Agent", base.UserAgent)
d.client = base.NewRestyClient().
SetHeader("Referer", "https://cloud.189.cn/")
return d.login()
}

View File

@ -1,9 +1,11 @@
package base
import (
"crypto/tls"
"net/http"
"time"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/go-resty/resty/v2"
)
@ -27,5 +29,8 @@ func NewRestyClient() *resty.Client {
SetHeader("user-agent", UserAgent).
SetRetryCount(3).
SetTimeout(DefaultTimeout)
if conf.Conf.TlsInsecureSkipVerify {
client = client.SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true})
}
return client
}