diff --git a/packages/core/src/shell/scripts/set-system-proxy/index.js b/packages/core/src/shell/scripts/set-system-proxy/index.js index d593877..8832466 100644 --- a/packages/core/src/shell/scripts/set-system-proxy/index.js +++ b/packages/core/src/shell/scripts/set-system-proxy/index.js @@ -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 <> ~/.zshrc + // export http_proxy="http://${ip}:${port}" + // export https_proxy="http://${ip}:${port}" + // ENDOF + // source ~/.zshrc + // ` + // await exec(setEnv) } } } diff --git a/packages/gui/.env b/packages/gui/.env index ba94875..55c4995 100644 --- a/packages/gui/.env +++ b/packages/gui/.env @@ -1,2 +1,2 @@ VUE_APP_PUBLISH_URL=http://dev-sidecar.docmirror.cn/update/ -VUE_APP_PUBLISH_PROVIDER=generic \ No newline at end of file +VUE_APP_PUBLISH_PROVIDER=generic diff --git a/packages/gui/package.json b/packages/gui/package.json index 7497572..f32d630 100644 --- a/packages/gui/package.json +++ b/packages/gui/package.json @@ -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", diff --git a/packages/gui/src/background.js b/packages/gui/src/background.js index 9283a04..cd066d0 100644 --- a/packages/gui/src/background.js +++ b/packages/gui/src/background.js @@ -262,6 +262,6 @@ if (isDevelopment) { // 系统关机和重启时的操作 process.on('exit', function () { - log.info('系统关机,退出app') + log.info('进程结束,退出app') quit(app) }) diff --git a/packages/gui/src/bridge/update/backend.js b/packages/gui/src/bridge/update/backend.js index 219fe6f..55e8106 100644 --- a/packages/gui/src/bridge/update/backend.js +++ b/packages/gui/src/bridge/update/backend.js @@ -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 { diff --git a/packages/gui/src/bridge/update/front.js b/packages/gui/src/bridge/update/front.js index e546937..ad0254e 100644 --- a/packages/gui/src/bridge/update/front.js +++ b/packages/gui/src/bridge/update/front.js @@ -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') } }) } diff --git a/packages/gui/src/utils/util.apppath.js b/packages/gui/src/utils/util.apppath.js index a6832c9..10ac6b9 100644 --- a/packages/gui/src/utils/util.apppath.js +++ b/packages/gui/src/utils/util.apppath.js @@ -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, '../') } } diff --git a/packages/gui/vue.config.js b/packages/gui/vue.config.js index 88a3c65..9ce19fb 100644 --- a/packages/gui/vue.config.js +++ b/packages/gui/vue.config.js @@ -61,7 +61,10 @@ module.exports = { allowToChangeInstallationDirectory: true }, mac: { - icon: './build/mac/icon.icns' + icon: './build/mac/icon.icns', + target: [ + 'dmg' + ] }, win: { requestedExecutionLevel: 'requireAdministrator'