diff --git a/package.json b/package.json
index bfbd08a..597b131 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,7 @@
},
"dependencies": {
"axios": "^0.27.2",
+ "buffer": "^6.0.3",
"clipboard": "^2.0.11",
"crypto-js": "^4.1.1",
"escape-html": "^1.0.3",
diff --git a/src/api/note.js b/src/api/note.js
index 70f1fef..9d636bc 100644
--- a/src/api/note.js
+++ b/src/api/note.js
@@ -1,8 +1,9 @@
import axios from "axios";
import { getStoreKey } from "@/api/lock";
import storage from "@/libs/storage";
-import { md5, wrap,convertBase64ToHexString,convertHexStringToUint8Array} from "@/libs/secret";
+import { md5, wrap} from "@/libs/secret";
import NoteConstant from "@/libs/constants";
+import { Buffer } from 'buffer';
axios.interceptors.response.use(undefined, (err) => {
const { config: originalRequest } = err;
@@ -48,14 +49,7 @@ export function saveNote(noteForm, secret) {
});
}
- // let bufferArrary = eval("[" + note.text + "]");
- // let array = Uint8Array.from(bufferArrary);
-
- // let encoder = new TextEncoder()
- // let array = encoder.encode(note.text)
-
- let hexString = convertBase64ToHexString(note.text)
- let array = convertHexStringToUint8Array(hexString)
+ let array = Buffer.from(note.text, 'base64')
let blob = new Blob([array], { type: "application/octet-stream" });
let form = new FormData();
diff --git a/src/libs/secret.js b/src/libs/secret.js
index 3ad923a..afdec34 100644
--- a/src/libs/secret.js
+++ b/src/libs/secret.js
@@ -88,15 +88,15 @@ export function aesDecrypt(word, keyWord) {
return decrypt;
}
-//base64 encode
-// export function encode(text) {
-// return Buffer.from(text, 'utf-8').toString('base64');
-// }
+//base64 encode btoa
+export function base64Encode(text) {
+ return Buffer.from(text, 'utf-8').toString('base64');
+}
-//base64 decode
-// export function decode(text) {
-// return Buffer.from(text,'base64').toString('utf-8');
-// }
+//base64 decode atob
+export function base64Decode(text) {
+ return Buffer.from(text,'base64').toString('utf-8');
+}
export function noteUnzip(wdary) {
let data = unzip(wdary);
diff --git a/src/views/EditNote.vue b/src/views/EditNote.vue
index e3cef60..cd2027a 100644
--- a/src/views/EditNote.vue
+++ b/src/views/EditNote.vue
@@ -549,7 +549,7 @@ export default {
dataURLToBlob(dataurl) {
let arr = dataurl.split(',');
let mime = arr[0].match(/:(.*?);/)[1];
- let bstr = atob(arr[1]);
+ let bstr = window.atob(arr[1]);
let n = bstr.length;
let u8arr = new Uint8Array(n);
while (n--) {
diff --git a/src/views/ViewNote.vue b/src/views/ViewNote.vue
index 6660f29..57edc67 100644
--- a/src/views/ViewNote.vue
+++ b/src/views/ViewNote.vue
@@ -172,17 +172,17 @@
+
+ z-index: 1000;
+ position: absolute;
+ top: -2px;
+ left: 0px;
+ width: 100%;">
@@ -336,7 +336,7 @@