🎨 重置数据仓库 Fix https://github.com/siyuan-note/siyuan/issues/5212
This commit is contained in:
parent
f23764fee0
commit
0361de475f
7 changed files with 17 additions and 9 deletions
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"resetRepoTip": "Resetting the data repository will completely delete the key and all snapshots, are you sure you want to reset?",
|
||||
"resetRepo": "Reset data repo",
|
||||
"createSnapshot": "Create snapshot",
|
||||
"dataSnapshot": "Data snapshot",
|
||||
"copyKey": "Copy key string",
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"resetRepoTip": "La réinitialisation du référentiel de données supprimera complètement la clé et tous les instantanés, êtes-vous sûr de vouloir réinitialiser ?",
|
||||
"resetRepo": "Réinitialiser le référentiel de données",
|
||||
"createSnapshot": "Créer un instantané",
|
||||
"dataSnapshot": "Instantané de données",
|
||||
"copyKey": "Copier la chaîne de clé",
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"resetRepoTip": "重置數據倉庫會徹底刪除密鑰和所有快照,確定進行重置嗎?",
|
||||
"resetRepo": "重置數據倉庫",
|
||||
"createSnapshot": "創建快照",
|
||||
"dataSnapshot": "數據快照",
|
||||
"copyKey": "複製密鑰字符串",
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"resetRepoTip": "重置数据仓库会彻底删除密钥和所有快照,确定进行重置吗?",
|
||||
"resetRepo": "重置数据仓库",
|
||||
"createSnapshot": "创建快照",
|
||||
"dataSnapshot": "数据快照",
|
||||
"copyKey": "复制密钥字符串",
|
||||
|
|
|
@ -104,8 +104,8 @@ export const about = {
|
|||
<svg><use xlink:href="#iconCopy"></use></svg>${window.siyuan.languages.copyKey}
|
||||
</button>
|
||||
<div class="fn__hr"></div>
|
||||
<button class="b3-button b3-button--outline fn__size200" id="removeKey">
|
||||
<svg><use xlink:href="#iconTrashcan"></use></svg>${window.siyuan.languages.remove}
|
||||
<button class="b3-button b3-button--outline fn__size200" id="resetRepo">
|
||||
<svg><use xlink:href="#iconTrashcan"></use></svg>${window.siyuan.languages.resetRepo}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -249,8 +249,8 @@ export const about = {
|
|||
showMessage(window.siyuan.languages.copied);
|
||||
writeText(window.siyuan.config.repo.key);
|
||||
});
|
||||
about.element.querySelector("#removeKey").addEventListener("click", () => {
|
||||
confirmDialog(window.siyuan.languages.remove, "", () => {
|
||||
about.element.querySelector("#resetRepo").addEventListener("click", () => {
|
||||
confirmDialog("⚠️ " + window.siyuan.languages.resetRepo, window.siyuan.languages.resetRepoTip, () => {
|
||||
fetchPost("/api/repo/resetRepo", {}, () => {
|
||||
window.siyuan.config.repo.key = "";
|
||||
importKeyElement.parentElement.classList.remove("fn__none");
|
||||
|
|
|
@ -93,8 +93,8 @@ func importRepoKey(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
hexKey := arg["key"].(string)
|
||||
if err := model.ImportRepoKey(hexKey); nil != err {
|
||||
base64Key := arg["key"].(string)
|
||||
if err := model.ImportRepoKey(base64Key); nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = model.Conf.Language(137)
|
||||
return
|
||||
|
|
|
@ -18,7 +18,7 @@ package model
|
|||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
|
@ -59,10 +59,10 @@ func GetRepoIndexLogs(page int) (logs []*dejavu.Log, pageCount, totalCount int,
|
|||
return
|
||||
}
|
||||
|
||||
func ImportRepoKey(hexKey string) (err error) {
|
||||
func ImportRepoKey(base64Key string) (err error) {
|
||||
msgId := util.PushMsg(Conf.Language(136), 1000*7)
|
||||
|
||||
key, err := hex.DecodeString(hexKey)
|
||||
key, err := base64.StdEncoding.DecodeString(base64Key)
|
||||
if nil != err {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue