mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-27 02:36:10 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
27327a2236
6 changed files with 24 additions and 11 deletions
|
|
@ -882,7 +882,8 @@
|
|||
"137": "Failed to initialize data repository key",
|
||||
"138": "Data repository key is set",
|
||||
"139": "Data snapshot is being generated, [%s] data files have been processed, [%s] remaining...",
|
||||
"140": "Failed to create data snapshot",
|
||||
"141": "Failed to rollback data snapshot"
|
||||
"140": "Failed to create data snapshot: %s",
|
||||
"141": "Failed to rollback data snapshot",
|
||||
"142": "Snapshot memo cannot be empty"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -882,7 +882,8 @@
|
|||
"137": "Échec de l'initialisation de la clé du référentiel de données",
|
||||
"138": "La clé du référentiel de données est définie",
|
||||
"139": "L'instantané des données est en cours de génération, [%s] fichiers de données ont été traités, [%s] restants...",
|
||||
"140": "Échec de la création de l'instantané des données",
|
||||
"141": "Échec de la restauration de l'instantané des données"
|
||||
"140": "Échec de la création de l'instantané des données: %s",
|
||||
"141": "Échec de la restauration de l'instantané des données",
|
||||
"142": "Le mémo d'instantané ne peut pas être vide"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -881,7 +881,8 @@
|
|||
"137": "初始化數據倉庫密鑰失敗",
|
||||
"138": "數據倉庫密鑰設置完畢",
|
||||
"139": "正在生成數據快照,已處理 [%s] 個數據文件,剩餘待處理 [%s]...",
|
||||
"140": "創建數據快照失敗",
|
||||
"141": "回滾數據快照失敗"
|
||||
"140": "創建數據快照失敗:%s",
|
||||
"141": "回滾數據快照失敗",
|
||||
"142": "快照備註不能為空"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -883,7 +883,8 @@
|
|||
"137": "初始化数据仓库密钥失败",
|
||||
"138": "数据仓库密钥设置完毕",
|
||||
"139": "正在生成数据快照,已处理 [%s] 个数据文件,剩余待处理 [%s]...",
|
||||
"140": "创建数据快照失败",
|
||||
"141": "回滚数据快照失败"
|
||||
"140": "创建数据快照失败:%s",
|
||||
"141": "回滚数据快照失败",
|
||||
"142": "快照备注不能为空"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package api
|
|||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
|
|
@ -77,7 +78,8 @@ func indexRepo(c *gin.Context) {
|
|||
message := arg["message"].(string)
|
||||
if err := model.IndexRepo(message); nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = model.Conf.Language(140)
|
||||
ret.Msg = fmt.Sprintf(model.Conf.Language(140), err)
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 5000}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import (
|
|||
"errors"
|
||||
"os"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/siyuan-note/dejavu"
|
||||
"github.com/siyuan-note/dejavu/entity"
|
||||
"github.com/siyuan-note/encryption"
|
||||
|
|
@ -148,12 +149,18 @@ var indexCallbacks = map[string]dejavu.Callback{
|
|||
},
|
||||
}
|
||||
|
||||
func IndexRepo(message string) (err error) {
|
||||
func IndexRepo(memo string) (err error) {
|
||||
if 1 > len(Conf.Repo.Key) {
|
||||
err = errors.New("repo key is nil")
|
||||
return
|
||||
}
|
||||
|
||||
memo = gulu.Str.RemoveInvisible(memo)
|
||||
if "" == memo {
|
||||
err = errors.New(Conf.Language(142))
|
||||
return
|
||||
}
|
||||
|
||||
repo, err := dejavu.NewRepo(util.DataDir, util.RepoDir, Conf.Repo.Key)
|
||||
if nil != err {
|
||||
util.LogErrorf("init repo failed: %s", err)
|
||||
|
|
@ -164,7 +171,7 @@ func IndexRepo(message string) (err error) {
|
|||
syncLock.Lock()
|
||||
defer syncLock.Unlock()
|
||||
filesys.ReleaseAllFileLocks()
|
||||
_, err = repo.Index(message, util.PushEndlessProgress, indexCallbacks)
|
||||
_, err = repo.Index(memo, util.PushEndlessProgress, indexCallbacks)
|
||||
util.PushClearProgress()
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue