Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 支持多设备操作不同文档后云端同步合并 https://github.com/siyuan-note/siyuan/issues/5092

Liang Ding770686f5c0fc
diff --git a/kernel/model/backup.go b/kernel/model/backup.go
index 3593d7e542..4eab44826f 100644
--- a/kernel/model/backup.go
+++ b/kernel/model/backup.go
@@ -344,7 +344,7 @@ func DownloadBackup() (err error) {
localDirPath := Conf.Backup.GetSaveDir()
util.PushEndlessProgress(Conf.Language(68))
start := time.Now()
- fetchedFilesCount, transferSize, _, err := ossDownload(localDirPath, "backup", false, map[string]bool{}, map[string]bool{})
+ fetchedFilesCount, transferSize, _, err := ossDownload(localDirPath, "backup", false)
if nil == err {
elapsed := time.Now().Sub(start).Seconds()
util.LogInfof("downloaded backup [fetchedFiles=%d, transferSize=%s] in [%.2fs]", fetchedFilesCount, humanize.Bytes(transferSize), elapsed)
@@ -364,7 +364,7 @@ func UploadBackup() (err error) {
util.PushEndlessProgress(Conf.Language(61))
util.LogInfof("uploading backup...")
start := time.Now()
- wroteFiles, transferSize, err := ossUpload(true, localDirPath, "backup", "not exist", false, map[string]bool{}, map[string]bool{})
+ wroteFiles, transferSize, err := ossUpload(true, localDirPath, "backup", "not exist", false)
if nil == err {
elapsed := time.Now().Sub(start).Seconds()
util.LogInfof("uploaded backup [wroteFiles=%d, transferSize=%s] in [%.2fs]", wroteFiles, humanize.Bytes(transferSize), elapsed)
diff --git a/kernel/model/osssync.go b/kernel/model/osssync.go
index 50b0b97856..0c7d847c16 100644
--- a/kernel/model/osssync.go
+++ b/kernel/model/osssync.go
@@ -162,7 +162,7 @@ func listCloudSyncDirOSS() (dirs []map[string]interface{}, size int64, err error
return
}
-func ossDownload(localDirPath, cloudDirPath string, bootOrExit bool, removeList, upsertList map[string]bool) (fetchedFilesCount int, transferSize uint64, downloadedFiles map[string]bool, err error) {
+func ossDownload(localDirPath, cloudDirPath string, bootOrExit bool) (fetchedFilesCount int, transferSize uint64, downloadedFiles map[string]bool, err error) {
if !gulu.File.IsExist(localDirPath) {
return
}
@@ -340,7 +340,7 @@ func ossDownload0(localDirPath, cloudDirPath, fetch string, fetchedFiles *int, t
return
}
-func ossUpload(isBackup bool, localDirPath, cloudDirPath, cloudDevice string, boot bool, removeList, upsertList map[string]bool) (wroteFiles int, transferSize uint64, err error) {
+func ossUpload(isBackup bool, localDirPath, cloudDirPath, cloudDevice string, boot bool) (wroteFiles int, transferSize uint64, err error) {
if !gulu.File.IsExist(localDirPath) {
return
}
diff --git a/kernel/model/sync.go b/kernel/model/sync.go
index 3caad4eaad..c4955e5925 100644
--- a/kernel/model/sync.go
+++ b/kernel/model/sync.go
@@ -135,9 +135,8 @@ func SyncData(boot, exit, byHand bool) {
WaitForWritingFiles()
writingDataLock.Lock()
var err error
- var removeList, upsertList map[string]bool
// 将 data 变更同步到 sync
- if removeList, upsertList, err = workspaceData2SyncDir(); nil != err {
+ if _, _, err = workspaceData2SyncDir(); nil != err {
msg := fmt.Sprintf(Conf.Language(80), formatErrorMsg(err))
Conf.Sync.Stat = msg
util.PushErrMsg(msg, 7000)
@@ -246,7 +245,7 @@ func SyncData(boot, exit, byHand bool) {
return
}
- wroteFiles, transferSize, err := ossUpload(false, localSyncDirPath, "sync/"+Conf.Sync.CloudName, device, boot, removeList, upsertList)
+ wroteFiles, transferSize, err := ossUpload(false, localSyncDirPath, "sync/"+Conf.Sync.CloudName, device, boot)
if nil != err {
util.PushClearProgress()
IncWorkspaceDataVer() // 上传失败的话提升本地版本,以备下次上传
@@ -329,7 +328,7 @@ func SyncData(boot, exit, byHand bool) {
return
}
- fetchedFilesCount, transferSize, downloadedFiles, err := ossDownload(localSyncDirPath, "sync/"+Conf.Sync.CloudName, boot || exit, removeList, upsertList)
+ fetchedFilesCount, transferSize, downloadedFiles, err := ossDownload(localSyncDirPath, "sync/"+Conf.Sync.CloudName, boot || exit)
if nil != err {
util.PushClearProgress()
msg := fmt.Sprintf(Conf.Language(80), formatErrorMsg(err))