getSecretKey and jsonresult

This commit is contained in:
Jesse-Ma
2023-03-01 17:08:45 +08:00
parent 254287aef6
commit 5a7b53b815
6 changed files with 117 additions and 57 deletions

View File

@@ -339,7 +339,7 @@
<script>
import { md5, unwrap } from "@/libs/secret";
import { getStoreKey, getSecretKey } from "@/api/lock";
import { getStoreKey } from "@/api/lock";
import { deleteNote, getNoteBlob } from "@/api/note";
import storage from "@/libs/storage";
//import { getEscapeText } from "@/libs/noteStorage";
@@ -394,6 +394,7 @@ export default {
// read $route
this.noteForm.key = this.$route.params.name;
let noteMeta = this.$route.meta.noteMeta;
this.secret.secretKey = noteMeta.secretKey;
//ipad chrome url not redirect
let path = location.pathname;
@@ -406,7 +407,6 @@ export default {
this.noteForm.noteUrl = getNoteUrl(this.noteForm.key);
this.secret.storeKey = getStoreKey(this.noteForm.key);
this.secret.secretKey = getSecretKey(this.noteForm.key, this.secret.password);
if (noteMeta) {
this.state.lock = noteMeta.lock;
@@ -553,12 +553,14 @@ export default {
this.model.deleting = true;
let that = this;
deleteNote(this.noteForm.key).then(res => {
if (res) {
if (res.data&&res.data.code=="000000") {
storage.local.delete(that.secret.storeKey);
location.reload();
} else {
that.model.deleting = false;
}
}).catch(error => {
alert(error);
});
},
loadText() {