diff --git a/README.md b/README.md index 2c8626b..1d7b34b 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,12 @@ - 优化:前端美化 - 优化:个别Bug修复 +### 2023年9月1日更新:安全,安全,安全 +- 优化:所有保存接口、邮件发送接口、文件上传接口都限制次数,防止恶意调用 +- 优化:修复vuex中用户信息丢失错乱的Bug +- 优化:文件上传模块改造,每次上传之前获取上传密钥,每个密钥只能上传一个文件 +- 优化:个别Bug修复 + ### 首页 ![首页](首页.jpg) @@ -103,7 +109,7 @@ npm run build 一定要`Star` -## 欢迎进群 +## 欢迎进群(一定要Star) 1. 交流(摸鱼) 2. 安装部署:互相帮助,争取每个人都零基础拥有自己的个人网站 3. 博客答疑:每段代码都是我自己写的,爱学习的小伙伴可以在这里提问,互相学习,互相进步 diff --git a/package.json b/package.json index 20b1354..7673a22 100644 --- a/package.json +++ b/package.json @@ -17,11 +17,9 @@ "qs": "^6.10.3", "vue": "^2.6.11", "vue-baberrage": "^3.2.4", - "vue-ripple-directive": "^2.0.1", "vue-router": "^3.2.0", "vue-seamless-scroll": "^1.1.23", - "vuex": "^3.4.0", - "vuex-persistedstate": "^4.0.0" + "vuex": "^3.4.0" }, "devDependencies": { "@vue/cli-plugin-babel": "~4.5.0", diff --git a/src/assets/css/color.css b/src/assets/css/color.css index 0b6e63a..0f70c7d 100644 --- a/src/assets/css/color.css +++ b/src/assets/css/color.css @@ -23,8 +23,6 @@ /* 主题悬停背景 */ --gradualRed: linear-gradient(to right, #ff4b2b, #ff416c); - /* 水波纹 */ - --rippleColor: rgba(0, 0, 0, 0.5); /* 导航栏字体 */ --toolbarFont: #333333; /* 导航栏背景 */ diff --git a/src/components/admin/postEdit.vue b/src/components/admin/postEdit.vue index 59a7138..be25158 100644 --- a/src/components/admin/postEdit.vue +++ b/src/components/admin/postEdit.vue @@ -105,7 +105,6 @@ data() { return { id: this.$route.query.id, - token: "", article: { articleTitle: "", articleContent: "", @@ -164,7 +163,6 @@ created() { this.getSortAndLabel(); - this.getUpToken(); }, mounted() { @@ -172,45 +170,35 @@ }, methods: { - getUpToken() { - this.$http.get(this.$constant.baseURL + "/qiniu/getUpToken", {}, true) - .then((res) => { - if (!this.$common.isEmpty(res.data)) { - this.token = res.data; - } - }) - .catch((error) => { - this.$message({ - message: error.message, - type: "error" - }); - }); - }, imgAdd(pos, file) { - if (this.$common.isEmpty(this.token)) { - this.$message({ - message: "上传出错!", - type: "warning" - }); - return; - } - let suffix = ""; if (file.name.lastIndexOf('.') !== -1) { suffix = file.name.substring(file.name.lastIndexOf('.')); } - + let key = "articlePicture" + "/" + this.$store.state.currentAdmin.username.replace(/[^a-zA-Z]/g, '') + this.$store.state.currentAdmin.id + new Date().getTime() + Math.floor(Math.random() * 1000) + suffix; let fd = new FormData(); fd.append("file", file); - fd.append("token", this.token); - fd.append("key", "articlePicture" + "/" + this.$store.state.currentAdmin.username.replace(/[^a-zA-Z]/g, '') + this.$store.state.currentAdmin.id + new Date().getTime() + Math.floor(Math.random() * 1000) + suffix); + fd.append("key", key); - this.$http.uploadQiniu(this.$constant.qiniuUrl, fd) + this.$http.get(this.$constant.baseURL + "/qiniu/getUpToken", {key: key}, true) .then((res) => { - if (!this.$common.isEmpty(res.key)) { - let url = this.$constant.qiniuDownload + res.key; - this.$common.saveResource(this, "articlePicture", url, file.size, file.type, true); - this.$refs.md.$img2Url(pos, url); + if (!this.$common.isEmpty(res.data)) { + fd.append("token", res.data); + + this.$http.uploadQiniu(this.$constant.qiniuUrl, fd) + .then((res) => { + if (!this.$common.isEmpty(res.key)) { + let url = this.$constant.qiniuDownload + res.key; + this.$common.saveResource(this, "articlePicture", url, file.size, file.type, true); + this.$refs.md.$img2Url(pos, url); + } + }) + .catch((error) => { + this.$message({ + message: error.message, + type: "error" + }); + }); } }) .catch((error) => { diff --git a/src/components/admin/resourceList.vue b/src/components/admin/resourceList.vue index b1d5e3b..4d59382 100644 --- a/src/components/admin/resourceList.vue +++ b/src/components/admin/resourceList.vue @@ -3,6 +3,7 @@