From 53dbd1707b109b20c1fe7209f53e975fd3f8e364 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Wed, 18 Aug 2021 00:00:05 -0700 Subject: [PATCH] 1 --- packages/gui/.env.pre | 2 +- packages/gui/pkg/after-all-artifact-build.js | 9 ++-- packages/gui/src/bridge/update/backend.js | 3 +- packages/gui/src/bridge/update/front.js | 51 +++++++++++++------- packages/gui/vue.config.js | 2 +- 5 files changed, 43 insertions(+), 24 deletions(-) diff --git a/packages/gui/.env.pre b/packages/gui/.env.pre index ba94875b..54fb8f0a 100644 --- a/packages/gui/.env.pre +++ b/packages/gui/.env.pre @@ -1,2 +1,2 @@ -VUE_APP_PUBLISH_URL=http://dev-sidecar.docmirror.cn/update/ +VUE_APP_PUBLISH_URL=http://dev-sidecar.docmirror.cn/update/preview/ VUE_APP_PUBLISH_PROVIDER=generic \ No newline at end of file diff --git a/packages/gui/pkg/after-all-artifact-build.js b/packages/gui/pkg/after-all-artifact-build.js index 340eb16f..f52bab4f 100644 --- a/packages/gui/pkg/after-all-artifact-build.js +++ b/packages/gui/pkg/after-all-artifact-build.js @@ -9,10 +9,11 @@ function appendIntro (context, systemType, latest) { const partUpdateUrl = context.configuration.publish.url + partUpdateFile const latestFilePath = path.join(context.outDir, latest) - fs.appendFile(latestFilePath, `partPackage: ${partUpdateUrl}\n - releaseNotes: \n - - 升级日志\n - - https://download.fastgit.org/docmirror/dev-sidecar/releases/download/v${version}/DevSidecar-${version}.exe\n`, + fs.appendFile(latestFilePath, `partPackage: ${partUpdateUrl} +releaseNotes: + - 升级日志 + - https://download.fastgit.org/docmirror/dev-sidecar/releases/download/v${version}/DevSidecar-${version}.exe +`, (err) => { if (err) { console.log('修改latest 失败') diff --git a/packages/gui/src/bridge/update/backend.js b/packages/gui/src/bridge/update/backend.js index 4a8ccff1..aadc8e7f 100644 --- a/packages/gui/src/bridge/update/backend.js +++ b/packages/gui/src/bridge/update/backend.js @@ -50,8 +50,9 @@ function updateHandle (app, api, win, beforeQuit, quit, log) { // 本地开发环境,改变app-update.yml地址 if (process.env.NODE_ENV === 'development' && !isMac) { const publishUrl = process.env.VUE_APP_PUBLISH_URL + const publishProvider = process.env.VUE_APP_PUBLISH_PROVIDER autoUpdater.setFeedURL({ - provider: 'generic', + provider: publishProvider, url: publishUrl }) if (isMac) { diff --git a/packages/gui/src/bridge/update/front.js b/packages/gui/src/bridge/update/front.js index 051759ba..304adbf8 100644 --- a/packages/gui/src/bridge/update/front.js +++ b/packages/gui/src/bridge/update/front.js @@ -1,4 +1,3 @@ - function install (app, api) { const updateParams = app.$global.update = { fromUser: false, autoDownload: false, progress: 0, downloading: false, newVersion: false, isFullUpdate: true } api.ipc.on('update', (event, message) => { @@ -55,26 +54,44 @@ function install (app, api) { updateParams.progress = value } - function downloadNewVersion (value) { + function goManualUpdate (value) { + app.$confirm({ + title: '暂不支持自动升级', + cancelText: 'cancel', + okText: 'ok', + content: h => { + function openGithubUrl () { + api.ipc.openExternal('https://github.com/docmirror/dev-sidecar/releases') + } + function openGiteeUrl () { + api.ipc.openExternal('https://gitee.com/docmirror/dev-sidecar/releases') + } + return
+
请前往github或gitee项目release页面下载新版本手动安装
+
    +
  1. Github release
  2. +
  3. Gitee release
  4. +
+
+ } + }) + } + async function downloadNewVersion (value) { + const platform = await api.shell.getSystemPlatform() + console.log('download new version platform', platform) + if (platform === 'linux') { + goManualUpdate(app, value) + return + } if (value.partPackage) { // 有增量更新 api.update.downloadPart(value) } else { - api.shell.getSystemPlatform().then((platform) => { - if (platform === 'mac' || platform === 'linux') { - app.$notification.open({ - duration: 15, - message: '暂不支持自动升级', - description: - '请前往github或gitee项目release页面下载新版本手动安装', - onClick: () => { - - } - }) - return - } - api.update.downloadUpdate() - }) + if (platform === 'mac') { + goManualUpdate(value) + return + } + api.update.downloadUpdate() } } function foundNewVersion (value) { diff --git a/packages/gui/vue.config.js b/packages/gui/vue.config.js index 7f3b73aa..a5fa3ba2 100644 --- a/packages/gui/vue.config.js +++ b/packages/gui/vue.config.js @@ -69,7 +69,7 @@ module.exports = { linux: { icon: 'build/mac/', target: [ - // 'deb', + 'deb', 'AppImage' ] },