diff --git a/packages/core/src/shell/scripts/setup-ca.js b/packages/core/src/shell/scripts/setup-ca.js index b283d6ca..4af30f42 100644 --- a/packages/core/src/shell/scripts/setup-ca.js +++ b/packages/core/src/shell/scripts/setup-ca.js @@ -8,9 +8,9 @@ const executor = { return true }, async linux (exec, { certPath }) { - const cmds = ['open "' + certPath + '"'] + const cmds = [`sudo cp ${certPath} /usr/local/share/ca-certificates`, 'sudo update-ca-certificates '] // eslint-disable-next-line no-unused-vars - const ret = await exec(cmds, { type: 'cmd' }) + const ret = await exec(cmds) return true }, async mac (exec, { certPath }) { diff --git a/packages/core/src/shell/shell.js b/packages/core/src/shell/shell.js index 31564424..80699c7d 100644 --- a/packages/core/src/shell/shell.js +++ b/packages/core/src/shell/shell.js @@ -138,6 +138,7 @@ function getSystemPlatform () { case 'linux': return 'linux' case 'win32': + return 'windows' case 'win64': return 'windows' case 'unknown os': diff --git a/packages/gui/public/setup-linux.png b/packages/gui/public/setup-linux.png new file mode 100755 index 00000000..64d49ed7 Binary files /dev/null and b/packages/gui/public/setup-linux.png differ diff --git a/packages/gui/src/background.js b/packages/gui/src/background.js index dec9ad6a..00b5d4fc 100644 --- a/packages/gui/src/background.js +++ b/packages/gui/src/background.js @@ -75,6 +75,21 @@ function setTray (app) { return appTray } +function isLinux () { + const platform = DevSidecar.api.shell.getSystemPlatform() + return platform === 'linux' +} + +function hideWin () { + if (win) { + if (isLinux()) { + win.minimize() + } else { + win.hide() + } + } +} + function createWindow () { // Create the browser window. @@ -113,7 +128,7 @@ function createWindow () { } if (startHideWindow) { - win.hide() + hideWin() } win.on('closed', async (e) => { @@ -124,7 +139,7 @@ function createWindow () { win.on('close', (e) => { if (!forceClose) { e.preventDefault() - win.hide() + hideWin() } }) } diff --git a/packages/gui/src/view/components/setup-ca.vue b/packages/gui/src/view/components/setup-ca.vue index 282f3845..a379fbf9 100644 --- a/packages/gui/src/view/components/setup-ca.vue +++ b/packages/gui/src/view/components/setup-ca.vue @@ -21,13 +21,16 @@ 2、然后按如下图步骤将随机生成的根证书设置为始终信任
3、可能需要重新启动应用和浏览器才能生效
+ - @@ -59,6 +62,8 @@ export default { setupImage () { if (this.systemPlatform === 'mac') { return '/setup-mac.png' + } else if (this.systemPlatform === 'linux') { + return '/setup-linux.png' } else { return '/setup.png' } @@ -75,6 +80,9 @@ export default { }, async doSetup () { this.$emit('setup') + if (this.systemPlatform === 'linux') { + this.$message.success('根证书已成功安装到系统证书库(注意:浏览器仍然需要手动安装)') + } } } }