🎨 Support downloading cloud data snapshots to local on demand https://github.com/siyuan-note/siyuan/issues/8057

This commit is contained in:
Liang Ding 2023-04-22 09:47:26 +08:00
parent 99407dcc1c
commit 566e26dcd9
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -392,12 +392,7 @@ func ImportRepoKey(base64Key string) (err error) {
return
}
time.Sleep(1 * time.Second)
util.PushMsg(Conf.Language(138), 3000)
time.Sleep(1 * time.Second)
if initErr := IndexRepo("[Init] Init data repo"); nil != initErr {
util.PushErrMsg(fmt.Sprintf(Conf.Language(140), initErr), 0)
}
initDataRepo()
return
}
@ -479,12 +474,7 @@ func InitRepoKeyFromPassphrase(passphrase string) (err error) {
Conf.Repo.Key = key
Conf.Save()
time.Sleep(1 * time.Second)
util.PushMsg(Conf.Language(138), 3000)
time.Sleep(1 * time.Second)
if initErr := IndexRepo("[Init] Init data repo"); nil != initErr {
util.PushErrMsg(fmt.Sprintf(Conf.Language(140), initErr), 0)
}
initDataRepo()
return
}
@ -520,13 +510,17 @@ func InitRepoKey() (err error) {
Conf.Repo.Key = key
Conf.Save()
initDataRepo()
return
}
func initDataRepo() {
time.Sleep(1 * time.Second)
util.PushMsg(Conf.Language(138), 3000)
time.Sleep(1 * time.Second)
if initErr := IndexRepo("[Init] Init data repo"); nil != initErr {
if initErr := IndexRepo("[Init] Init local data repo"); nil != initErr {
util.PushErrMsg(fmt.Sprintf(Conf.Language(140), initErr), 0)
}
return
}
func CheckoutRepo(id string) {
@ -691,6 +685,10 @@ func GetCloudRepoSnapshots(page int) (ret []*dejavu.Log, pageCount, totalCount i
return
}
if 1 > page {
page = 1
}
logs, pageCount, totalCount, err := repo.GetCloudRepoLogs(page)
if nil != err {
return