🎨 Improve network online check of data sync Fix https://github.com/siyuan-note/siyuan/issues/7890

This commit is contained in:
Liang Ding 2023-04-05 19:54:13 +08:00
parent d99e8cad9b
commit 635eb66da9
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 13 additions and 6 deletions

View file

@ -563,18 +563,21 @@ func planSyncAfter(d time.Duration) {
func isProviderOnline() (ret bool) {
checkURL := util.SiYuanSyncServer
skipTlsVerify := false
switch Conf.Sync.Provider {
case conf.ProviderSiYuan:
case conf.ProviderS3:
checkURL = Conf.Sync.S3.Endpoint
skipTlsVerify = Conf.Sync.S3.SkipTlsVerify
case conf.ProviderWebDAV:
checkURL = Conf.Sync.WebDAV.Endpoint
skipTlsVerify = Conf.Sync.WebDAV.SkipTlsVerify
default:
logging.LogWarnf("unknown provider: %d", Conf.Sync.Provider)
return false
}
if ret = util.IsOnline(checkURL); !ret {
if ret = util.IsOnline(checkURL, skipTlsVerify); !ret {
util.PushErrMsg(Conf.Language(76), 5000)
}
return