mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🔊 Add repo key logging https://ld246.com/article/1733660913439
This commit is contained in:
parent
67087238d8
commit
ada8c71ca9
2 changed files with 8 additions and 0 deletions
|
|
@ -18,6 +18,7 @@ package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"crypto/sha1"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
@ -392,6 +393,9 @@ func InitConf() {
|
||||||
if 1 > Conf.Repo.RetentionIndexesDaily {
|
if 1 > Conf.Repo.RetentionIndexesDaily {
|
||||||
Conf.Repo.RetentionIndexesDaily = 2
|
Conf.Repo.RetentionIndexesDaily = 2
|
||||||
}
|
}
|
||||||
|
if 0 < len(Conf.Repo.Key) {
|
||||||
|
logging.LogInfof("repo key [%x]", sha1.Sum(Conf.Repo.Key))
|
||||||
|
}
|
||||||
|
|
||||||
if nil == Conf.Search {
|
if nil == Conf.Search {
|
||||||
Conf.Search = conf.NewSearch()
|
Conf.Search = conf.NewSearch()
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package model
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
|
"crypto/sha1"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
@ -555,6 +556,7 @@ func ImportRepoKey(base64Key string) (retKey string, err error) {
|
||||||
|
|
||||||
Conf.Repo.Key = key
|
Conf.Repo.Key = key
|
||||||
Conf.Save()
|
Conf.Save()
|
||||||
|
logging.LogInfof("imported repo key [%x]", sha1.Sum(Conf.Repo.Key))
|
||||||
|
|
||||||
if err = os.RemoveAll(Conf.Repo.GetSaveDir()); err != nil {
|
if err = os.RemoveAll(Conf.Repo.GetSaveDir()); err != nil {
|
||||||
return
|
return
|
||||||
|
|
@ -669,6 +671,7 @@ func InitRepoKeyFromPassphrase(passphrase string) (err error) {
|
||||||
|
|
||||||
Conf.Repo.Key = key
|
Conf.Repo.Key = key
|
||||||
Conf.Save()
|
Conf.Save()
|
||||||
|
logging.LogInfof("inited repo key [%x]", sha1.Sum(Conf.Repo.Key))
|
||||||
|
|
||||||
initDataRepo()
|
initDataRepo()
|
||||||
return
|
return
|
||||||
|
|
@ -705,6 +708,7 @@ func InitRepoKey() (err error) {
|
||||||
}
|
}
|
||||||
Conf.Repo.Key = key
|
Conf.Repo.Key = key
|
||||||
Conf.Save()
|
Conf.Save()
|
||||||
|
logging.LogInfof("inited repo key [%x]", sha1.Sum(Conf.Repo.Key))
|
||||||
|
|
||||||
initDataRepo()
|
initDataRepo()
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue