diff --git a/README.md b/README.md index 33aab8b4..a5f4bb4d 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ | 平台 | Windows | Mac OS | Linux | | :------- | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | -| 下载链接 | [![Windows 版本下载链接 v1.9.6](https://img.shields.io/badge/v1.9.6-Windows-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.6/whu-library-seat-1.9.6.exe) | [![Mac OS 版本下载链接 v1.9.6](https://img.shields.io/badge/v1.9.6-Mac%20OS-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.6/whu-library-seat-1.9.6.dmg) | [![Linux 版本下载链接 v1.9.6](https://img.shields.io/badge/v1.9.6-Linux-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.6/whu-library-seat-1.9.6-x86_64.AppImage) | +| 下载链接 | [![Windows 版本下载链接 v1.9.7](https://img.shields.io/badge/v1.9.7-Windows-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.7/whu-library-seat-1.9.7.exe) | [![Mac OS 版本下载链接 v1.9.7](https://img.shields.io/badge/v1.9.7-Mac%20OS-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.7/whu-library-seat-1.9.7.dmg) | [![Linux 版本下载链接 v1.9.7](https://img.shields.io/badge/v1.9.7-Linux-limegreen.svg)](https://github.com/CS-Tao/whu-library-seat/releases/download/v1.9.7/whu-library-seat-1.9.7-x86_64.AppImage) | ### 申请软件使用权 diff --git a/package.json b/package.json index dd4c1b7f..e9d88a78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whu-library-seat", - "version": "1.9.6", + "version": "1.9.7", "author": "CS-Tao ", "description": "图书馆助手", "license": null, @@ -12,6 +12,7 @@ "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js", "build:docs": "vuepress build docs", "dev": "node .electron-vue/dev-runner.js", + "dev:publish": "TEST_PUBLISH=true yarn dev", "dev:docs": "vuepress dev docs", "e2e": "npm run pack && mocha test/e2e", "lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src test", diff --git a/src/main/dev-app-update.yml b/src/main/dev-app-update.yml new file mode 100644 index 00000000..b82d78c4 --- /dev/null +++ b/src/main/dev-app-update.yml @@ -0,0 +1,3 @@ +owner: cs-tao +repo: whu-library-seat +provider: github diff --git a/src/main/index.js b/src/main/index.js index 3aad947b..17c8748b 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -6,11 +6,13 @@ import path from 'path' import Store from 'electron-store' import notifier from 'node-notifier' +const isDev = process.env.NODE_ENV !== 'production' + /** * Set `__static` path to static files in production * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html */ -if (process.env.NODE_ENV !== 'development') { +if (!isDev) { global.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\') } @@ -19,7 +21,7 @@ const store = new Store({ }) let mainWindow -const winURL = process.env.NODE_ENV === 'development' +const winURL = isDev ? `http://localhost:9080` : `file://${__dirname}/index.html` @@ -309,7 +311,7 @@ ipcMain.on('show-window-notify', (event, title, message) => { title: title, subTitle: title, message: message, - icon: process.env.NODE_ENV !== 'production' + icon: isDev ? path.join(__static, 'toast.png') : (process.platform === 'darwin' ? './Contents/Resources/static/toast.png' @@ -331,11 +333,15 @@ autoUpdater.autoDownload = false autoUpdater.autoInstallOnAppQuit = true autoUpdater.allowDowngrade = true +if (isDev) { + autoUpdater.updateConfigPath = path.join(__dirname, 'dev-app-update.yml') +} + ipcMain.on('check-updates', (event, arg) => { // 检查更新 - if (process.env.NODE_ENV === 'production') { + if (!isDev || process.env.TEST_PUBLISH) { autoUpdater.checkForUpdates().then((info) => { - mainWindow.webContents.send('update-available', info) + mainWindow.webContents.send('update-available', {...info, showOpenLink: process.platform === 'darwin'}) }).catch((error) => { mainWindow.webContents.send('check-update-error', error) }) @@ -344,12 +350,12 @@ ipcMain.on('check-updates', (event, arg) => { ipcMain.on('download-update', (event, arg) => { // 下载更新 - if (process.env.NODE_ENV === 'production') autoUpdater.downloadUpdate() + if (!isDev || process.env.TEST_PUBLISH) autoUpdater.downloadUpdate() }) ipcMain.on('quit-and-install', (event, arg) => { // 退出安装 - if (process.env.NODE_ENV === 'production') { + if (!isDev || process.env.TEST_PUBLISH) { if (tray) { tray.destroy() } diff --git a/src/renderer/components/Footer/index.vue b/src/renderer/components/Footer/index.vue index 3f54e9f0..36be1ccc 100644 --- a/src/renderer/components/Footer/index.vue +++ b/src/renderer/components/Footer/index.vue @@ -2,8 +2,8 @@