remove wasm
This commit is contained in:
@@ -4,3 +4,5 @@ VUE_APP_BASE_NAME = production
|
|||||||
VUE_APP_BASE_URL = https://flagnote.com
|
VUE_APP_BASE_URL = https://flagnote.com
|
||||||
VUE_APP_NOTE_MAX_COUNT = 131072
|
VUE_APP_NOTE_MAX_COUNT = 131072
|
||||||
VUE_APP_NOTE_MAX_DESC = 128K
|
VUE_APP_NOTE_MAX_DESC = 128K
|
||||||
|
VUE_APP_CDN_PROVIDER = jsdelivr
|
||||||
|
# VUE_APP_CDN_PROVIDER = unpkg
|
||||||
@@ -23,7 +23,8 @@
|
|||||||
</title>
|
</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: #dddddd
|
background-color: #dddddd;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
|
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
|
||||||
@@ -32,9 +33,6 @@
|
|||||||
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
|
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
|
||||||
<link rel="stylesheet" type="text/css" href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" />
|
<link rel="stylesheet" type="text/css" href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" />
|
||||||
<% } %>
|
<% } %>
|
||||||
<script>
|
|
||||||
window.wasm_flate_bg_path = "https://cdn.jsdelivr.net/npm/wasm-flate@1.0.2-browser/wasm_flate_bg.wasm"
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body><noscript><strong>Please enable JavaScript to continue.</strong></noscript>
|
<body><noscript><strong>Please enable JavaScript to continue.</strong></noscript>
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ axios.interceptors.response.use(undefined, (err) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export function saveNote(noteForm,state, secret) {
|
export function saveNote(noteForm,state, secret) {
|
||||||
|
setStoreText(noteForm, state, secret);
|
||||||
|
|
||||||
let storeKey = secret.storeKey;
|
let storeKey = secret.storeKey;
|
||||||
|
|
||||||
let storeInfo = storage.local.getText(storeKey);
|
let storeInfo = storage.local.getText(storeKey);
|
||||||
@@ -43,14 +45,11 @@ export function saveNote(noteForm,state, secret) {
|
|||||||
|
|
||||||
let viewStoreText = wrap(noteForm.text, secret.secretKey);
|
let viewStoreText = wrap(noteForm.text, secret.secretKey);
|
||||||
if (viewStoreText != note.text) {
|
if (viewStoreText != note.text) {
|
||||||
|
return new Promise(function (onCompleted) {
|
||||||
setStoreText(noteForm, state, secret);
|
let res = { data: {} };
|
||||||
|
res.data.code = "100014";
|
||||||
// return new Promise(function (onCompleted) {
|
onCompleted(res);
|
||||||
// let res = { data: {} };
|
});
|
||||||
// res.data.code = "100014";
|
|
||||||
// onCompleted(res);
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let array = Buffer.from(note.text, 'base64')
|
let array = Buffer.from(note.text, 'base64')
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import pako from "pako";
|
import pako from "pako";
|
||||||
import {Buffer} from "buffer";
|
import { Buffer } from "buffer";
|
||||||
//import {gzip_encode_raw,gzip_decode_raw} from 'wasm-flate';
|
|
||||||
|
|
||||||
const wasmFlate = window.wasm_bindgen;
|
|
||||||
|
|
||||||
CryptoJS.enc.Uint8Array = {
|
CryptoJS.enc.Uint8Array = {
|
||||||
/**
|
/**
|
||||||
@@ -96,7 +93,7 @@ export function base64Encode(text) {
|
|||||||
|
|
||||||
//base64 decode atob
|
//base64 decode atob
|
||||||
export function base64Decode(text) {
|
export function base64Decode(text) {
|
||||||
return Buffer.from(text,'base64').toString('utf-8');
|
return Buffer.from(text, 'base64').toString('utf-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function noteUnzip(wdary) {
|
export function noteUnzip(wdary) {
|
||||||
@@ -112,19 +109,11 @@ export function noteZip(text) {
|
|||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function zip(data){
|
export function zip(data) {
|
||||||
if(wasmFlate.__wbindgen_wasm_module){
|
|
||||||
return wasmFlate.gzip_encode_raw(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pako.gzip(data);
|
return pako.gzip(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function unzip(data){
|
export function unzip(data) {
|
||||||
if(wasmFlate.__wbindgen_wasm_module){
|
|
||||||
return wasmFlate.gzip_decode_raw(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pako.ungzip(data);
|
return pako.ungzip(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import VueAxios from 'vue-axios'
|
|||||||
import i18n from './i18n/'
|
import i18n from './i18n/'
|
||||||
import NoteConstant from "@/libs/constants"
|
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';
|
//import 'view-ui-plus/dist/styles/viewuiplus.css';
|
||||||
|
|
||||||
axios.defaults.baseURL = NoteConstant.servicePath;
|
axios.defaults.baseURL = NoteConstant.servicePath;
|
||||||
@@ -32,8 +32,6 @@ app.component('Input', Input);
|
|||||||
app.component('Form', Form);
|
app.component('Form', Form);
|
||||||
app.component('WordCount', WordCount);
|
app.component('WordCount', WordCount);
|
||||||
app.component('Footer', Footer);
|
app.component('Footer', Footer);
|
||||||
app.component('Skeleton', Skeleton);
|
|
||||||
app.component('SkeletonItem', SkeletonItem);
|
|
||||||
app.component('Badge', Badge);
|
app.component('Badge', Badge);
|
||||||
app.component('Icon', Icon);
|
app.component('Icon', Icon);
|
||||||
app.component('Tag', Tag);
|
app.component('Tag', Tag);
|
||||||
|
|||||||
@@ -134,7 +134,7 @@
|
|||||||
<Row>
|
<Row>
|
||||||
<Col :xs="{ span: 24, offset: 0 }" :sm="{ span: 22, offset: 1 }" :md="{ span: 20, offset: 2 }"
|
<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 }">
|
: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>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
@@ -307,7 +307,9 @@ export default {
|
|||||||
this.bindCtrlAllEvent();
|
this.bindCtrlAllEvent();
|
||||||
this.bindToTopEvent();
|
this.bindToTopEvent();
|
||||||
|
|
||||||
|
if(window.wasm_flate_bg_path){
|
||||||
window.wasm_bindgen(window.wasm_flate_bg_path);
|
window.wasm_bindgen(window.wasm_flate_bg_path);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.addEventListener('beforeunload', e => this.beforeunloadHandler(e))
|
window.addEventListener('beforeunload', e => this.beforeunloadHandler(e))
|
||||||
|
|||||||
@@ -249,7 +249,7 @@
|
|||||||
<Row>
|
<Row>
|
||||||
<Col :xs="{ span: 24, offset: 0 }" :sm="{ span: 22, offset: 1 }" :md="{ span: 20, offset: 2 }"
|
<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 }">
|
: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>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
@@ -262,32 +262,8 @@
|
|||||||
:lg="{ span: 18, offset: 3 }" :xl="{ span: 16, offset: 4 }" :xxl="{ span: 16, offset: 4 }">
|
:lg="{ span: 18, offset: 3 }" :xl="{ span: 16, offset: 4 }" :xxl="{ span: 16, offset: 4 }">
|
||||||
<Card :padding="0">
|
<Card :padding="0">
|
||||||
<div ref="html2canvas" id="wrapper" style="border-left: 2px solid white;">
|
<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"
|
<Input element-id="noteText" readonly type="textarea" :border="false" v-model="noteForm.text"
|
||||||
:autosize="{ minRows: 35 }" />
|
:autosize="{ minRows: 35 }" />
|
||||||
</template>
|
|
||||||
</Skeleton>
|
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ const assetsCDN = {
|
|||||||
'https://cdn.jsdelivr.net/npm/pako@2.1.0/dist/pako.min.js',
|
'https://cdn.jsdelivr.net/npm/pako@2.1.0/dist/pako.min.js',
|
||||||
// 'https://cdn.jsdelivr.net/npm/view-ui-plus@1.3.10/dist/viewuiplus.min.js',
|
// 'https://cdn.jsdelivr.net/npm/view-ui-plus@1.3.10/dist/viewuiplus.min.js',
|
||||||
|
|
||||||
'https://cdn.jsdelivr.net/npm/wasm-flate@1.0.2-browser/wasm_flate.min.js',
|
|
||||||
'https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js',
|
'https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js',
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -44,28 +43,6 @@ const config = {
|
|||||||
|
|
||||||
config.externals = assetsCDN.externals;
|
config.externals = assetsCDN.externals;
|
||||||
|
|
||||||
// const assetsCDN = {
|
|
||||||
// // 放置需要使用 cdn 的库
|
|
||||||
// externals: {
|
|
||||||
// 'vue': 'Vue',
|
|
||||||
// 'vue-router': 'VueRouter',
|
|
||||||
// "crypto-js": "CryptoJS",
|
|
||||||
// 'pako': 'pako',
|
|
||||||
// "html2canvas": "html2canvas",
|
|
||||||
// 'view-ui-plus':'ViewUIPlus',
|
|
||||||
// },
|
|
||||||
// css: [
|
|
||||||
// // 存放 引用 css文件的地址
|
|
||||||
// '//unpkg.com/element-plus@1.0.2-beta.48/lib/theme-chalk/index.css',
|
|
||||||
// ],
|
|
||||||
// js: [
|
|
||||||
// // 存放 引用 js 文件的地址
|
|
||||||
// '//unpkg.com/vue@3.1.1/dist/vue.global.js',
|
|
||||||
// '//unpkg.com/element-plus@1.0.2-beta.48/lib/index.full.js'
|
|
||||||
// ]
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// 为生产环境修改配置
|
// 为生产环境修改配置
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
config.plugins.push(
|
config.plugins.push(
|
||||||
@@ -86,7 +63,7 @@ const config = {
|
|||||||
|
|
||||||
new CompressionPlugin({
|
new CompressionPlugin({
|
||||||
algorithm: "gzip", // 使用gzip压缩
|
algorithm: "gzip", // 使用gzip压缩
|
||||||
test: /\.js$|\.html$|\.png$|\.jpg$|\.svg$|\.wasm$|\.css$/, // 匹配文件名
|
test: /\.js$|\.html$|\.png$|\.jpg$|\.svg$|\.css$/, // 匹配文件名
|
||||||
filename: "[path][base].gz[query]", // 压缩后的文件名(保持原文件名,后缀加.gz)
|
filename: "[path][base].gz[query]", // 压缩后的文件名(保持原文件名,后缀加.gz)
|
||||||
minRatio: 1, // 压缩率小于1才会压缩
|
minRatio: 1, // 压缩率小于1才会压缩
|
||||||
threshold: 5120, // 对超过10k的数据压缩
|
threshold: 5120, // 对超过10k的数据压缩
|
||||||
@@ -98,7 +75,6 @@ const config = {
|
|||||||
|
|
||||||
transpileDependencies: false,
|
transpileDependencies: false,
|
||||||
|
|
||||||
|
|
||||||
chainWebpack: (setting) => {
|
chainWebpack: (setting) => {
|
||||||
setting.plugin("html").tap((args) => {
|
setting.plugin("html").tap((args) => {
|
||||||
args[0].cdn = assetsCDN
|
args[0].cdn = assetsCDN
|
||||||
|
|||||||
Reference in New Issue
Block a user