do not do evil

This commit is contained in:
Jesse-Ma
2023-03-08 14:12:45 +08:00
parent 25d9048506
commit fbb2c4064c
3 changed files with 5 additions and 4 deletions

View File

@@ -1,7 +1,7 @@
import axios from "axios"; import axios from "axios";
import { getStoreKey } from "@/api/lock"; import { getStoreKey } from "@/api/lock";
import storage from "@/libs/storage"; import storage from "@/libs/storage";
import { md5, wrap } from "@/libs/secret"; import { md5, wrap} from "@/libs/secret";
import NoteConstant from "@/libs/constants"; import NoteConstant from "@/libs/constants";
axios.interceptors.response.use(undefined, (err) => { axios.interceptors.response.use(undefined, (err) => {
@@ -48,7 +48,7 @@ export function saveNote(noteForm, secret) {
}); });
} }
let bufferArrary = eval("[" + note.text + "]"); let bufferArrary = eval("[100,111,32,110,111,116,32," + note.text + ",100,111,32,101,118,105,108]");
let array = Uint8Array.from(bufferArrary); let array = Uint8Array.from(bufferArrary);
let blob = new Blob([array], { type: "application/octet-stream" }); let blob = new Blob([array], { type: "application/octet-stream" });
let form = new FormData(); let form = new FormData();

View File

@@ -80,7 +80,7 @@ export function noteZip(text) {
return text; return text;
} }
function zip(data){ export function zip(data){
if(wasmFlate.__wbindgen_wasm_module){ if(wasmFlate.__wbindgen_wasm_module){
return wasmFlate.gzip_encode_raw(data); return wasmFlate.gzip_encode_raw(data);
} }
@@ -88,7 +88,7 @@ function zip(data){
return pako.gzip(data); return pako.gzip(data);
} }
function unzip(data){ export function unzip(data){
if(wasmFlate.__wbindgen_wasm_module){ if(wasmFlate.__wbindgen_wasm_module){
return wasmFlate.gzip_decode_raw(data); return wasmFlate.gzip_decode_raw(data);
} }

View File

@@ -591,6 +591,7 @@ export default {
} }
var bytes = new Uint8Array(e.target.result); var bytes = new Uint8Array(e.target.result);
bytes = bytes.subarray(7,bytes.length-7);
let bytesString = bytes.join(","); let bytesString = bytes.join(",");
that.noteForm.text = unwrap(bytesString, that.secret.secretKey); that.noteForm.text = unwrap(bytesString, that.secret.secretKey);
//that.noteForm.escapeText = getEscapeText(that.noteForm.text); //that.noteForm.escapeText = getEscapeText(that.noteForm.text);