refactor: 1
parent
0b2a5a67d1
commit
89d40ef0f4
|
@ -152,10 +152,25 @@ const executor = {
|
|||
if (params == null) {
|
||||
await exec(`networksetup -setwebproxystate '${wifiAdaptor}' off`)
|
||||
await exec(`networksetup -setsecurewebproxystate '${wifiAdaptor}' off`)
|
||||
|
||||
// const removeEnv = `
|
||||
// sed -ie '/export http_proxy/d' ~/.zshrc
|
||||
// sed -ie '/export https_proxy/d' ~/.zshrc
|
||||
// source ~/.zshrc
|
||||
// `
|
||||
// await exec(removeEnv)
|
||||
} else {
|
||||
const { ip, port } = params
|
||||
await exec(`networksetup -setwebproxy '${wifiAdaptor}' ${ip} ${port}`)
|
||||
await exec(`networksetup -setsecurewebproxy '${wifiAdaptor}' ${ip} ${port}`)
|
||||
|
||||
// const setEnv = `cat <<ENDOF >> ~/.zshrc
|
||||
// export http_proxy="http://${ip}:${port}"
|
||||
// export https_proxy="http://${ip}:${port}"
|
||||
// ENDOF
|
||||
// source ~/.zshrc
|
||||
// `
|
||||
// await exec(setEnv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@docmirror/dev-sidecar-gui",
|
||||
"version": "1.6.0",
|
||||
"version": "1.5.0",
|
||||
"private": false,
|
||||
"license": "MPL-2.0",
|
||||
"main": "background.js",
|
||||
|
@ -24,6 +24,7 @@
|
|||
"@docmirror/mitmproxy": "^1.6.0",
|
||||
"adm-zip": "^0.5.5",
|
||||
"ant-design-vue": "^1.6.5",
|
||||
"axios": "^0.21.1",
|
||||
"compressing": "^1.5.1",
|
||||
"core-js": "^3.6.5",
|
||||
"electron-baidu-tongji": "^1.0.5",
|
||||
|
|
|
@ -262,6 +262,6 @@ if (isDevelopment) {
|
|||
|
||||
// 系统关机和重启时的操作
|
||||
process.on('exit', function () {
|
||||
log.info('系统关机,退出app')
|
||||
log.info('进程结束,退出app')
|
||||
quit(app)
|
||||
})
|
||||
|
|
|
@ -13,6 +13,7 @@ const isMac = process.platform === 'darwin'
|
|||
const isLinux = process.platform === 'linux'
|
||||
|
||||
function downloadFile (uri, filePath, onProgress, onSuccess, onError) {
|
||||
logger.info('download url', uri)
|
||||
progress(request(uri), {
|
||||
// throttle: 2000, // Throttle the progress event to 2000ms, defaults to 1000ms
|
||||
// delay: 1000, // Only start to emit after 1000ms delay, defaults to 0ms
|
||||
|
@ -55,7 +56,7 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
|||
// url: publishUrl
|
||||
// })
|
||||
if (isMac) {
|
||||
// autoUpdater.updateConfigPath = path.join(__dirname, 'mac/DevSidecar.app/Contents/Resources/app-update.yml')
|
||||
autoUpdater.updateConfigPath = path.join(__dirname, 'mac/dev-sidecar.app/Contents/Resources/app-update.yml')
|
||||
} else if (isLinux) {
|
||||
autoUpdater.updateConfigPath = path.join(__dirname, 'linux-unpacked/resources/app-update.yml')
|
||||
} else {
|
||||
|
|
|
@ -57,8 +57,8 @@ function install (app, api) {
|
|||
function goManualUpdate (value) {
|
||||
app.$confirm({
|
||||
title: '暂不支持自动升级',
|
||||
cancelText: 'cancel',
|
||||
okText: 'ok',
|
||||
cancelText: '取消',
|
||||
okText: '确定',
|
||||
content: h => {
|
||||
function openGithubUrl () {
|
||||
api.ipc.openExternal('https://github.com/docmirror/dev-sidecar/releases')
|
||||
|
@ -145,11 +145,9 @@ function install (app, api) {
|
|||
}
|
||||
},
|
||||
onOk () {
|
||||
console.log('OK')
|
||||
api.update.doUpdateNow()
|
||||
},
|
||||
onCancel () {
|
||||
console.log('Cancel')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,7 +1,26 @@
|
|||
import path from 'path'
|
||||
import os from 'os'
|
||||
function getSystemPlatform () {
|
||||
switch (os.platform()) {
|
||||
case 'darwin':
|
||||
return 'mac'
|
||||
case 'linux':
|
||||
return 'linux'
|
||||
case 'win32':
|
||||
return 'windows'
|
||||
case 'win64':
|
||||
return 'windows'
|
||||
case 'unknown os':
|
||||
default:
|
||||
throw new Error(`UNKNOWN OS TYPE ${os.platform()}`)
|
||||
}
|
||||
}
|
||||
export default {
|
||||
getAppRootPath (app) {
|
||||
const exePath = app.getPath('exe')
|
||||
if (getSystemPlatform() === 'mac') {
|
||||
return path.join(exePath, '../../')
|
||||
}
|
||||
return path.join(exePath, '../')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,10 @@ module.exports = {
|
|||
allowToChangeInstallationDirectory: true
|
||||
},
|
||||
mac: {
|
||||
icon: './build/mac/icon.icns'
|
||||
icon: './build/mac/icon.icns',
|
||||
target: [
|
||||
'dmg'
|
||||
]
|
||||
},
|
||||
win: {
|
||||
requestedExecutionLevel: 'requireAdministrator'
|
||||
|
|
Loading…
Reference in New Issue