✨ 先关闭更新
This commit is contained in:
parent
b0cc438d68
commit
f8aa118071
@ -52,7 +52,7 @@
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"artifactName": "${productName}-Mac-${arch}-${version}.${ext}",
|
// "artifactName": "${productName}-mac-${arch}-${version}.${ext}",
|
||||||
category: "public.app-category.utilities"
|
category: "public.app-category.utilities"
|
||||||
},
|
},
|
||||||
"win": {
|
"win": {
|
||||||
@ -86,17 +86,17 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"artifactName": "${productName}-Windows-${arch}-${version}.${ext}"
|
// "artifactName": "${productName}-win-${arch}-${version}.${ext}"
|
||||||
},
|
},
|
||||||
"nsis": {
|
"nsis": {
|
||||||
"artifactName": "${productName}-Windows-${arch}-${version}-Setup.${ext}",
|
// "artifactName": "${productName}-win-${arch}-${version}-Setup.${ext}",
|
||||||
"oneClick": false,
|
"oneClick": false,
|
||||||
"perMachine": false,
|
"perMachine": false,
|
||||||
"allowToChangeInstallationDirectory": true,
|
"allowToChangeInstallationDirectory": true,
|
||||||
"deleteAppDataOnUninstall": false
|
"deleteAppDataOnUninstall": false
|
||||||
},
|
},
|
||||||
"portable": {
|
"portable": {
|
||||||
"artifactName": "${productName}-Windows-${arch}-${version}.${ext}"
|
// "artifactName": "${productName}-win-${arch}-${version}.${ext}"
|
||||||
},
|
},
|
||||||
"linux": {
|
"linux": {
|
||||||
"target": [
|
"target": [
|
||||||
@ -131,7 +131,7 @@
|
|||||||
|
|
||||||
],
|
],
|
||||||
"category": "Network",
|
"category": "Network",
|
||||||
"artifactName": "${productName}-Linux-${arch}-${version}.${ext}"
|
// "artifactName": "${productName}-Linux-${arch}-${version}.${ext}"
|
||||||
},
|
},
|
||||||
"publish": [
|
"publish": [
|
||||||
{
|
{
|
||||||
|
@ -4,49 +4,78 @@ const log = require('electron-log');
|
|||||||
|
|
||||||
|
|
||||||
export const initUpdaterApi = () => {
|
export const initUpdaterApi = () => {
|
||||||
log.info("自动更新")
|
|
||||||
const server = 'https://hazel-jplav4y84-uiluck.vercel.app'
|
|
||||||
const url = `${server}/update/${process.platform}/${app.getVersion()}`
|
|
||||||
autoUpdater.setFeedURL({url})
|
|
||||||
setInterval(() => {
|
|
||||||
}, 60000)
|
|
||||||
autoUpdater.checkForUpdates()
|
|
||||||
|
|
||||||
// autoUpdater.on('checking-for-update', () => {
|
const server = 'https://hazel-git-master-uiluck.vercel.app'
|
||||||
// log.info("正在检查更新")
|
let packageName = null
|
||||||
// })
|
const platform = process.platform;
|
||||||
//
|
const arch = process.arch;
|
||||||
// autoUpdater.on('update-available', () => {
|
switch (platform) {
|
||||||
// log.info("有可用更新")
|
case "darwin":
|
||||||
// })
|
if (arch == "arm64") {
|
||||||
//
|
packageName = "dmg_arm64";
|
||||||
// autoUpdater.on('update-not-available', () => {
|
} else {
|
||||||
// log.info('没有可用的更新')
|
packageName = "dmg";
|
||||||
// })
|
}
|
||||||
//
|
break;
|
||||||
// autoUpdater.on('error', (err) => {
|
case "win32":
|
||||||
// log.error(`更新错误:${err.message}`)
|
packageName = "exe";
|
||||||
//
|
break;
|
||||||
// })
|
case "linux":
|
||||||
//
|
packageName = "AppImage";
|
||||||
|
if (arch == "arm64") {
|
||||||
|
packageName = "AppImage_arm64";
|
||||||
|
} else {
|
||||||
|
packageName = "AppImage";
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
const url = `${server}/update/${packageName}/${app.getVersion()}`
|
||||||
|
log.info(`开启自动更新 ${url}`);
|
||||||
|
autoUpdater.setFeedURL({url})
|
||||||
|
|
||||||
|
autoUpdater.on('checking-for-update', () => {
|
||||||
|
log.info("正在检查更新")
|
||||||
|
})
|
||||||
|
|
||||||
|
autoUpdater.on('update-available', () => {
|
||||||
|
log.info("有可用更新")
|
||||||
|
})
|
||||||
|
|
||||||
|
autoUpdater.on('update-not-available', () => {
|
||||||
|
log.info('没有可用的更新')
|
||||||
|
})
|
||||||
|
|
||||||
|
autoUpdater.on('error', (err) => {
|
||||||
|
log.error(`更新错误:${err.message}`)
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
// autoUpdater.on('download-progress', (progressObj) => {
|
// autoUpdater.on('download-progress', (progressObj) => {
|
||||||
// log.debug(`下载进度 ${progressObj.percent}%`)
|
// log.debug(`下载进度 ${progressObj.percent}%`)
|
||||||
// })
|
// })
|
||||||
//
|
|
||||||
// autoUpdater.on('update-downloaded', () => {
|
autoUpdater.on('update-downloaded', () => {
|
||||||
// console.log('update-downloaded')
|
console.log('update-downloaded')
|
||||||
//
|
|
||||||
// dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
// type: 'info',
|
type: 'info',
|
||||||
// title: '应用更新',
|
title: '应用更新',
|
||||||
// message: '发现新版本,是否更新?',
|
message: '发现新版本,是否更新?',
|
||||||
// buttons: ['是', '否']
|
buttons: ['是', '否']
|
||||||
// }).then((buttonIndex) => {
|
}).then((buttonIndex) => {
|
||||||
// if (buttonIndex.response == 0) { //选择是,则退出程序,安装新版本
|
if (buttonIndex.response == 0) { //选择是,则退出程序,安装新版本
|
||||||
// autoUpdater.quitAndInstall()
|
autoUpdater.quitAndInstall()
|
||||||
// app.quit()
|
app.quit()
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
// })
|
})
|
||||||
|
|
||||||
|
// setInterval(() => {
|
||||||
|
// log.initialize("定时检查更新")
|
||||||
|
// // autoUpdater.checkForUpdates();
|
||||||
|
// }, 60000)
|
||||||
|
autoUpdater.checkForUpdates();
|
||||||
|
log.info("手动检查更新一次")
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import {initProxyApi} from "../api/proxy";
|
|||||||
import {initFrpcApi, startFrpWorkerProcess, stopFrpcProcess} from "../api/frpc";
|
import {initFrpcApi, startFrpWorkerProcess, stopFrpcProcess} from "../api/frpc";
|
||||||
import {initLoggerApi} from "../api/logger";
|
import {initLoggerApi} from "../api/logger";
|
||||||
import {initFileApi} from "../api/file";
|
import {initFileApi} from "../api/file";
|
||||||
|
import {initUpdaterApi} from "../api/update";
|
||||||
import {getConfig} from "../storage/config";
|
import {getConfig} from "../storage/config";
|
||||||
import log from "electron-log";
|
import log from "electron-log";
|
||||||
// The built directory structure
|
// The built directory structure
|
||||||
|
10
package.json
10
package.json
@ -41,17 +41,18 @@
|
|||||||
"@vitejs/plugin-vue": "^4.3.3",
|
"@vitejs/plugin-vue": "^4.3.3",
|
||||||
"@vue/eslint-config-prettier": "^7.1.0",
|
"@vue/eslint-config-prettier": "^7.1.0",
|
||||||
"@vueuse/core": "^9.13.0",
|
"@vueuse/core": "^9.13.0",
|
||||||
"eslint": "^7.28.0",
|
|
||||||
"autoprefixer": "^10.4.15",
|
"autoprefixer": "^10.4.15",
|
||||||
"cssnano": "^6.0.1",
|
"cssnano": "^6.0.1",
|
||||||
"electron": "^26.6.10",
|
"electron": "^26.6.10",
|
||||||
"electron-builder": "^24.13.3",
|
"electron-builder": "^24.13.3",
|
||||||
"electron-builder-squirrel-windows": "^24.13.3",
|
"electron-builder-squirrel-windows": "^24.13.3",
|
||||||
"element-plus": "^2.4.2",
|
"element-plus": "^2.4.2",
|
||||||
|
"eslint": "^7.28.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
"nedb": "^1.8.0",
|
"nedb": "^1.8.0",
|
||||||
"node-cmd": "^5.0.0",
|
"node-cmd": "^5.0.0",
|
||||||
|
"postcss": "^8.4.31",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^2.8.8",
|
||||||
"sass": "^1.66.1",
|
"sass": "^1.66.1",
|
||||||
"tailwindcss": "^3.3.3",
|
"tailwindcss": "^3.3.3",
|
||||||
@ -63,16 +64,15 @@
|
|||||||
"vue": "^3.3.4",
|
"vue": "^3.3.4",
|
||||||
"vue-router": "^4.2.4",
|
"vue-router": "^4.2.4",
|
||||||
"vue-tsc": "^2.0.22",
|
"vue-tsc": "^2.0.22",
|
||||||
"vue-types": "^5.1.1",
|
"vue-types": "^5.1.1"
|
||||||
"postcss": "^8.4.31"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"adm-zip": "^0.5.14",
|
"adm-zip": "^0.5.14",
|
||||||
"animate.css": "^4.1.1",
|
"animate.css": "^4.1.1",
|
||||||
"electron-dl": "^3.5.1",
|
"electron-dl": "^3.5.1",
|
||||||
"electron-log": "^5.1.7",
|
"electron-log": "^5.1.7",
|
||||||
|
"isbinaryfile": "4.0.10",
|
||||||
"tar": "^6.2.0",
|
"tar": "^6.2.0",
|
||||||
"unused-filename": "^4.0.1",
|
"unused-filename": "^4.0.1"
|
||||||
"isbinaryfile": "4.0.10"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user