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

Liang Ding2711bc5df8b2
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json
index ff974f03ea..6c410a8d4f 100644
--- a/app/appearance/langs/en_US.json
+++ b/app/appearance/langs/en_US.json
@@ -173,6 +173,10 @@
"setEmojiTip": "Please go to [Settings - Appearance to add emoji]",
"openSyncTip1": "Enable cloud sync",
"openSyncTip2": "When changing from disabled to enabled, it is recommended to manually click the sync button to trigger a synchronization",
+ "syncMode": "Cloud sync mode",
+ "syncModeTip": "The sync mode can be further selected after cloud sync is enabled",
+ "syncMode1": "Auto (sync every 30 seconds after the data no longer changes)",
+ "syncMode2": "Manual (automatic auto only once when the software is started and closed, other times need to manually trigger)",
"cloudSync": "Cloud sync",
"cloudSyncDir": "Cloud Sync Dir",
"emptyCloudSyncList": "The cloud sync list is empty",
diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json
index d20406309b..2679f3aab4 100644
--- a/app/appearance/langs/fr_FR.json
+++ b/app/appearance/langs/fr_FR.json
@@ -173,6 +173,10 @@
"setEmojiTip": "Veuillez aller dans [Paramètres - Apparence] pour ajouter des emoji",
"openSyncTip1": "Activer Cloud Sync",
"openSyncTip2": "Lorsque vous passez de la désactivation à l'activation, il est recommandé de cliquer manuellement sur le bouton de synchronisation pour déclencher une synchronisation",
+ "syncMode": "Mode de synchronisation cloud",
+ "syncModeTip": "Le mode de synchronisation peut être sélectionné davantage après l'activation de la synchronisation dans le cloud",
+ "syncMode1": "Automatique (synchronisation toutes les 30 secondes après que les données ne changent plus)",
+ "syncMode2": "Manuelle (synchronisation automatique une seule fois lorsque le logiciel est démarré et fermé, les autres fois, il faut déclencher manuellement la synchronisation)",
"cloudSync": "Cloud Sync",
"cloudSyncDir": "Répertoire Cloud Sync",
"emptyCloudSyncList": "La liste de sync du cloud est videy",
diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json
index 7445fbb8e8..ef28a5457a 100644
--- a/app/appearance/langs/zh_CHT.json
+++ b/app/appearance/langs/zh_CHT.json
@@ -173,6 +173,10 @@
"setEmojiTip": "請在 [設置 - 外觀] 中新增自訂表情",
"openSyncTip1": "啟用雲端同步",
"openSyncTip2": "從禁用改為啟用時建議手動點擊同步按鈕觸發一次同步",
+ "syncMode": "雲端同步模式",
+ "syncModeTip": "啟用雲端同步後可進一步選擇同步模式",
+ "syncMode1": "自動同步(數據不再變動後 30 秒進行一次同步)",
+ "syncMode2": "手動同步(僅啟動和關閉軟件時自動同步一次,其他時候需要手動觸發同步)",
"cloudSync": "雲端同步",
"cloudSyncDir": "雲端同步目錄",
"emptyCloudSyncList": "雲端同步列表為空",
diff --git a/kernel/model/sync.go b/kernel/model/sync.go
index fbe493455c..b4ef3eb32a 100644
--- a/kernel/model/sync.go
+++ b/kernel/model/sync.go
@@ -68,6 +68,10 @@ func AutoSync() {
func SyncData(boot, exit, byHand bool) {
defer util.Recover()
+ if !boot && !exit && 2 == Conf.Sync.Mode && !byHand {
+ return
+ }
+
if util.IsMutexLocked(&syncLock) {
util.LogWarnf("sync has been locked")
syncInterval = 30 * time.Second