Browse Source

inux ubuntu

pull/88/head
xiaojunnuo 3 years ago
parent
commit
f5a4af9a87
  1. 4
      packages/core/src/shell/scripts/setup-ca.js
  2. 1
      packages/core/src/shell/shell.js
  3. BIN
      packages/gui/public/setup-linux.png
  4. 19
      packages/gui/src/background.js
  5. 10
      packages/gui/src/view/components/setup-ca.vue

4
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 }) {

1
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':

BIN
packages/gui/public/setup-linux.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

19
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()
}
})
}

10
packages/gui/src/view/components/setup-ca.vue

@ -21,13 +21,16 @@
2然后按如下图步骤将随机生成的根证书设置为始终信任<br/>
3可能需要重新启动应用和浏览器才能生效<br/>
</template>
<template v-else-if="this.systemPlatform === 'linux'">
1点击右上角点此去安装按钮,将自动安装到系统证书库中<br/>
2火狐chrome等浏览器不走系统证书需要手动安装(下图以chrome为例安装根证书)<br/>
</template>
<template v-else>
1点击右上角点此去安装按钮打开证书<br/>
2然后按如下图步骤将根证书添加到<b>信任的根证书颁发机构</b><br/>
</template>
</div>
<img width="100%" :src="setupImage" />
</a-drawer>
</template>
@ -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('根证书已成功安装到系统证书库(注意:浏览器仍然需要手动安装)')
}
}
}
}

Loading…
Cancel
Save