diff --git a/package.json b/package.json index 4d2d208..33dc46a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "go2index-theme-acrou", - "version": "1.1.0", + "version": "2.0.0", + "g2index": "1.0.0", "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", diff --git a/public/index.html b/public/index.html index 1b2ccea..9612800 100644 --- a/public/index.html +++ b/public/index.html @@ -14,7 +14,7 @@ <%= htmlWebpackPlugin.options.title %> diff --git a/src/libs/util.cookies.js b/src/libs/util.cookies.js index bb66f6d..bc14873 100644 --- a/src/libs/util.cookies.js +++ b/src/libs/util.cookies.js @@ -13,7 +13,7 @@ cookies.set = function (name = 'default', value = '', cookieSetting = {}) { expires: 1 } Object.assign(currentCookieSetting, cookieSetting) - Cookies.set(`go2index-${process.env.APP_VERSION}-${name}`, value, currentCookieSetting) + Cookies.set(`go2index-${process.env.VUE_APP_VERSION}-${name}`, value, currentCookieSetting) } /** @@ -21,7 +21,7 @@ cookies.set = function (name = 'default', value = '', cookieSetting = {}) { * @param {String} name cookie name */ cookies.get = function (name = 'default') { - return Cookies.get(`go2index-${process.env.APP_VERSION}-${name}`) + return Cookies.get(`go2index-${process.env.VUE_APP_VERSION}-${name}`) } /** @@ -36,7 +36,7 @@ cookies.getAll = function () { * @param {String} name cookie name */ cookies.remove = function (name = 'default') { - return Cookies.remove(`go2index-${process.env.APP_VERSION}-${name}`) + return Cookies.remove(`go2index-${process.env.VUE_APP_VERSION}-${name}`) } export default cookies diff --git a/src/libs/util.db.js b/src/libs/util.db.js index 74b649e..955babb 100644 --- a/src/libs/util.db.js +++ b/src/libs/util.db.js @@ -3,7 +3,7 @@ import LocalStorage from 'lowdb/adapters/LocalStorage' import util from '@/libs/util' import { cloneDeep } from 'lodash' -const adapter = new LocalStorage(`go2index-${process.env.APP_VERSION}`) +const adapter = new LocalStorage(`go2index-${process.env.VUE_APP_VERSION}`) const db = low(adapter) db diff --git a/src/locales/en.json b/src/locales/en.json index 00afa6a..4d5f483 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -49,5 +49,8 @@ "text": "Clean cache", "success": "Cache cleanup successful" } + }, + "checkVersion": { + "tips": "New version detected, Go to GitHub" } } diff --git a/src/locales/zh-chs.json b/src/locales/zh-chs.json index 215ddf3..ae374aa 100644 --- a/src/locales/zh-chs.json +++ b/src/locales/zh-chs.json @@ -49,5 +49,8 @@ "text": "清理缓存", "success": "缓存清理成功" } + }, + "checkVersion": { + "tips": "检测到有新版本,前往GitHub" } } diff --git a/src/locales/zh-cht.json b/src/locales/zh-cht.json index a26e035..e892f2d 100644 --- a/src/locales/zh-cht.json +++ b/src/locales/zh-cht.json @@ -49,5 +49,8 @@ "text": "清理緩存", "success": "緩存清理成功" } + }, + "checkVersion": { + "tips": "檢測到有新版本,前往GitHub" } } diff --git a/src/plugin/checkVersion.js b/src/plugin/checkVersion.js new file mode 100644 index 0000000..09fc030 --- /dev/null +++ b/src/plugin/checkVersion.js @@ -0,0 +1,16 @@ +import { Notification } from 'element-ui'; + +export default function check() { + let g2index_verison = window.gdconfig.g2index_verison; + if (!g2index_verison || process.env.G2INDEX_VERSION !== g2index_verison) { + Notification.success({ + title: "通知", + dangerouslyUseHTMLString: true, + message: ` + 检测到有新版本,前往GitHub
+ New version detected, Go to GitHub + `, + duration: 0 + }); + } +} diff --git a/src/router/routes.js b/src/router/routes.js index e3d3889..a63c290 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -7,7 +7,7 @@ const meta = { } const frameIn = [{ - path: "/:id::cmd(text)/:path", + path: "/:id(\\d)::cmd(text)/:path", component: _import("page/GoText"), meta: { ...meta, @@ -15,7 +15,7 @@ const frameIn = [{ } }, { - path: "/:id::cmd(pdf)/:path", + path: "/:id(\\d)::cmd(pdf)/:path", component: _import("page/GoPdf"), meta: { ...meta, @@ -23,7 +23,7 @@ const frameIn = [{ } }, { - path: "/:id::cmd(video)/:path", + path: "/:id(\\d)::cmd(video)/:path", component: _import("page/GoVideo"), meta: { ...meta, @@ -31,7 +31,7 @@ const frameIn = [{ } }, { - path: "/:id::cmd(image)/:path", + path: "/:id(\\d)::cmd(image)/:path", component: _import("page/GoImg"), meta: { ...meta, @@ -39,7 +39,7 @@ const frameIn = [{ } }, { - path: "/:id::cmd(search)(/?q=)*", + path: "/:id(\\d)::cmd(search)(/?q=)*", component: _import("page/GoList"), meta: { ...meta, @@ -47,7 +47,7 @@ const frameIn = [{ } }, { - path: "/:id:/:path*", + path: "/:id(\\d):/:path*", component: _import("page/GoList"), meta: { ...meta, diff --git a/src/views/page/GoList.vue b/src/views/page/GoList.vue index 68e8bac..2f77b37 100644 --- a/src/views/page/GoList.vue +++ b/src/views/page/GoList.vue @@ -8,77 +8,13 @@ infinite-scroll-disabled="busy" infinite-scroll-distance="10" > - - - - - - - - - - - - - - -
- {{ column.name }} - - - - -
- - {{ file.name }} - {{ - file.description - }} - - {{ file.modifiedTime }} - {{ file.size }} - - - - - - - - - -
+