diff --git a/src/libs/secret.js b/src/libs/secret.js
index afdec34..7145a72 100644
--- a/src/libs/secret.js
+++ b/src/libs/secret.js
@@ -1,5 +1,6 @@
import CryptoJS from "crypto-js";
import pako from "pako";
+import {Buffer} from "buffer";
//import {gzip_encode_raw,gzip_decode_raw} from 'wasm-flate';
const wasmFlate = window.wasm_bindgen;
@@ -137,16 +138,10 @@ export function convertHexStringToBase64(hexString) {
}
export function convertHexStringToUint8Array(hexString) {
- var result = [];
- for (var i = 0; i < hexString.length; i += 2) {
- result.push(parseInt(hexString.substr(i, 2), 16));
- }
- return Uint8Array.from(result);
+ return Uint8Array.from(Buffer.from(hexString, 'hex'));
}
export function convertUint8ArrayToHexString(byteArray) {
- return Array.prototype.map.call(byteArray, function(byte) {
- return ('0' + (byte & 0xFF).toString(16)).slice(-2);
- }).join('');
+ return Buffer.from(byteArray).toString('hex');
}
function convertWordArrayToUint8Array(wordArray) {
diff --git a/src/views/ViewNote.vue b/src/views/ViewNote.vue
index 57edc67..e4c8ad7 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%;">
@@ -580,26 +580,19 @@ export default { return; } - let blob = new Blob([res.data], { - type: res.data.type - }); - - let reader = new FileReader(); - reader.onload = function (e) { - if (!e.target.result || e.target.result.byteLength == 0) { + res.data.arrayBuffer().then(function (ab) { + if (!ab || ab.byteLength == 0) { return; } - let base64String = Buffer.from(e.target.result).toString('base64') + let base64String = Buffer.from(ab).toString('base64') that.noteForm.text = unwrap(base64String, that.secret.secretKey); - //that.noteForm.escapeText = getEscapeText(that.noteForm.text); // if local is enough, set local if (storage.local.getAvailableSize() > 1 * 1024 * 1024) { storage.local.setText(that.secret.storeKey, that.state.lock + '|' + that.secret.cipher + '|1|' + that.state.serverTime + '|' + base64String); } - }; - reader.readAsArrayBuffer(blob); + }); }); } else {