Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

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

Liang Ding566e26dcd918
diff --git a/kernel/model/repository.go b/kernel/model/repository.go
index 06b4025d0b..0153441ab7 100644
--- a/kernel/model/repository.go
+++ b/kernel/model/repository.go
@@ -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