mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-13 20:12:48 +00:00
perf: 优化客户端升级
This commit is contained in:
parent
2ca35e4458
commit
e574e728d4
1
electron/build.js
vendored
1
electron/build.js
vendored
@ -293,6 +293,7 @@ function startBuild(data) {
|
|||||||
console.log("Notarize: " + (notarize ? 'Yes' : 'No'));
|
console.log("Notarize: " + (notarize ? 'Yes' : 'No'));
|
||||||
// drawio
|
// drawio
|
||||||
cloneDrawio(systemInfo)
|
cloneDrawio(systemInfo)
|
||||||
|
// todo: download updater
|
||||||
}
|
}
|
||||||
// language
|
// language
|
||||||
fse.copySync(path.resolve(__dirname, "../public/language"), path.resolve(electronDir, "language"))
|
fse.copySync(path.resolve(__dirname, "../public/language"), path.resolve(electronDir, "language"))
|
||||||
|
|||||||
15
electron/electron.js
vendored
15
electron/electron.js
vendored
@ -187,7 +187,7 @@ function createMainWindow() {
|
|||||||
/**
|
/**
|
||||||
* 创建更新程序子进程
|
* 创建更新程序子进程
|
||||||
*/
|
*/
|
||||||
function createUpdaterWindow() {
|
function createUpdaterWindow(loadingTip) {
|
||||||
// 检查平台是否支持
|
// 检查平台是否支持
|
||||||
if (!['darwin', 'win32'].includes(process.platform)) {
|
if (!['darwin', 'win32'].includes(process.platform)) {
|
||||||
return;
|
return;
|
||||||
@ -197,9 +197,9 @@ function createUpdaterWindow() {
|
|||||||
// 构建updater应用路径
|
// 构建updater应用路径
|
||||||
let updaterPath;
|
let updaterPath;
|
||||||
if (isWin) {
|
if (isWin) {
|
||||||
updaterPath = path.join(__dirname, 'updater', 'updater.exe');
|
updaterPath = path.join(process.resourcesPath, '..', 'updater', 'updater.exe');
|
||||||
} else {
|
} else {
|
||||||
updaterPath = path.join(__dirname, 'updater', 'updater');
|
updaterPath = path.join(process.resourcesPath, '..', 'updater', 'updater');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查updater应用是否存在
|
// 检查updater应用是否存在
|
||||||
@ -209,7 +209,7 @@ function createUpdaterWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 创建锁文件
|
// 创建锁文件
|
||||||
fs.writeFileSync(updaterLockFile, '1');
|
fs.writeFileSync(updaterLockFile, loadingTip || '');
|
||||||
|
|
||||||
// 启动子进程,传入锁文件路径作为第一个参数
|
// 启动子进程,传入锁文件路径作为第一个参数
|
||||||
const child = spawn(updaterPath, [updaterLockFile], {
|
const child = spawn(updaterPath, [updaterLockFile], {
|
||||||
@ -1271,7 +1271,10 @@ ipcMain.on('mainWindowActive', (event) => {
|
|||||||
/**
|
/**
|
||||||
* 退出并安装更新
|
* 退出并安装更新
|
||||||
*/
|
*/
|
||||||
ipcMain.on('updateQuitAndInstall', (event) => {
|
ipcMain.on('updateQuitAndInstall', (event, args) => {
|
||||||
|
if (!utils.isJson(args)) {
|
||||||
|
args = {}
|
||||||
|
}
|
||||||
event.returnValue = "ok"
|
event.returnValue = "ok"
|
||||||
|
|
||||||
// 关闭所有子窗口
|
// 关闭所有子窗口
|
||||||
@ -1281,7 +1284,7 @@ ipcMain.on('updateQuitAndInstall', (event) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 启动更新子窗口
|
// 启动更新子窗口
|
||||||
createUpdaterWindow()
|
createUpdaterWindow(args.loadingTip)
|
||||||
|
|
||||||
// 退出并安装更新
|
// 退出并安装更新
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
|
|||||||
@ -77,6 +77,13 @@
|
|||||||
"electron.js",
|
"electron.js",
|
||||||
"utils.js"
|
"utils.js"
|
||||||
],
|
],
|
||||||
|
"extraFiles": [
|
||||||
|
{
|
||||||
|
"from": "updater",
|
||||||
|
"to": "updater",
|
||||||
|
"filter": ["**/*"]
|
||||||
|
}
|
||||||
|
],
|
||||||
"npmRebuild": false,
|
"npmRebuild": false,
|
||||||
"publish": {
|
"publish": {
|
||||||
"provider": "generic"
|
"provider": "generic"
|
||||||
|
|||||||
@ -218,7 +218,9 @@ export default {
|
|||||||
updateQuitAndInstall() {
|
updateQuitAndInstall() {
|
||||||
this.updateIng = true
|
this.updateIng = true
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$Electron.sendMessage('updateQuitAndInstall')
|
this.$Electron.sendMessage('updateQuitAndInstall', {
|
||||||
|
loadingTip: this.$L('正在安装更新,请稍候...')
|
||||||
|
})
|
||||||
}, 301)
|
}, 301)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user