Skip to content

Commit

Permalink
🎨 公测云端同步数据仓库 #5337
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Jul 6, 2022
1 parent 5e8ca37 commit fc58950
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion app/src/config/repos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion kernel/model/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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))
Expand Down

0 comments on commit fc58950

Please sign in to comment.