An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: 改进多设备同时同步数据的可靠性 https://github.com/siyuan-note/siyuan/issues/7245
Liang Ding85771e1a458d
diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.jsonindex 1b76222fe0..c2ef012b80 100644--- a/app/appearance/langs/en_US.json+++ b/app/appearance/langs/en_US.json@@ -1072,6 +1072,10 @@"182": "Sharing document, please wait...","183": "Validating index document tree [%d/%d %s]","184": "Powered by <a href=\"https://b3log.org/siyuan\" target=\"_blank\">SiYuan</a>",- "185": "Index verification complete"+ "185": "Index verification complete",+ "186": "Locking cloud sync directory",+ "187": "Unlocking cloud sync directory",+ "188": "Failed to lock the cloud sync directory, please try again later",+ "189": "Cloud sync directory is still locked by other devices, please try again later"}}diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.jsonindex 5bd980b9bc..6d3d4ed407 100644--- a/app/appearance/langs/es_ES.json+++ b/app/appearance/langs/es_ES.json@@ -1072,6 +1072,10 @@"182": "Compartiendo documento, por favor espere...","183": "Validando el árbol del documento de índice [%d/%d %s]","184": "Con la tecnología de <a href=\"https://b3log.org/siyuan\" target=\"_blank\">SiYuan</a>",- "185": "Verificación de índice completada"+ "185": "Verificación de índice completada",+ "186": "Bloqueando el directorio de sincronización de la nube",+ "187": "Desbloqueando el directorio de sincronización en la nube",+ "188": "Error al bloquear el directorio de sincronizaci\u00f3n en la nube, int\u00e1ntelo de nuevo m\u00e1s tarde",+ "189": "El directorio de sincronización en la nube todavía está bloqueado por otros dispositivos, inténtalo de nuevo más tarde"}}diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.jsonindex f803ed269e..dd0ec790a0 100644--- a/app/appearance/langs/fr_FR.json+++ b/app/appearance/langs/fr_FR.json@@ -1072,6 +1072,10 @@"182": "Partage du document, veuillez patienter...","183": "Validation de l'arborescence du document d'index [%d/%d %s]","184": "Propulsé par <a href=\"https://b3log.org/siyuan\" target=\"_blank\">SiYuan</a>",- "185": "Vérification de l'index terminée"+ "185": "Vérification de l'index terminée",+ "186": "Verrouillage du répertoire de synchronisation cloud",+ "187": "Déverrouillage du répertoire de synchronisation cloud",+ "188": "Échec du verrouillage du répertoire de synchronisation cloud, veuillez réessayer plus tard",+ "189": "Le répertoire de synchronisation cloud est toujours verrouillé par d'autres appareils, veuillez réessayer plus tard"}}diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.jsonindex be7298d961..fa0e42d445 100644--- a/app/appearance/langs/zh_CHT.json+++ b/app/appearance/langs/zh_CHT.json@@ -1072,6 +1072,10 @@"182": "正在分享文檔,請稍等...","183": "正在校驗索引文檔樹 [%d/%d %s]","184": "由<a href=\"https://b3log.org/siyuan\" target=\"_blank\">思源筆記</a>強力驅動",- "185": "索引校驗完畢"+ "185": "索引校驗完畢",+ "186": "正在鎖定雲端同步目錄",+ "187": "正在解鎖雲端同步目錄",+ "188": "鎖定雲端同步目錄失敗,請稍後再試",+ "189": "雲端同步目錄還在被其他設備鎖定,請稍後再試"}}diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.jsonindex 53a39aeee5..e9dcdc7e2e 100644--- a/app/appearance/langs/zh_CN.json+++ b/app/appearance/langs/zh_CN.json@@ -1072,6 +1072,10 @@"182": "正在分享文档,请稍等...","183": "正在校验索引文档树 [%d/%d %s]","184": "由<a href=\"https://b3log.org/siyuan\" target=\"_blank\">思源笔记</a>强力驱动",- "185": "索引校验完毕"+ "185": "索引校验完毕",+ "186": "正在锁定云端同步目录",+ "187": "正在解锁云端同步目录",+ "188": "锁定云端同步目录失败,请稍后再试",+ "189": "云端同步目录还在被其他设备锁定,请稍后再试"}}diff --git a/kernel/go.mod b/kernel/go.modindex 6c6ec79f2e..39f91b67a1 100644--- a/kernel/go.mod+++ b/kernel/go.mod@@ -40,9 +40,9 @@ require (github.com/patrickmn/go-cache v2.1.0+incompatiblegithub.com/radovskyb/watcher v1.0.7github.com/shirou/gopsutil/v3 v3.23.1- github.com/siyuan-note/dejavu v0.0.0-20230203032858-f307dcd7c8fc+ github.com/siyuan-note/dejavu v0.0.0-20230203091000-b288dbd9185fgithub.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75- github.com/siyuan-note/eventbus v0.0.0-20230126092943-c6bf51e65ae2+ github.com/siyuan-note/eventbus v0.0.0-20230203085647-fb624740be03github.com/siyuan-note/filelock v0.0.0-20221117095924-e1947438a35egithub.com/siyuan-note/httpclient v0.0.0-20230201041143-5c2b2b88b985github.com/siyuan-note/logging v0.0.0-20221031125421-9b7234d79d8adiff --git a/kernel/go.sum b/kernel/go.sumindex 290cd21f95..a6ec6dfb2e 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -383,12 +383,12 @@ github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lgithub.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=-github.com/siyuan-note/dejavu v0.0.0-20230203032858-f307dcd7c8fc h1:qpwZUhFtYSd8tezE1XIvjYUsEpGHBog0n005lMwzyfg=-github.com/siyuan-note/dejavu v0.0.0-20230203032858-f307dcd7c8fc/go.mod h1:MUYgbXnGa+ZyyaYtoo9qkXNEDUYbhRMDMSMvu8OGhSA=+github.com/siyuan-note/dejavu v0.0.0-20230203091000-b288dbd9185f h1:gQmmnpPAOEfOFj/zjanPDznw+nwRItpaKgvoU/dAiXA=+github.com/siyuan-note/dejavu v0.0.0-20230203091000-b288dbd9185f/go.mod h1:Hp/96PrZAiG2zSscNbrdu8Iyzw4nCIu2/fOtzNVtbpU=github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=-github.com/siyuan-note/eventbus v0.0.0-20230126092943-c6bf51e65ae2 h1:njoj0265FOHRjF/O1aWDzdwEdYdLTZwhbuPd/hoLJT0=-github.com/siyuan-note/eventbus v0.0.0-20230126092943-c6bf51e65ae2/go.mod h1:Sqo4FYX5lAXu7gWkbEdJF0e6P57tNNVV4WDKYDctokI=+github.com/siyuan-note/eventbus v0.0.0-20230203085647-fb624740be03 h1:W7nGGluE6sBrFSVkmucGsh2NruleOPsQle7fcAW115o=+github.com/siyuan-note/eventbus v0.0.0-20230203085647-fb624740be03/go.mod h1:Sqo4FYX5lAXu7gWkbEdJF0e6P57tNNVV4WDKYDctokI=github.com/siyuan-note/filelock v0.0.0-20221117095924-e1947438a35e h1:i3RKrdrddr4AuaHJtoWYAEVNuR7Y9wIsEqPmuFFbJC4=github.com/siyuan-note/filelock v0.0.0-20221117095924-e1947438a35e/go.mod h1:NmpSIVtIGy8eNWapjDIiiCw5+5r5wxC76k40oG+WRXQ=github.com/siyuan-note/httpclient v0.0.0-20230201041143-5c2b2b88b985 h1:L5NArfUHYrY43OQ1dreuzuBe8UXP2an94AYqk553f+w=diff --git a/kernel/model/conf.go b/kernel/model/conf.goindex c55415e1ad..55183f3654 100644--- a/kernel/model/conf.go+++ b/kernel/model/conf.go@@ -215,7 +215,7 @@ func InitConf() {if "" == Conf.System.ID {Conf.System.ID = util.GetDeviceID()}- if "std" == util.Container {+ if util.ContainerStd == util.Container {Conf.System.ID = util.GetDeviceID()}diff --git a/kernel/model/repository.go b/kernel/model/repository.goindex 50e86191bc..3a8f094249 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -927,6 +927,7 @@ func syncRepo(exit, byHand bool) (err error) {}return}+util.PushStatusBar(fmt.Sprintf(Conf.Language(149), elapsed.Seconds()))Conf.Sync.Synced = util.CurrentTimeMillis()msg := fmt.Sprintf(Conf.Language(150), trafficStat.UploadFileCount, trafficStat.DownloadFileCount, trafficStat.UploadChunkCount, trafficStat.DownloadChunkCount, humanize.Bytes(uint64(trafficStat.UploadBytes)), humanize.Bytes(uint64(trafficStat.DownloadBytes)))@@ -1185,7 +1186,7 @@ func newRepository() (ret *dejavu.Repo, err error) {ignoreLines := getIgnoreLines()ignoreLines = append(ignoreLines, "/.siyuan/conf.json") // 忽略旧版同步配置- ret, err = dejavu.NewRepo(util.DataDir, util.RepoDir, util.HistoryDir, util.TempDir, Conf.Repo.Key, ignoreLines, cloudRepo)+ ret, err = dejavu.NewRepo(util.DataDir, util.RepoDir, util.HistoryDir, util.TempDir, Conf.System.ID, Conf.Repo.Key, ignoreLines, cloudRepo)if nil != err {logging.LogErrorf("init data repo failed: %s", err)return@@ -1363,6 +1364,16 @@ func subscribeEvents() {util.SetBootDetails(msg)util.ContextPushMsg(context, msg)})+ eventbus.Subscribe(eventbus.EvtCloudLock, func(context map[string]interface{}) {+ msg := fmt.Sprintf(Conf.Language(186))+ util.SetBootDetails(msg)+ util.ContextPushMsg(context, msg)+ })+ eventbus.Subscribe(eventbus.EvtCloudUnlock, func(context map[string]interface{}) {+ msg := fmt.Sprintf(Conf.Language(187))+ util.SetBootDetails(msg)+ util.ContextPushMsg(context, msg)+ })}func buildCloudConf() (ret *cloud.Conf, err error) {diff --git a/kernel/model/sync.go b/kernel/model/sync.goindex 59c0bbc6d5..7f9bb848a2 100644--- a/kernel/model/sync.go+++ b/kernel/model/sync.go@@ -437,6 +437,10 @@ func formatErrorMsg(err error) string {msg = Conf.Language(28)} else if strings.Contains(msgLowerCase, "cloud object not found") {msg = Conf.Language(129)+ } else if strings.Contains(msgLowerCase, "lock cloud repo failed") {+ msg = Conf.Language(188)+ } else if strings.Contains(msgLowerCase, "cloud repo is locked") {+ msg = Conf.Language(189)}msg = msg + " v" + util.Verreturn msg