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/6445

Liang Dingf3d7568b52c9
diff --git a/kernel/model/sync.go b/kernel/model/sync.go
index eb578ec888..b783a09048 100644
--- a/kernel/model/sync.go
+++ b/kernel/model/sync.go
@@ -30,6 +30,7 @@ import (
"github.com/dustin/go-humanize"
"github.com/siyuan-note/dejavu/cloud"
"github.com/siyuan-note/logging"
+ "github.com/siyuan-note/siyuan/kernel/conf"
"github.com/siyuan-note/siyuan/kernel/sql"
"github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util"
@@ -69,7 +70,11 @@ func BootSyncData() {
util.IncBootProgress(3, "Syncing data from the cloud...")
BootSyncSucc = 0
- if !IsSubscriber() || !Conf.Sync.Enabled || "" == Conf.Sync.CloudName || !cloud.IsValidCloudDirName(Conf.Sync.CloudName) {
+ if !Conf.Sync.Enabled || !cloud.IsValidCloudDirName(Conf.Sync.CloudName) {
+ return
+ }
+
+ if !IsSubscriber() && conf.ProviderSiYuan == Conf.Sync.Provider {
return
}
@@ -123,17 +128,25 @@ func SyncData(boot, exit, byHand bool) {
if exit {
ExitSyncSucc = 0
}
- if !IsSubscriber() || !Conf.Sync.Enabled || "" == Conf.Sync.CloudName {
+
+ if !Conf.Sync.Enabled {
if byHand {
- if "" == Conf.Sync.CloudName {
- util.PushMsg(Conf.Language(123), 5000)
- } else if !Conf.Sync.Enabled {
- util.PushMsg(Conf.Language(124), 5000)
- }
+ util.PushMsg(Conf.Language(124), 5000)
+ }
+ return
+ }
+
+ if !cloud.IsValidCloudDirName(Conf.Sync.CloudName) {
+ if byHand {
+ util.PushMsg(Conf.Language(123), 5000)
}
return
}
+ if !IsSubscriber() && conf.ProviderSiYuan == Conf.Sync.Provider {
+ return
+ }
+
if !cloud.IsValidCloudDirName(Conf.Sync.CloudName) {
return
}