remove wasm
This commit is contained in:
@@ -20,6 +20,8 @@ axios.interceptors.response.use(undefined, (err) => {
|
||||
});
|
||||
|
||||
export function saveNote(noteForm,state, secret) {
|
||||
setStoreText(noteForm, state, secret);
|
||||
|
||||
let storeKey = secret.storeKey;
|
||||
|
||||
let storeInfo = storage.local.getText(storeKey);
|
||||
@@ -43,14 +45,11 @@ export function saveNote(noteForm,state, secret) {
|
||||
|
||||
let viewStoreText = wrap(noteForm.text, secret.secretKey);
|
||||
if (viewStoreText != note.text) {
|
||||
|
||||
setStoreText(noteForm, state, secret);
|
||||
|
||||
// return new Promise(function (onCompleted) {
|
||||
// let res = { data: {} };
|
||||
// res.data.code = "100014";
|
||||
// onCompleted(res);
|
||||
// });
|
||||
return new Promise(function (onCompleted) {
|
||||
let res = { data: {} };
|
||||
res.data.code = "100014";
|
||||
onCompleted(res);
|
||||
});
|
||||
}
|
||||
|
||||
let array = Buffer.from(note.text, 'base64')
|
||||
|
||||
@@ -1,9 +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;
|
||||
import { Buffer } from "buffer";
|
||||
|
||||
CryptoJS.enc.Uint8Array = {
|
||||
/**
|
||||
@@ -47,7 +44,7 @@ CryptoJS.enc.Uint8Array = {
|
||||
|
||||
export function wrap(text, secretKey) {
|
||||
text = "FLAGNOTE#" + text;
|
||||
let ui8ary = noteZip(text);
|
||||
let ui8ary = noteZip(text);
|
||||
let result = aesEncrypt(convertUint8ArrayToWordArray(ui8ary), secretKey);
|
||||
return result;
|
||||
}
|
||||
@@ -96,7 +93,7 @@ export function base64Encode(text) {
|
||||
|
||||
//base64 decode atob
|
||||
export function base64Decode(text) {
|
||||
return Buffer.from(text,'base64').toString('utf-8');
|
||||
return Buffer.from(text, 'base64').toString('utf-8');
|
||||
}
|
||||
|
||||
export function noteUnzip(wdary) {
|
||||
@@ -112,29 +109,21 @@ export function noteZip(text) {
|
||||
return text;
|
||||
}
|
||||
|
||||
export function zip(data){
|
||||
if(wasmFlate.__wbindgen_wasm_module){
|
||||
return wasmFlate.gzip_encode_raw(data);
|
||||
}
|
||||
|
||||
export function zip(data) {
|
||||
return pako.gzip(data);
|
||||
}
|
||||
|
||||
export function unzip(data){
|
||||
if(wasmFlate.__wbindgen_wasm_module){
|
||||
return wasmFlate.gzip_decode_raw(data);
|
||||
}
|
||||
|
||||
export function unzip(data) {
|
||||
return pako.ungzip(data);
|
||||
}
|
||||
|
||||
|
||||
export function convertBase64ToHexString(base64) {
|
||||
return CryptoJS.enc.Hex.stringify(CryptoJS.enc.Base64.parse(base64));
|
||||
return CryptoJS.enc.Hex.stringify(CryptoJS.enc.Base64.parse(base64));
|
||||
}
|
||||
|
||||
export function convertHexStringToBase64(hexString) {
|
||||
return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Hex.parse(hexString));
|
||||
return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Hex.parse(hexString));
|
||||
}
|
||||
|
||||
export function convertHexStringToUint8Array(hexString) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import VueAxios from 'vue-axios'
|
||||
import i18n from './i18n/'
|
||||
import NoteConstant from "@/libs/constants"
|
||||
|
||||
import {Layout,Header,Row,Col,Modal,Button,ButtonGroup,Card,Content,Input,Form,WordCount,Footer,Skeleton,SkeletonItem,Badge,Icon,Tag} from 'view-ui-plus';
|
||||
import {Layout,Header,Row,Col,Modal,Button,ButtonGroup,Card,Content,Input,Form,WordCount,Footer,Badge,Icon,Tag} from 'view-ui-plus';
|
||||
//import 'view-ui-plus/dist/styles/viewuiplus.css';
|
||||
|
||||
axios.defaults.baseURL = NoteConstant.servicePath;
|
||||
@@ -32,8 +32,6 @@ app.component('Input', Input);
|
||||
app.component('Form', Form);
|
||||
app.component('WordCount', WordCount);
|
||||
app.component('Footer', Footer);
|
||||
app.component('Skeleton', Skeleton);
|
||||
app.component('SkeletonItem', SkeletonItem);
|
||||
app.component('Badge', Badge);
|
||||
app.component('Icon', Icon);
|
||||
app.component('Tag', Tag);
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
<Row>
|
||||
<Col :xs="{ span: 24, offset: 0 }" :sm="{ span: 22, offset: 1 }" :md="{ span: 20, offset: 2 }"
|
||||
:lg="{ span: 18, offset: 3 }" :xl="{ span: 16, offset: 4 }" :xxl="{ span: 16, offset: 4 }">
|
||||
<div class="noteHeader" style="height:40px;"></div>
|
||||
<div class="noteHeader" style="height:40px;border-left: 2px solid #ed4014;"></div>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
@@ -307,7 +307,9 @@ export default {
|
||||
this.bindCtrlAllEvent();
|
||||
this.bindToTopEvent();
|
||||
|
||||
window.wasm_bindgen(window.wasm_flate_bg_path);
|
||||
if(window.wasm_flate_bg_path){
|
||||
window.wasm_bindgen(window.wasm_flate_bg_path);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('beforeunload', e => this.beforeunloadHandler(e))
|
||||
|
||||
@@ -249,7 +249,7 @@
|
||||
<Row>
|
||||
<Col :xs="{ span: 24, offset: 0 }" :sm="{ span: 22, offset: 1 }" :md="{ span: 20, offset: 2 }"
|
||||
:lg="{ span: 18, offset: 3 }" :xl="{ span: 16, offset: 4 }" :xxl="{ span: 16, offset: 4 }">
|
||||
<div class="noteHeader" style="height:40px;"></div>
|
||||
<div class="noteHeader" style="height:40px;border-left: 2px solid white;"></div>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
@@ -262,32 +262,8 @@
|
||||
:lg="{ span: 18, offset: 3 }" :xl="{ span: 16, offset: 4 }" :xxl="{ span: 16, offset: 4 }">
|
||||
<Card :padding="0">
|
||||
<div ref="html2canvas" id="wrapper" style="border-left: 2px solid white;">
|
||||
<Skeleton :loading="showSkeleton">
|
||||
<template #template>
|
||||
<div style=" padding: 10px; width: 100%; height: 800px;text-align: left;">
|
||||
<SkeletonItem />
|
||||
<SkeletonItem block width="80%" height="16px" />
|
||||
<SkeletonItem width="80%" height="16px" class="ivu-mr" />
|
||||
<SkeletonItem width="68%" height="16px" class="ivu-mr" />
|
||||
<SkeletonItem width="38%" height="16px" />
|
||||
<SkeletonItem width="88%" height="16px" />
|
||||
<SkeletonItem block width="80%" height="16px" />
|
||||
<SkeletonItem width="80%" height="16px" class="ivu-mr" />
|
||||
<SkeletonItem width="68%" height="16px" class="ivu-mr" />
|
||||
<SkeletonItem width="38%" height="16px" />
|
||||
<SkeletonItem width="88%" height="16px" />
|
||||
<SkeletonItem block width="80%" height="16px" />
|
||||
<SkeletonItem width="80%" height="16px" class="ivu-mr" />
|
||||
<SkeletonItem width="68%" height="16px" class="ivu-mr" />
|
||||
<SkeletonItem width="38%" height="16px" />
|
||||
<SkeletonItem width="88%" height="16px" />
|
||||
</div>
|
||||
</template>
|
||||
<template #default>
|
||||
<Input element-id="noteText" readonly type="textarea" :border="false" v-model="noteForm.text"
|
||||
:autosize="{ minRows: 35 }" />
|
||||
</template>
|
||||
</Skeleton>
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
Reference in New Issue
Block a user