diff --git a/package.json b/package.json index d2d1e53..f2adc35 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/public/index.html b/public/index.html index f005dec..d0b3e00 100644 --- a/public/index.html +++ b/public/index.html @@ -1,37 +1,36 @@ - - - - - - + + - - + + + + - - + + - + + - - - - + - - flagnote.com - - - - - - - - gtag("config", "G-FPS9PD2DFF"); - - - - +
+ + + + \ No newline at end of file diff --git a/src/plugins/iview.js b/src/plugins/iview.js index 288007a..050ba66 100644 --- a/src/plugins/iview.js +++ b/src/plugins/iview.js @@ -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' diff --git a/src/router/index.js b/src/router/index.js index d42429c..532a045 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -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({ diff --git a/src/views/ErrorNote.vue b/src/views/ErrorNote.vue new file mode 100644 index 0000000..b46882e --- /dev/null +++ b/src/views/ErrorNote.vue @@ -0,0 +1,21 @@ + + + + \ No newline at end of file diff --git a/src/views/ErrorView.vue b/src/views/ErrorView.vue new file mode 100644 index 0000000..362d248 --- /dev/null +++ b/src/views/ErrorView.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/views/ViewNote.vue b/src/views/ViewNote.vue index e82ce9d..5e5e9a4 100644 --- a/src/views/ViewNote.vue +++ b/src/views/ViewNote.vue @@ -80,7 +80,7 @@ #copyBtn { color: #ed4014; - font-size:large; + font-size: large; } .ivu-btn-text:focus { @@ -251,7 +251,8 @@ - +

Url Copied.

- {{ noteForm.noteUrl }} + + + {{ noteForm.noteUrl }}

@@ -269,7 +272,7 @@

+ @click="closeShareModel()">{{ $t("button.close") }}

@@ -487,7 +490,9 @@ export default { storage.session.setText(this.secret.storeKey + "_share", '1'); }, closeShareModel() { - this.model.showShare = false; + if (this.model.showShare) { + this.model.showShare = false; + } storage.session.setText(this.secret.storeKey + "_share", '0'); }, showDeleteModel() { diff --git a/vue.config.js b/vue.config.js index 47c4377..e5f00d1 100644 --- a/vue.config.js +++ b/vue.config.js @@ -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({