From fc5895091a4ba63bf1e2fd11f33f5c3b996212fc Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 6 Jul 2022 10:55:39 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=85=AC=E6=B5=8B=E4=BA=91=E7=AB=AF?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=95=B0=E6=8D=AE=E4=BB=93=E5=BA=93=20https:?= =?UTF-8?q?//github.com/siyuan-note/siyuan/issues/5337?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/config/repos.ts | 10 +++++++++- kernel/model/sync.go | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/src/config/repos.ts b/app/src/config/repos.ts index d8093a070..796c54151 100644 --- a/app/src/config/repos.ts +++ b/app/src/config/repos.ts @@ -518,8 +518,16 @@ ${passwordHTML} target.parentElement.setAttribute("disabled", "disabled"); fetchPost("/api/sync/getSyncDirection", {name: target.getAttribute("data-name")}, (response) => { target.parentElement.removeAttribute("disabled"); + const name = target.getAttribute("data-name"); + if (40 == response.code) { // 使用数据仓库同步不需要对比同步方向 + fetchPost("/api/sync/setCloudSyncDir", {name}, () => { + window.siyuan.config.sync.cloudName = name; + getCloudList(true); + }); + return + } + confirmDialog(window.siyuan.languages.confirm, response.msg, () => { - const name = target.getAttribute("data-name"); fetchPost("/api/sync/setCloudSyncDir", {name}, () => { window.siyuan.config.sync.cloudName = name; getCloudList(true); diff --git a/kernel/model/sync.go b/kernel/model/sync.go index 067932987..67881e5da 100644 --- a/kernel/model/sync.go +++ b/kernel/model/sync.go @@ -1354,7 +1354,7 @@ func pathSha256Short(p, sep string) string { return buf.String() } -func GetSyncDirection(cloudDirName string) (code int, msg string) { // 0:失败,10:上传,20:下载,30:一致 +func GetSyncDirection(cloudDirName string) (code int, msg string) { // 0:失败,10:上传,20:下载,30:一致,40:使用数据仓库同步 if !IsSubscriber() { return } @@ -1367,6 +1367,10 @@ func GetSyncDirection(cloudDirName string) (code int, msg string) { // 0:失 return } + if Conf.Sync.UseDataRepo { + return 40, "" + } + syncConf, err := getWorkspaceDataConf() if nil != err { msg = fmt.Sprintf(Conf.Language(80), formatErrorMsg(err))