From 88cd5f063ff577b5cb9388d615f3916dc0ce5067 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 2 Jul 2023 17:48:02 +0800 Subject: [PATCH] :art: Automatically check cloud data integrity https://github.com/siyuan-note/siyuan/issues/8653 --- app/appearance/langs/en_US.json | 6 +++++- app/appearance/langs/es_ES.json | 6 +++++- app/appearance/langs/fr_FR.json | 6 +++++- app/appearance/langs/zh_CHT.json | 6 +++++- app/appearance/langs/zh_CN.json | 6 +++++- kernel/go.mod | 4 ++-- kernel/go.sum | 8 ++++---- kernel/model/repository.go | 20 ++++++++++++++++++++ 8 files changed, 51 insertions(+), 11 deletions(-) diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 399c8a9d2..a49e629a8 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -1178,6 +1178,10 @@ "204": "The doc in the user guide does not support sharing to the community", "205": "The plugin is not supported in the current environment", "206": "Executing content replacement [%d/%d]", - "207": "Executing path replacement [%d/%d]" + "207": "Executing path replacement [%d/%d]", + "208": "Uploading index list...", + "209": "Uploading check index...", + "210": "Verifying cloud data...", + "211": "Cloud data verification complete" } } diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 57e2b2be9..9eadd1932 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -1178,6 +1178,10 @@ "204": "La documentación en la guía del usuario no permite compartir con la comunidad", "205": "El complemento no es compatible con el entorno actual", "206": "Ejecutando reemplazo de contenido [%d/%d]", - "207": "Ejecutando reemplazo de ruta [%d/%d]" + "207": "Ejecutando reemplazo de ruta [%d/%d]", + "208": "Cargando lista de índice...", + "209": "Cargando índice de verificación...", + "210": "Verificando datos en la nube...", + "211": "Verificaci\u00f3n de datos en la nube completada" } } diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 48654120e..0da7777de 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -1178,6 +1178,10 @@ "204": "La documentation du guide de l'utilisateur ne prend pas en charge le partage avec la communauté", "205": "Le plugin n'est pas pris en charge dans l'environnement actuel", "206": "Exécution du remplacement de contenu [%d/%d]", - "207": "Exécution du remplacement de chemin [%d/%d]" + "207": "Exécution du remplacement de chemin [%d/%d]", + "208": "Téléchargement de la liste d'index...", + "209": "Téléchargement de l'index de vérification...", + "210": "Vérification des données cloud...", + "211": "Vérification des données cloud terminée" } } diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 0dd99d53a..8deaf9169 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -1178,6 +1178,10 @@ "204": "用戶指南中的文檔不支持分享到社區", "205": "該插件不支持在當前環境下使用", "206": "正在執行內容替換 [%d/%d]", - "207": "正在執行路徑替換 [%d/%d]" + "207": "正在執行路徑替換 [%d/%d]", + "208": "正在上傳索引列表...", + "209": "正在上傳校驗索引...", + "210": "正在校驗雲端數據...", + "211": "校驗雲端數據完畢" } } diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 7e8489a26..ebd347110 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -1178,6 +1178,10 @@ "204": "用户指南中的文档不支持分享到社区", "205": "该插件不支持在当前环境下使用", "206": "正在执行内容替换 [%d/%d]", - "207": "正在执行路径替换 [%d/%d]" + "207": "正在执行路径替换 [%d/%d]", + "208": "正在上传索引列表...", + "209": "正在上传校验索引...", + "210": "正在校验云端数据...", + "211": "校验云端数据完毕" } } diff --git a/kernel/go.mod b/kernel/go.mod index ebc633010..05f08ba3b 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -45,9 +45,9 @@ require ( github.com/radovskyb/watcher v1.0.7 github.com/sashabaranov/go-openai v1.12.0 github.com/shirou/gopsutil/v3 v3.23.5 - github.com/siyuan-note/dejavu v0.0.0-20230701164716-3bd946c2227d + github.com/siyuan-note/dejavu v0.0.0-20230702094059-ebefc7dc4498 github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 - github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b + github.com/siyuan-note/eventbus v0.0.0-20230702081350-6dde667e7112 github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524 github.com/siyuan-note/httpclient v0.0.0-20230625034122-2e57d97ca444 github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493 diff --git a/kernel/go.sum b/kernel/go.sum index 668b1ae2f..9134ecf70 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -287,12 +287,12 @@ github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5g github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA= github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= -github.com/siyuan-note/dejavu v0.0.0-20230701164716-3bd946c2227d h1:XCAqfdZLlkxMSFecf5mEQncKZri+fFBIPAbpq1K0+wI= -github.com/siyuan-note/dejavu v0.0.0-20230701164716-3bd946c2227d/go.mod h1:iR6kmFYS3jz/yuDFg6atb0yZdDs2RvS5gf3NzTL4frI= +github.com/siyuan-note/dejavu v0.0.0-20230702094059-ebefc7dc4498 h1:pdGacClM5a4nDD+OQ0+4lMN62k5xovhizABM3d4Nh4M= +github.com/siyuan-note/dejavu v0.0.0-20230702094059-ebefc7dc4498/go.mod h1:GxekubylJpkSt5Y29ecxNxjpKusPov+07mM1rsPtk+g= 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-20230216103454-41885eac6c2b h1:828lTUW2C0uNiolODqoACu7J8sDUzswD4Xo04mUombg= -github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b/go.mod h1:Sqo4FYX5lAXu7gWkbEdJF0e6P57tNNVV4WDKYDctokI= +github.com/siyuan-note/eventbus v0.0.0-20230702081350-6dde667e7112 h1:lb+8C+XEEEn/lcBtoXlrf5mZEoe0y0KlqiIGG93Gozc= +github.com/siyuan-note/eventbus v0.0.0-20230702081350-6dde667e7112/go.mod h1:Sqo4FYX5lAXu7gWkbEdJF0e6P57tNNVV4WDKYDctokI= github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524 h1:ZuxN5gwqtUOd1NkOkNhM4OlVWfjujY98zsR+zFi4x9g= github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524/go.mod h1:jK5lCYfPbFOrW23/HMeU7kmpLdEd5GkennF+kUpy7Vs= github.com/siyuan-note/httpclient v0.0.0-20230625034122-2e57d97ca444 h1:AE9ggQ7Tg/iytE6Wq/auBc0uZ/G+hYSRWK23TeHeFmg= diff --git a/kernel/model/repository.go b/kernel/model/repository.go index 3691ebf55..b5cba0f38 100644 --- a/kernel/model/repository.go +++ b/kernel/model/repository.go @@ -1647,6 +1647,26 @@ func subscribeRepoEvents() { util.SetBootDetails(msg) util.ContextPushMsg(context, msg) }) + eventbus.Subscribe(eventbus.EvtCloudBeforeUploadIndexes, func(context map[string]interface{}) { + msg := fmt.Sprintf(Conf.Language(208)) + util.SetBootDetails(msg) + util.ContextPushMsg(context, msg) + }) + eventbus.Subscribe(eventbus.EvtCloudBeforeUploadCheckIndex, func(context map[string]interface{}) { + msg := fmt.Sprintf(Conf.Language(209)) + util.SetBootDetails(msg) + util.ContextPushMsg(context, msg) + }) + eventbus.Subscribe(eventbus.EvtCloudBeforeFixObjects, func(context map[string]interface{}) { + msg := fmt.Sprintf(Conf.Language(210)) + util.SetBootDetails(msg) + util.ContextPushMsg(context, msg) + }) + eventbus.Subscribe(eventbus.EvtCloudAfterFixObjects, func(context map[string]interface{}) { + msg := fmt.Sprintf(Conf.Language(211)) + util.SetBootDetails(msg) + util.ContextPushMsg(context, msg) + }) } func buildCloudConf() (ret *cloud.Conf, err error) {