🎨 Data synchronization supports the multi-kernel online perception https://github.com/siyuan-note/siyuan/issues/8518

This commit is contained in:
Daniel 2023-06-12 08:25:16 +08:00
parent 84d551bdd5
commit 4e643e6af8
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 14 additions and 6 deletions

View file

@ -1,5 +1,6 @@
import {needSubscribe} from "../util/needSubscribe";
import {fetchPost} from "../util/fetch";
import {isBrowser} from "../util/functions";
import {showMessage} from "../dialog/message";
import {bindSyncCloudListEvent, getSyncCloudList} from "../sync/syncGuide";
import {hasClosestByClassName} from "../protyle/util/hasClosest";
@ -307,7 +308,7 @@ export const repos = {
<option value="3" ${window.siyuan.config.sync.mode === 3 ? "selected" : ""}>${window.siyuan.languages.syncMode3}</option>
</select>
</label>
<label class="fn__flex b3-label">
<label class="fn__flex b3-label${isBrowser() ? " fn__none" : " fn__flex"}">
<div class="fn__flex-1">
${window.siyuan.languages.syncPerception}
<div class="b3-label__text">${window.siyuan.languages.syncPerceptionTip}</div>

View file

@ -284,6 +284,9 @@ func InitConf() {
}
Conf.Sync.WebDAV.Endpoint = util.NormalizeEndpoint(Conf.Sync.WebDAV.Endpoint)
Conf.Sync.WebDAV.Timeout = util.NormalizeTimeout(Conf.Sync.WebDAV.Timeout)
if util.ContainerDocker == util.Container {
Conf.Sync.Perception = false
}
if nil == Conf.Api {
Conf.Api = conf.NewAPI()

View file

@ -372,6 +372,10 @@ func SetSyncEnable(b bool) {
}
func SetSyncPerception(b bool) {
if util.ContainerDocker == util.Container {
b = false
}
Conf.Sync.Perception = b
Conf.Save()
@ -717,16 +721,16 @@ func connectSyncWebSocket() {
reconnected := false
for retries := 0; retries < 7; retries++ {
time.Sleep(7 * time.Second)
logging.LogWarnf("reconnecting sync websocket...")
//logging.LogInfof("reconnecting sync websocket...")
webSocketConn, dialErr = dialSyncWebSocket()
if nil != dialErr {
logging.LogWarnf("reconnect sync websocket failed: %s", dialErr)
continue
} else {
logging.LogInfof("sync websocket reconnected")
reconnected = true
break
}
logging.LogInfof("sync websocket reconnected")
reconnected = true
break
}
if !reconnected {
logging.LogWarnf("reconnect sync websocket failed, do not retry")