wasm 加密
This commit is contained in:
@@ -21,8 +21,7 @@
|
||||
"vue": "^2.7.14",
|
||||
"vue-axios": "^3.5.2",
|
||||
"vue-i18n": "^8.28.2",
|
||||
"vue-router": "^3.5.4",
|
||||
"wasm-flate": "1.0.2-bundler"
|
||||
"vue-router": "^3.6.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.16",
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</style>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.min.js" rel="stylesheet"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue-router@3.5.4/dist/vue-router.min.js" rel="stylesheet"
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue-router@3.6.5/dist/vue-router.min.js" rel="stylesheet"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/axios@0.27.2/dist/axios.min.js" rel="stylesheet"
|
||||
type="text/javascript"></script>
|
||||
@@ -44,10 +44,19 @@
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.11/dist/clipboard.min.js" rel="stylesheet"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/wasm-flate@1.0.2-browser/wasm_flate.js" rel="stylesheet"
|
||||
type="text/javascript"></script>
|
||||
<script>
|
||||
window.wasm_flate_bg_path = "https://cdn.jsdelivr.net/npm/wasm-flate@1.0.2-browser/wasm_flate_bg.wasm"
|
||||
</script>
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/view-design@4.7.0/dist/styles/iview.css">
|
||||
<!--Global site tag(gtag.js)-Google Analytics-->
|
||||
<!--
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FPS9PD2DFF"></script>
|
||||
|
||||
<script>window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments) } gtag("js", new Date()); gtag("config", "G-FPS9PD2DFF");</script>
|
||||
-->
|
||||
</head>
|
||||
|
||||
<body><noscript><strong>Please enable JavaScript to continue.</strong></noscript>
|
||||
@@ -58,6 +67,8 @@
|
||||
if (!!window.ActiveXObject || "ActiveXObject" in window) {
|
||||
document.querySelector('#noie').style.display = 'block';
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import CryptoJS from "crypto-js";
|
||||
import pako from "pako";
|
||||
import {gzip_encode_raw,gzip_decode_raw} from 'wasm-flate';
|
||||
//import {gzip_encode_raw,gzip_decode_raw} from 'wasm-flate';
|
||||
|
||||
const wasmFlate = window.wasm_bindgen;
|
||||
|
||||
/**
|
||||
* @word 要加密的内容
|
||||
@@ -80,16 +81,18 @@ export function noteZip(text) {
|
||||
}
|
||||
|
||||
function zip(data){
|
||||
if(gzip_encode_raw){
|
||||
return gzip_encode_raw(data);
|
||||
if(wasmFlate.__wbindgen_wasm_module){
|
||||
return wasmFlate.gzip_encode_raw(data);
|
||||
}
|
||||
|
||||
return pako.gzip(data);
|
||||
}
|
||||
|
||||
function unzip(data){
|
||||
if(gzip_decode_raw){
|
||||
return gzip_decode_raw(data);
|
||||
if(wasmFlate.__wbindgen_wasm_module){
|
||||
return wasmFlate.gzip_decode_raw(data);
|
||||
}
|
||||
|
||||
return pako.ungzip(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -295,6 +295,8 @@ export default {
|
||||
|
||||
this.bindCtrlAllEvent();
|
||||
this.bindToTopEvent();
|
||||
|
||||
window.wasm_bindgen(window.wasm_flate_bg_path);
|
||||
},
|
||||
mounted() {
|
||||
const myObserver = new ResizeObserver(entries => {
|
||||
|
||||
@@ -6,7 +6,10 @@ module.exports = defineConfig({
|
||||
|
||||
assetsDir: 'static',
|
||||
productionSourceMap: false,
|
||||
|
||||
configureWebpack: (config) => {
|
||||
config.experiments = { asyncWebAssembly: true,syncWebAssembly:true }
|
||||
|
||||
|
||||
config.externals = {
|
||||
'vue': 'Vue',
|
||||
@@ -20,8 +23,7 @@ module.exports = defineConfig({
|
||||
"iview": 'ViewUI',
|
||||
"file-saver": 'saveAs',
|
||||
"clipboard": "ClipboardJS",
|
||||
"vue-i18n": "VueI18n",
|
||||
|
||||
"vue-i18n": "VueI18n"
|
||||
};
|
||||
|
||||
// 为生产环境修改配置
|
||||
@@ -44,7 +46,7 @@ module.exports = defineConfig({
|
||||
|
||||
new CompressionPlugin({
|
||||
algorithm: "gzip", // 使用gzip压缩
|
||||
test: /\.js$|\.html$|\.png$|\.jpg$|\.svg$|\.css$/, // 匹配文件名
|
||||
test: /\.js$|\.html$|\.png$|\.jpg$|\.svg$|\.wasm$|\.css$/, // 匹配文件名
|
||||
filename: "[path][base].gz[query]", // 压缩后的文件名(保持原文件名,后缀加.gz)
|
||||
minRatio: 1, // 压缩率小于1才会压缩
|
||||
threshold: 5120, // 对超过10k的数据压缩
|
||||
@@ -63,7 +65,8 @@ module.exports = defineConfig({
|
||||
devServer: {
|
||||
proxy: {
|
||||
"/note": {
|
||||
target: "http://127.0.0.1:10000/", // 后台接口域名
|
||||
// target: "https://flagnote.com/", // 后台接口域名
|
||||
target: "http://localhost:10000/", // 后台接口域名
|
||||
secure: false, // 如果是https接口,需要配置这个参数
|
||||
changeOrigin: true, //是否跨域
|
||||
pathRewrite: {
|
||||
|
||||
Reference in New Issue
Block a user