cdn 分离
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
"dependencies": {
|
||||
"axios": "^0.27.2",
|
||||
"clipboard": "^2.0.11",
|
||||
"core-js": "^3.26.1",
|
||||
"crypto-js": "^4.1.1",
|
||||
"escape-html": "^1.0.3",
|
||||
"file-saver": "^2.0.5",
|
||||
@@ -25,6 +24,7 @@
|
||||
"vue-router": "^3.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"core-js": "^3.26.1",
|
||||
"@babel/core": "^7.12.16",
|
||||
"@babel/eslint-parser": "^7.12.16",
|
||||
"@vue/cli-plugin-babel": "~5.0.8",
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<meta name="renderer" content="webkit" />
|
||||
<meta name="force-rendering" content="webkit"/>
|
||||
<meta name="force-rendering" content="webkit" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=yes"
|
||||
/>
|
||||
<meta name="viewport"
|
||||
content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=yes" />
|
||||
|
||||
<meta name="keywords" content="flagnote" />
|
||||
<meta name="description" content="flag note" />
|
||||
@@ -79,10 +78,7 @@
|
||||
</script>
|
||||
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script
|
||||
async
|
||||
src="https://www.googletagmanager.com/gtag/js?id=G-FPS9PD2DFF"
|
||||
></script>
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FPS9PD2DFF"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() {
|
||||
@@ -92,15 +88,42 @@
|
||||
|
||||
gtag("config", "G-FPS9PD2DFF");
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<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"
|
||||
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>
|
||||
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/pako@2.1.0/dist/pako.min.js" rel="stylesheet"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/qrcode@1.5.1/build/qrcode.js" rel="stylesheet"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/view-design@4.7.0/dist/iview.min.js" rel="stylesheet"
|
||||
type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/crypto-js@4.1.1/crypto-js.min.js" rel="stylesheet" type="text/javascript"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.5/dist/FileSaver.min.js" rel="stylesheet" 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/vue-i18n@8.21.1/dist/vue-i18n.min.js" rel="stylesheet" type="text/javascript"></script>
|
||||
|
||||
<!--
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue-axios@3.5.2/dist/vue-axios.esm.min.js" rel="stylesheet" type="text/javascript"></script>
|
||||
-->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/view-design@4.7.0/dist/styles/iview.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<noscript>
|
||||
<strong
|
||||
>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work
|
||||
properly without JavaScript enabled. Please enable it to
|
||||
continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -3,4 +3,4 @@ import ViewUI from 'view-design'
|
||||
|
||||
Vue.use(ViewUI)
|
||||
|
||||
import 'view-design/dist/styles/iview.css'
|
||||
//import 'view-design/dist/styles/iview.css'
|
||||
|
||||
@@ -2,6 +2,7 @@ import Vue from "vue";
|
||||
import VueRouter from "vue-router";
|
||||
import EditNote from "@/views/EditNote.vue";
|
||||
import ViewNote from "@/views/ViewNote.vue";
|
||||
import ErrorView from "@/views/ErrorView.vue";
|
||||
import InvalidateNote from "@/views/InvalidateNote.vue";
|
||||
import { getKeyMeta, getNoteMeta } from "@/api/note";
|
||||
import { getStoreKey } from "@/api/lock";
|
||||
@@ -27,6 +28,7 @@ function getErrorMetaParam() {
|
||||
|
||||
function getNoteView() {
|
||||
let path = location.pathname;
|
||||
|
||||
let key = path.substring(1, path.length);
|
||||
|
||||
if (keyMeta && keyMeta.key) {
|
||||
@@ -113,12 +115,12 @@ const routes = [
|
||||
redirect: getHomeRedirect(),
|
||||
},
|
||||
{
|
||||
path: "/:name([a-z0-9]{16})",
|
||||
path: "/:name([a-z0-9]{1,20})",
|
||||
name: "note",
|
||||
component: getNoteView(),
|
||||
meta: { keyMeta: getKeyMetaParam(), noteMeta: getNoteMetaParam(), errorMeta: getErrorMetaParam() },
|
||||
//alias:'/xxxx'
|
||||
},
|
||||
{ path: "/:path(.*)", component: ErrorView }
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
|
||||
21
src/views/ErrorNote.vue
Normal file
21
src/views/ErrorNote.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<div>
|
||||
error
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'ErrorView',
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
alert("error")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
17
src/views/ErrorView.vue
Normal file
17
src/views/ErrorView.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
error
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'ErrorView',
|
||||
components: {},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
created() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -80,7 +80,7 @@
|
||||
|
||||
#copyBtn {
|
||||
color: #ed4014;
|
||||
font-size:large;
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
.ivu-btn-text:focus {
|
||||
@@ -251,7 +251,8 @@
|
||||
|
||||
</Layout>
|
||||
|
||||
<Modal v-model="model.showShare" width="360" footer-hide class-name="qrmodal" :styles="{ borderRadius: 0 }">
|
||||
<Modal v-model="model.showShare" width="360" footer-hide class-name="qrmodal" :styles="{ borderRadius: 0 }"
|
||||
@on-cancel="closeShareModel">
|
||||
<p style="text-align: center;
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
@@ -261,7 +262,9 @@
|
||||
<Tag style="border-radius: 0px;" v-show="model.copyTip" color="#ed4014" text="">Url Copied.</Tag>
|
||||
</p>
|
||||
<p style="text-align: center;margin-top:20px;line-height:100%">
|
||||
<span style="margin-right:3px;" id="copyBtn"><Icon type="md-copy" /></span><span id="qrUrl">{{ noteForm.noteUrl }}</span>
|
||||
<span style="margin-right:3px;" id="copyBtn">
|
||||
<Icon type="md-copy" />
|
||||
</span><span id="qrUrl">{{ noteForm.noteUrl }}</span>
|
||||
</p>
|
||||
|
||||
<p style="text-align: center;margin-top:5px;">
|
||||
@@ -269,7 +272,7 @@
|
||||
</p>
|
||||
<p style="text-align: center;margin-top:10px;">
|
||||
<Button type="error" style="border-radius: 0px;font-size:19px;"
|
||||
@click="closeShareModel()">{{$t("button.close")}}</Button>
|
||||
@click="closeShareModel()">{{ $t("button.close") }}</Button>
|
||||
</p>
|
||||
</Modal>
|
||||
|
||||
@@ -487,7 +490,9 @@ export default {
|
||||
storage.session.setText(this.secret.storeKey + "_share", '1');
|
||||
},
|
||||
closeShareModel() {
|
||||
if (this.model.showShare) {
|
||||
this.model.showShare = false;
|
||||
}
|
||||
storage.session.setText(this.secret.storeKey + "_share", '0');
|
||||
},
|
||||
showDeleteModel() {
|
||||
|
||||
@@ -8,26 +8,38 @@ module.exports = defineConfig({
|
||||
productionSourceMap: false,
|
||||
configureWebpack: (config) => {
|
||||
|
||||
config.externals = {
|
||||
'vue': 'Vue',
|
||||
'vue-router': 'VueRouter',
|
||||
'axios': 'axios',
|
||||
//'vue-axios':'VueAxios',
|
||||
"crypto-js": "CryptoJS",
|
||||
'qrcode': 'QRCode',
|
||||
'pako': 'pako',
|
||||
"view-design": 'iview',
|
||||
"iview": 'ViewUI',
|
||||
"file-saver": 'saveAs',
|
||||
"clipboard": "ClipboardJS",
|
||||
"vue-i18n": "VueI18n",
|
||||
|
||||
};
|
||||
|
||||
// 为生产环境修改配置
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
config.plugins.push(
|
||||
new WebpackObfuscator({
|
||||
compact: true,//压缩代码
|
||||
controlFlowFlattening: true,//是否启用控制流扁平化(降低1.5倍的运行速度)
|
||||
controlFlowFlatteningThreshold: 1,//应用概率;在较大的代码库中,建议降低此值,因为大量的控制流转换可能会增加代码的大小并降低代码的速度。
|
||||
controlFlowFlattening: false,//是否启用控制流扁平化(降低1.5倍的运行速度)
|
||||
deadCodeInjection: true,//随机的死代码块(增加了混淆代码的大小)
|
||||
deadCodeInjectionThreshold: 1,//死代码块的影响概率
|
||||
debugProtection: true,//此选项几乎不可能使用开发者工具的控制台选项卡
|
||||
disableConsoleOutput: true,//通过用空函数替换它们来禁用console.log,console.info,console.error和console.warn。这使得调试器的使用更加困难。
|
||||
identifierNamesGenerator: 'hexadecimal',//标识符的混淆方式 hexadecimal(十六进制) mangled(短标识符)
|
||||
identifierNamesGenerator: 'mangled',//标识符的混淆方式 hexadecimal(十六进制) mangled(短标识符)
|
||||
log: false,
|
||||
renameGlobals: false,//是否启用全局变量和函数名称的混淆
|
||||
renameGlobals: true,//是否启用全局变量和函数名称的混淆
|
||||
rotateStringArray: true,//通过固定和随机(在代码混淆时生成)的位置移动数组。这使得将删除的字符串的顺序与其原始位置相匹配变得更加困难。如果原始源代码不小,建议使用此选项,因为辅助函数可以引起注意。
|
||||
selfDefending: true,//混淆后的代码,不能使用代码美化,同时需要配置 cpmpat:true;
|
||||
stringArray: true,//删除字符串文字并将它们放在一个特殊的数组中
|
||||
stringArrayThreshold: 1,
|
||||
transformObjectKeys: true,
|
||||
unicodeEscapeSequence: false//允许启用/禁用字符串转换为unicode转义序列。Unicode转义序列大大增加了代码大小,并且可以轻松地将字符串恢复为原始视图。建议仅对小型源代码启用此选项。
|
||||
// transformObjectKeys: true,
|
||||
unicodeEscapeSequence: true//允许启用/禁用字符串转换为unicode转义序列。Unicode转义序列大大增加了代码大小,并且可以轻松地将字符串恢复为原始视图。建议仅对小型源代码启用此选项。
|
||||
}, ['static/js/chunk-vendors.*.js']),
|
||||
|
||||
new CompressionPlugin({
|
||||
|
||||
Reference in New Issue
Block a user