设置代理切换时不再需要重启 https://github.com/siyuan-note/siyuan/issues/6787
This commit is contained in:
Liang Ding 2022-12-05 22:59:59 +08:00
parent 9f463fec1e
commit 74453a20bb
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
8 changed files with 40 additions and 59 deletions

View file

@ -39,6 +39,7 @@ import (
"github.com/siyuan-note/dejavu/entity"
"github.com/siyuan-note/encryption"
"github.com/siyuan-note/eventbus"
"github.com/siyuan-note/httpclient"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/cache"
"github.com/siyuan-note/siyuan/kernel/conf"
@ -831,7 +832,7 @@ func newRepository() (ret *dejavu.Repo, err error) {
case conf.ProviderSiYuan:
cloudRepo = cloud.NewSiYuan(&cloud.BaseCloud{Conf: cloudConf})
case conf.ProviderS3:
s3HTTPClient := &http.Client{Transport: util.NewTransport(cloudConf.S3.SkipTlsVerify)}
s3HTTPClient := &http.Client{Transport: httpclient.NewTransport(cloudConf.S3.SkipTlsVerify)}
s3HTTPClient.Timeout = time.Duration(cloudConf.S3.Timeout) * time.Second
cloudRepo = cloud.NewS3(&cloud.BaseCloud{Conf: cloudConf}, s3HTTPClient)
case conf.ProviderWebDAV:
@ -841,7 +842,7 @@ func newRepository() (ret *dejavu.Repo, err error) {
webdavClient.SetHeader("Authorization", auth)
webdavClient.SetHeader("User-Agent", util.UserAgent)
webdavClient.SetTimeout(time.Duration(cloudConf.WebDAV.Timeout) * time.Second)
webdavClient.SetTransport(util.NewTransport(cloudConf.WebDAV.SkipTlsVerify))
webdavClient.SetTransport(httpclient.NewTransport(cloudConf.WebDAV.SkipTlsVerify))
cloudRepo = cloud.NewWebDAV(&cloud.BaseCloud{Conf: cloudConf}, webdavClient)
default:
err = fmt.Errorf("unknown cloud provider [%d]", Conf.Sync.Provider)