pull/88/head
xiaojunnuo 2021-08-18 00:00:05 -07:00
parent 598aa551e2
commit 53dbd1707b
5 changed files with 43 additions and 24 deletions

View File

@ -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

View File

@ -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 失败')

View File

@ -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) {

View File

@ -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 <div>
<div>请前往github或gitee项目release页面下载新版本手动安装</div>
<ol>
<li><a onClick={openGithubUrl}>Github release</a></li>
<li><a onClick={openGiteeUrl}>Gitee release</a></li>
</ol>
</div>
}
})
}
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) {

View File

@ -69,7 +69,7 @@ module.exports = {
linux: {
icon: 'build/mac/',
target: [
// 'deb',
'deb',
'AppImage'
]
},