mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-20 14:04:06 +01:00
This commit is contained in:
parent
e7a45d4026
commit
f49127edf5
5 changed files with 19 additions and 11 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue