feat: mac支持完成

pull/67/head
xiaojunnuo 2021-01-10 00:34:12 +08:00
parent 113eb3622d
commit fef6a56176
38 changed files with 63 additions and 37 deletions

View File

@ -1,10 +1,6 @@
const path = require('path')
const shell = require('../shell/shell')
function getUserBasePath () {
let userHome = process.env.USERPROFILE
if(shell.getSystemPlatform() === 'mac'){
userHome = process.env.HOME
}
const userHome = process.env.USERPROFILE || process.env.HOME || '/'
return path.resolve(userHome, './.dev-sidecar')
}
function getRootCaCertPath () {

View File

@ -2,6 +2,6 @@ module.exports = {
name: 'Git代理',
enabled: false,
setting: {
sslVerify: false
sslVerify: true // 是否关闭sslVerify
}
}

View File

@ -16,5 +16,6 @@ module.exports = {
setSystemProxy,
async exec (cmds, args) {
return shell.getSystemShell().exec(cmds, args)
}
},
getSystemPlatform: shell.getSystemPlatform
}

View File

@ -8,10 +8,16 @@ const executor = {
return true
},
async linux (exec, { certPath }) {
throw Error('暂未实现此功能')
const cmds = ['open "" "' + certPath + '"']
// eslint-disable-next-line no-unused-vars
const ret = await exec(cmds, { type: 'cmd' })
return true
},
async mac (exec, { certPath }) {
throw Error('暂未实现此功能')
const cmds = ['open "" "' + certPath + '"']
// eslint-disable-next-line no-unused-vars
const ret = await exec(cmds, { type: 'cmd' })
return true
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 584 B

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 941 B

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 KiB

After

Width:  |  Height:  |  Size: 353 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 584 B

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 941 B

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 KiB

After

Width:  |  Height:  |  Size: 353 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -0,0 +1,18 @@
<svg id="svg_canvas" viewBox="0 0 280 280" width="280" height="280" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g transform="scale(2)">
<g class="logo-entity" transform="translate(142,-1.5) scale(-1.30,1.30)">
<circle fill="#1B7FCD" cx="45.9" cy="55.2" r="17.5"
></circle>
<circle cx="23.5" cy="21.7" r="9.6" fill="#1B7FCD"></circle>
<circle cx="52.3" cy="23.9" r="6.9" fill="#1B7FCD"></circle>
<circle stroke="#1B7FCD" stroke-miterlimit="10" cx="32.5" cy="89.7" r="9.6" fill="#1B7FCD"></circle>
<circle fill="none" stroke="#1B7FCD" stroke-width="5" stroke-miterlimit="10" cx="84" cy="61.3" r="10.4"></circle>
<line fill="none" stroke="#1B7FCD" stroke-width="5" stroke-miterlimit="10" x1="37.9" y1="44.7" x2="26.2" y2="26.9"></line>
<line fill="none" stroke="#1B7FCD" stroke-width="5" stroke-miterlimit="10" x1="48.1" y1="44.7" x2="51.3" y2="27.7"></line>
<line fill="none" stroke="#1B7FCD" stroke-width="5" stroke-miterlimit="10" x1="40.1" y1="67.4" x2="34.9" y2="82.5"></line>
<line fill="none" stroke="#1B7FCD" stroke-width="5" stroke-miterlimit="10" x1="57" y1="55.5" x2="71.8" y2="58.6"></line>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 KiB

View File

@ -40,7 +40,7 @@ function setTray (app) {
}
]
// 设置系统托盘图标
const iconPath = path.join(__dirname, '../extra/icons/128x128.png')
const iconPath = path.join(__dirname, '../extra/icons/16x16.png')
const appTray = new Tray(iconPath)
// 图标的上下文菜单
@ -85,7 +85,7 @@ function createWindow () {
nodeIntegration: true// process.env.ELECTRON_NODE_INTEGRATION
},
// eslint-disable-next-line no-undef
icon: path.join(__static, 'icon.png')
icon: path.join(__dirname, '../build/icons/icon.png')
})
if (process.env.WEBPACK_DEV_SERVER_URL) {
@ -125,25 +125,12 @@ async function quit (app, callback) {
// eslint-disable-next-line no-unused-vars
function setDock () {
const { app, Menu } = require('electron')
const dockMenu = Menu.buildFromTemplate([
{
label: 'New Window',
click () { console.log('New Window') }
}, {
label: 'New Window with Settings',
submenu: [
{ label: 'Basic' },
{ label: 'Pro' }
]
},
{ label: '退出' }
])
app.whenReady().then(() => {
app.dock.setMenu(dockMenu)
})
const { app } = require('electron')
if (process.platform === 'darwin') {
app.whenReady().then(() => {
app.dock.setIcon(path.join(__dirname, '../build/icons/1024x1024.png'))
})
}
}
// -------------执行开始---------------
app.disableHardwareAcceleration() // 禁用gpu
@ -220,6 +207,8 @@ if (!isFirstInstance) {
})
}
setDock()
// Exit cleanly on request from parent process in development mode.
if (isDevelopment) {
if (process.platform === 'win32') {

View File

@ -33,6 +33,9 @@ const localApi = {
},
getConfigDir () {
return getDefaultConfigBasePath()
},
getSystemPlatform () {
return DevSidecar.api.shell.getSystemPlatform()
}
},
/**

View File

@ -18,7 +18,7 @@
请按如下步骤将<b>本地随机生成</b>的根证书添加到<b>信任的根证书颁发机构</b><br/>
证书是本地随机生成所以信任它是安全的
</div>
<img width="100%" src="/setup.png" />
<img width="100%" :src="setupImage" />
</a-drawer>
</template>
@ -40,9 +40,22 @@ export default {
},
data () {
return {
systemPlatform: 'win'
}
},
created () {
async created () {
const platform = await this.$api.info.getSystemPlatform()
console.log('11', platform)
this.systemPlatform = platform
},
computed: {
setupImage () {
if (this.systemPlatform === 'mac') {
return '/setup-mac.png'
} else {
return '/setup.png'
}
}
},
methods: {
afterVisibleChange (val) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -7,7 +7,7 @@ config.caKeyFileName = 'dev-sidecar.ca.key.pem'
config.defaultPort = 1181
config.caName = 'This certificate is generated locally'
config.caName = 'DevSidecar - This certificate is generated locally'
config.caBasePath = buildDefaultCABasePath()
@ -18,7 +18,7 @@ config.setDefaultCABasePath = function (path) {
config.caBasePath = path
}
function buildDefaultCABasePath () {
const userHome = process.env.USERPROFILE || process.env.HOME
const userHome = process.env.USERPROFILE || process.env.HOME || '/'
return path.resolve(userHome, './.dev-sidecar')
}

View File

@ -19,7 +19,7 @@ const pki = forge.pki
// }
utils.createCA = function (CN) {
const keys = pki.rsa.generateKeyPair(2046)
const keys = pki.rsa.generateKeyPair(2048)
const cert = pki.createCertificate()
cert.publicKey = keys.publicKey
cert.serialNumber = (new Date()).getTime() + ''
@ -74,7 +74,7 @@ utils.covertNodeCertToForgeCert = function (originCertificate) {
}
utils.createFakeCertificateByDomain = function (caKey, caCert, domain) {
const keys = pki.rsa.generateKeyPair(2046)
const keys = pki.rsa.generateKeyPair(2048)
const cert = pki.createCertificate()
cert.publicKey = keys.publicKey
@ -156,7 +156,7 @@ utils.createFakeCertificateByDomain = function (caKey, caCert, domain) {
utils.createFakeCertificateByCA = function (caKey, caCert, originCertificate) {
const certificate = utils.covertNodeCertToForgeCert(originCertificate)
const keys = pki.rsa.generateKeyPair(2046)
const keys = pki.rsa.generateKeyPair(2048)
const cert = pki.createCertificate()
cert.publicKey = keys.publicKey