mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
This commit is contained in:
parent
e7a45d4026
commit
f49127edf5
5 changed files with 19 additions and 11 deletions
|
|
@ -40,7 +40,7 @@ require (
|
|||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
github.com/qiniu/go-sdk/v7 v7.13.0
|
||||
github.com/radovskyb/watcher v1.0.7
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220614100921-f1d318f3dd6b
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220614142403-d44683c970fc
|
||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676
|
||||
github.com/vmihailenco/msgpack/v5 v5.3.5
|
||||
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673
|
||||
|
|
|
|||
|
|
@ -419,8 +419,8 @@ github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJ
|
|||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220614100921-f1d318f3dd6b h1:GyLlhQQsgfVFzyWB+OB1wCRlyzBhI4EkczC0YK9cRHc=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220614100921-f1d318f3dd6b/go.mod h1:Oa/Y6fvTUCg8h9/t6GNWXiu8T7aQri/ZvyDRygnlikI=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220614142403-d44683c970fc h1:GRcKYDhL9R3dU1ZemgQdRCDcVV9msadMzDDMD72+C+g=
|
||||
github.com/siyuan-note/dejavu v0.0.0-20220614142403-d44683c970fc/go.mod h1:Oa/Y6fvTUCg8h9/t6GNWXiu8T7aQri/ZvyDRygnlikI=
|
||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676 h1:QB9TjJQFhXhZ6dAtPpY02DlzHAQm1C+WqZq6OadG8mI=
|
||||
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import (
|
|||
"github.com/dustin/go-humanize"
|
||||
"github.com/siyuan-note/encryption"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
|
|
@ -141,9 +142,11 @@ func RecoverLocalBackup() (err error) {
|
|||
return errors.New(Conf.Language(11))
|
||||
}
|
||||
|
||||
data := util.AESDecrypt(Conf.E2EEPasswd)
|
||||
data, _ = hex.DecodeString(string(data))
|
||||
passwd := string(data)
|
||||
writingDataLock.Lock()
|
||||
defer writingDataLock.Unlock()
|
||||
|
||||
filesys.ReleaseAllFileLocks()
|
||||
sql.WaitForWritingDatabase()
|
||||
|
||||
CloseWatchAssets()
|
||||
defer WatchAssets()
|
||||
|
|
@ -153,17 +156,17 @@ func RecoverLocalBackup() (err error) {
|
|||
Conf.Sync.Enabled = false
|
||||
Conf.Save()
|
||||
|
||||
filesys.ReleaseAllFileLocks()
|
||||
|
||||
util.PushEndlessProgress(Conf.Language(63))
|
||||
util.LogInfof("starting recovery...")
|
||||
start := time.Now()
|
||||
|
||||
data := util.AESDecrypt(Conf.E2EEPasswd)
|
||||
data, _ = hex.DecodeString(string(data))
|
||||
passwd := string(data)
|
||||
decryptedDataDir, err := decryptDataDir(passwd)
|
||||
if nil != err {
|
||||
util.ClearPushProgress(100)
|
||||
return
|
||||
}
|
||||
|
||||
newDataDir := filepath.Join(util.WorkspaceDir, "data.new")
|
||||
os.RemoveAll(newDataDir)
|
||||
if err = os.MkdirAll(newDataDir, 0755); nil != err {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/siyuan-note/dejavu/entity"
|
||||
"github.com/siyuan-note/encryption"
|
||||
"github.com/siyuan-note/siyuan/kernel/filesys"
|
||||
"github.com/siyuan-note/siyuan/kernel/sql"
|
||||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
|
|
@ -131,10 +132,13 @@ func CheckoutRepo(id string) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
filesys.ReleaseAllFileLocks()
|
||||
util.PushEndlessProgress(Conf.Language(63))
|
||||
writingDataLock.Lock()
|
||||
defer writingDataLock.Unlock()
|
||||
|
||||
filesys.ReleaseAllFileLocks()
|
||||
sql.WaitForWritingDatabase()
|
||||
|
||||
CloseWatchAssets()
|
||||
defer WatchAssets()
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ func InitDatabase(forceRebuild bool) (err error) {
|
|||
if gulu.File.IsExist(util.DBPath) {
|
||||
if err = removeDatabaseFile(); nil != err {
|
||||
util.LogErrorf("remove database file [%s] failed: %s", util.DBPath, err)
|
||||
util.PushClearProgress()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue