mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-04-28 14:20:11 -05:00
🎨 Data sync connectivity check supports redirection Fix https://github.com/siyuan-note/siyuan/issues/8264
This commit is contained in:
@@ -139,7 +139,7 @@ func BootSyncData() {
|
||||
|
||||
if !isProviderOnline(false) {
|
||||
BootSyncSucc = 1
|
||||
util.PushErrMsg(Conf.Language(28), 7000)
|
||||
util.PushErrMsg(Conf.Language(76), 7000)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
+13
-1
@@ -57,7 +57,19 @@ func isOnline(checkURL string, skipTlsVerify bool) (ret bool) {
|
||||
}
|
||||
|
||||
for i := 0; i < 3; i++ {
|
||||
_, err := c.R().Get(checkURL)
|
||||
resp, err := c.R().Get(checkURL)
|
||||
if resp.GetHeader("Location") != "" {
|
||||
return true
|
||||
}
|
||||
|
||||
switch err.(type) {
|
||||
case *url.Error:
|
||||
if err.(*url.Error).URL != checkURL {
|
||||
// DNS 重定向
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
ret = nil == err
|
||||
if ret {
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user