mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 HTTPS certificate is no longer verified when Convert network images to local images https://github.com/siyuan-note/siyuan/issues/9080
This commit is contained in:
parent
8d66c57799
commit
2f2d617929
1 changed files with 10 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ import (
|
|||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/88250/lute/ast"
|
||||
|
|
@ -37,6 +38,7 @@ import (
|
|||
"github.com/88250/lute/parse"
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/gabriel-vasile/mimetype"
|
||||
"github.com/imroc/req/v3"
|
||||
"github.com/siyuan-note/filelock"
|
||||
"github.com/siyuan-note/httpclient"
|
||||
"github.com/siyuan-note/logging"
|
||||
|
|
@ -88,6 +90,12 @@ func NetImg2LocalAssets(rootID, originalURL string) (err error) {
|
|||
}
|
||||
}
|
||||
|
||||
browserClient := req.C().
|
||||
SetUserAgent(util.UserAgent).
|
||||
SetTimeout(30 * time.Second).
|
||||
EnableInsecureSkipVerify(). // HTTPS certificate is no longer verified when `Convert network images to local images` https://github.com/siyuan-note/siyuan/issues/9080
|
||||
SetProxy(httpclient.ProxyFromEnvironment)
|
||||
|
||||
ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
if !entering {
|
||||
return ast.WalkContinue
|
||||
|
|
@ -140,7 +148,8 @@ func NetImg2LocalAssets(rootID, originalURL string) (err error) {
|
|||
//}
|
||||
}
|
||||
util.PushUpdateMsg(msgId, fmt.Sprintf(Conf.Language(119), u), 15000)
|
||||
request := httpclient.NewBrowserRequest()
|
||||
request := browserClient.R()
|
||||
request.SetRetryCount(1).SetRetryFixedInterval(3 * time.Second)
|
||||
if "" != originalURL {
|
||||
request.SetHeader("Referer", originalURL) // 改进浏览器剪藏扩展转换本地图片成功率 https://github.com/siyuan-note/siyuan/issues/7464
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue