diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index 6b95509d4..69af81981 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -1123,8 +1123,8 @@ "156": "Access authentication failed, please refresh the page", "157": "The key is not recognized, please confirm that the copied key string is correct", "158": "Indexing data repo, walking data %s", - "159": "Indexing data repo, getting the latest file %v", - "160": "Indexing data repo, inserting file %v", + "159": "Indexing data repo, getting the latest file %v/%v", + "160": "Indexing data repo, inserting file %v/%v", "161": "Checking out of data repo, walking data %s", "162": "Checking out data repo, inserting file %v/%v", "163": "Checking out data repo, deleting file %v/%v", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index 257cade1d..62d8755ed 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -1123,8 +1123,8 @@ "156": "Error en la autenticación de acceso, actualice la página", "157": "No se reconoce la clave, confirme que la cadena de clave copiada es correcta", "158": "Indexando repositorio de datos, datos para caminar %s", - "159": "Indexando repositorio de datos, obteniendo el último archivo %v", - "160": "Indexando repositorio de datos, insertando archivo %v", + "159": "Indexando repositorio de datos, obteniendo el último archivo %v/%v", + "160": "Indexando repositorio de datos, insertando archivo %v/%v", "161": "Revisando el repositorio de datos, recorriendo datos %s", "162": "Revisando el repositorio de datos, insertando el archivo %v/%v", "163": "Revisando el repositorio de datos, eliminando el archivo %v/%v", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 6cac586fb..37bb0649d 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -1123,8 +1123,8 @@ "156": "Échec de l'authentification d'accès, veuillez actualiser la page", "157": "La clé n'est pas reconnue, veuillez confirmer que la chaîne de clé copiée est correcte", "158": "Indexation du référentiel de données, données de marche %s", - "159": "Indexation du référentiel de données, obtention du dernier fichier %v", - "160": "Indexation du référentiel de données, insertion du fichier %v", + "159": "Indexation du référentiel de données, obtention du dernier fichier %v/%v", + "160": "Indexation du référentiel de données, insertion du fichier %v/%v", "161": "Vérification du référentiel de données, données piétonnes %s", "162": "Vérification du référentiel de données, insertion du fichier %v/%v", "163": "Vérification du référentiel de données, suppression du fichier %v/%v", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index e2b9cb63c..83f1fcfbf 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -1123,8 +1123,8 @@ "156": "訪問鑑權失敗,請刷新頁面", "157": "無法識別密鑰,請確認複製的密鑰字串是否正確", "158": "正在索引數據倉庫,遍歷數據 %s", - "159": "正在索引數據倉庫,獲取最新文件 %v", - "160": "正在索引數據倉庫,插入文件 %v", + "159": "正在索引數據倉庫,獲取最新文件 %v/%v", + "160": "正在索引數據倉庫,插入文件 %v/%v", "161": "正在遷出數據倉庫,遍歷數據 %s", "162": "正在遷出數據倉庫,插入文件 %v/%v", "163": "正在遷出數據倉庫,刪除文件 %v/%v", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 807ab1938..155c11bb9 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -1125,8 +1125,8 @@ "156": "访问鉴权失败,请刷新页面", "157": "无法识别密钥,请确认复制的密钥字符串是否正确", "158": "正在索引数据仓库,遍历数据 %s", - "159": "正在索引数据仓库,获取最新文件 %v", - "160": "正在索引数据仓库,插入文件 %v", + "159": "正在索引数据仓库,获取最新文件 %v/%v", + "160": "正在索引数据仓库,插入文件 %v/%v", "161": "正在迁出数据仓库,遍历数据 %s", "162": "正在迁出数据仓库,插入文件 %v/%v", "163": "正在迁出数据仓库,删除文件 %v/%v", diff --git a/kernel/go.mod b/kernel/go.mod index d78c08751..053c1807e 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -45,7 +45,7 @@ require ( github.com/radovskyb/watcher v1.0.7 github.com/sashabaranov/go-openai v1.9.5 github.com/shirou/gopsutil/v3 v3.23.5 - github.com/siyuan-note/dejavu v0.0.0-20230615150753-23c4115fa817 + github.com/siyuan-note/dejavu v0.0.0-20230616021558-e944a6c00f4e github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524 @@ -70,7 +70,7 @@ require ( github.com/andybalholm/brotli v1.0.5 // indirect github.com/andybalholm/cascadia v1.3.2 // indirect github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef // indirect - github.com/aws/aws-sdk-go v1.44.282 // indirect + github.com/aws/aws-sdk-go v1.44.283 // indirect github.com/bytedance/sonic v1.9.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect @@ -136,7 +136,7 @@ require ( golang.org/x/net v0.11.0 // indirect golang.org/x/sync v0.3.0 // indirect golang.org/x/sys v0.9.0 // indirect - golang.org/x/tools v0.9.3 // indirect + golang.org/x/tools v0.10.0 // indirect google.golang.org/protobuf v1.30.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/kernel/go.sum b/kernel/go.sum index 2a7687860..ae582b1db 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -40,8 +40,8 @@ github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de h1:FxWPpzIjnTlhP github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de/go.mod h1:DCaWoUhZrYW9p1lxo/cm8EmUOOzAPSEZNGF2DK1dJgw= github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef h1:2JGTg6JapxP9/R33ZaagQtAM4EkkSYnIAlOG5EI8gkM= github.com/asaskevich/EventBus v0.0.0-20200907212545-49d423059eef/go.mod h1:JS7hed4L1fj0hXcyEejnW57/7LCetXggd+vwrRnYeII= -github.com/aws/aws-sdk-go v1.44.282 h1:ZPB9QhwxmMIEC8ja0DdFowOl5fODWaZ6s2cZ40fx6r8= -github.com/aws/aws-sdk-go v1.44.282/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.283 h1:ObMaIvdhHJM2sIrbcljd7muHBaFb+Kp/QsX6iflGDg4= +github.com/aws/aws-sdk-go v1.44.283/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= @@ -287,8 +287,8 @@ 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-20230615150753-23c4115fa817 h1:P3Qj0qkj07fZWyVjUnTMQa40mkaTNULvzlMcE26yTew= -github.com/siyuan-note/dejavu v0.0.0-20230615150753-23c4115fa817/go.mod h1:uGxJ89ZSGGOvHbEFdFkyWHquEZshusyzVcOLEvsi93g= +github.com/siyuan-note/dejavu v0.0.0-20230616021558-e944a6c00f4e h1:SleJtomMLH9yi+dmcxoM9qr+Trn3O2KRShkfCuCkJIc= +github.com/siyuan-note/dejavu v0.0.0-20230616021558-e944a6c00f4e/go.mod h1:uGxJ89ZSGGOvHbEFdFkyWHquEZshusyzVcOLEvsi93g= 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= @@ -442,8 +442,8 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM= -golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc= +golang.org/x/tools v0.10.0 h1:tvDr/iQoUqNdohiYm0LmmKcBk+q86lb9EprIUFhHHGg= +golang.org/x/tools v0.10.0/go.mod h1:UJwyiVBsOA2uwvK/e5OY3GTpDUJriEd+/YlqAwLPmyM= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/kernel/model/conf.go b/kernel/model/conf.go index 2de6e212d..e5bb9f268 100644 --- a/kernel/model/conf.go +++ b/kernel/model/conf.go @@ -389,6 +389,9 @@ func InitConf() { } util.SetNetworkProxy(Conf.System.NetworkProxy.String()) + + go util.InitPandoc() + go util.InitTesseract() } func initLang() { diff --git a/kernel/model/repository.go b/kernel/model/repository.go index 871a87d36..da03345e7 100644 --- a/kernel/model/repository.go +++ b/kernel/model/repository.go @@ -1492,33 +1492,30 @@ func subscribeRepoEvents() { } indexWalkDataCount++ }) - eventbus.Subscribe(eventbus.EvtIndexBeforeGetLatestFiles, func(context map[string]interface{}, files []string) { - msg := fmt.Sprintf(Conf.Language(159), len(files)) + eventbus.Subscribe(eventbus.EvtIndexBeforeGetLatestFiles, func(context map[string]interface{}, total int) { + msg := fmt.Sprintf(Conf.Language(159), 0, total) util.SetBootDetails(msg) util.ContextPushMsg(context, msg) }) - getLatestFileCount := 0 - eventbus.Subscribe(eventbus.EvtIndexGetLatestFile, func(context map[string]interface{}, id string) { - msg := fmt.Sprintf(Conf.Language(159), id[:7]) - if 0 == getLatestFileCount%1024 { + + eventbus.Subscribe(eventbus.EvtIndexGetLatestFile, func(context map[string]interface{}, count int, total int) { + msg := fmt.Sprintf(Conf.Language(159), count, total) + if 0 == count%64 { util.SetBootDetails(msg) util.ContextPushMsg(context, msg) } - getLatestFileCount++ }) - eventbus.Subscribe(eventbus.EvtIndexUpsertFiles, func(context map[string]interface{}, files []*entity.File) { - msg := fmt.Sprintf(Conf.Language(160), len(files)) + eventbus.Subscribe(eventbus.EvtIndexUpsertFiles, func(context map[string]interface{}, total int) { + msg := fmt.Sprintf(Conf.Language(160), 0, total) util.SetBootDetails(msg) util.ContextPushMsg(context, msg) }) - indexUpsertFileCount := 0 - eventbus.Subscribe(eventbus.EvtIndexUpsertFile, func(context map[string]interface{}, path string) { - msg := fmt.Sprintf(Conf.Language(160), filepath.Base(path)) - if 0 == indexUpsertFileCount%64 { + eventbus.Subscribe(eventbus.EvtIndexUpsertFile, func(context map[string]interface{}, count int, total int) { + msg := fmt.Sprintf(Conf.Language(160), count, total) + if 0 == count%64 { util.SetBootDetails(msg) util.ContextPushMsg(context, msg) } - indexUpsertFileCount++ }) eventbus.Subscribe(eventbus.EvtCheckoutBeforeWalkData, func(context map[string]interface{}, path string) { @@ -1557,14 +1554,13 @@ func subscribeRepoEvents() { bootProgressPart = 10 / float64(total) util.ContextPushMsg(context, msg) }) - coRemoveFileCount := 0 + eventbus.Subscribe(eventbus.EvtCheckoutRemoveFile, func(context map[string]interface{}, count, total int) { msg := fmt.Sprintf(Conf.Language(163), count, total) util.IncBootProgress(bootProgressPart, msg) - if 0 == coRemoveFileCount%1024 { + if 0 == count%64 { util.ContextPushMsg(context, msg) } - coRemoveFileCount++ }) eventbus.Subscribe(eventbus.EvtCloudBeforeDownloadIndex, func(context map[string]interface{}, id string) { @@ -1579,14 +1575,13 @@ func subscribeRepoEvents() { bootProgressPart = 10 / float64(total) util.ContextPushMsg(context, msg) }) - downloadFileCount := 0 + eventbus.Subscribe(eventbus.EvtCloudBeforeDownloadFile, func(context map[string]interface{}, count, total int) { msg := fmt.Sprintf(Conf.Language(165), count, total) util.IncBootProgress(bootProgressPart, msg) - if 0 == downloadFileCount%8 { + if 0 == count%8 { util.ContextPushMsg(context, msg) } - downloadFileCount++ }) eventbus.Subscribe(eventbus.EvtCloudBeforeDownloadChunks, func(context map[string]interface{}, total int) { msg := fmt.Sprintf(Conf.Language(166), 0, total) @@ -1594,14 +1589,12 @@ func subscribeRepoEvents() { bootProgressPart = 10 / float64(total) util.ContextPushMsg(context, msg) }) - downloadChunkCount := 0 eventbus.Subscribe(eventbus.EvtCloudBeforeDownloadChunk, func(context map[string]interface{}, count, total int) { msg := fmt.Sprintf(Conf.Language(166), count, total) util.IncBootProgress(bootProgressPart, msg) - if 0 == downloadChunkCount%8 { + if 0 == count%8 { util.ContextPushMsg(context, msg) } - downloadChunkCount++ }) eventbus.Subscribe(eventbus.EvtCloudBeforeDownloadRef, func(context map[string]interface{}, ref string) { msg := fmt.Sprintf(Conf.Language(167), ref) @@ -1618,28 +1611,24 @@ func subscribeRepoEvents() { util.SetBootDetails(msg) util.ContextPushMsg(context, msg) }) - uploadFileCount := 0 eventbus.Subscribe(eventbus.EvtCloudBeforeUploadFile, func(context map[string]interface{}, count, total int) { msg := fmt.Sprintf(Conf.Language(169), count, total) - if 0 == uploadFileCount%8 { + if 0 == count%8 { util.SetBootDetails(msg) util.ContextPushMsg(context, msg) } - uploadFileCount++ }) eventbus.Subscribe(eventbus.EvtCloudBeforeUploadChunks, func(context map[string]interface{}, total int) { msg := fmt.Sprintf(Conf.Language(170), 0, total) util.SetBootDetails(msg) util.ContextPushMsg(context, msg) }) - uploadChunkCount := 0 eventbus.Subscribe(eventbus.EvtCloudBeforeUploadChunk, func(context map[string]interface{}, count, total int) { msg := fmt.Sprintf(Conf.Language(170), count, total) - if 0 == uploadChunkCount%8 { + if 0 == count%8 { util.SetBootDetails(msg) util.ContextPushMsg(context, msg) } - uploadChunkCount++ }) eventbus.Subscribe(eventbus.EvtCloudBeforeUploadRef, func(context map[string]interface{}, ref string) { msg := fmt.Sprintf(Conf.Language(171), ref) diff --git a/kernel/util/pandoc.go b/kernel/util/pandoc.go index ca8f3279e..845bb0484 100644 --- a/kernel/util/pandoc.go +++ b/kernel/util/pandoc.go @@ -82,7 +82,7 @@ var ( PandocBinPath string // Pandoc 可执行文件路径 ) -func initPandoc() { +func InitPandoc() { if ContainerStd != Container { return } diff --git a/kernel/util/tesseract.go b/kernel/util/tesseract.go index 058b93061..13ac6ed00 100644 --- a/kernel/util/tesseract.go +++ b/kernel/util/tesseract.go @@ -129,7 +129,7 @@ func Tesseract(imgAbsPath string) string { return ret } -func initTesseract() { +func InitTesseract() { ver := getTesseractVer() if "" == ver { return diff --git a/kernel/util/working.go b/kernel/util/working.go index e4d5d6be2..b235e6a86 100644 --- a/kernel/util/working.go +++ b/kernel/util/working.go @@ -110,8 +110,6 @@ func Boot() { } initPathDir() - go initPandoc() - go initTesseract() bootBanner := figure.NewColorFigure("SiYuan", "isometric3", "green", true) logging.LogInfof("\n" + bootBanner.String())