feat: mac支持完成
|
@ -1,10 +1,6 @@
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const shell = require('../shell/shell')
|
|
||||||
function getUserBasePath () {
|
function getUserBasePath () {
|
||||||
let userHome = process.env.USERPROFILE
|
const userHome = process.env.USERPROFILE || process.env.HOME || '/'
|
||||||
if(shell.getSystemPlatform() === 'mac'){
|
|
||||||
userHome = process.env.HOME
|
|
||||||
}
|
|
||||||
return path.resolve(userHome, './.dev-sidecar')
|
return path.resolve(userHome, './.dev-sidecar')
|
||||||
}
|
}
|
||||||
function getRootCaCertPath () {
|
function getRootCaCertPath () {
|
||||||
|
|
|
@ -2,6 +2,6 @@ module.exports = {
|
||||||
name: 'Git代理',
|
name: 'Git代理',
|
||||||
enabled: false,
|
enabled: false,
|
||||||
setting: {
|
setting: {
|
||||||
sslVerify: false
|
sslVerify: true // 是否关闭sslVerify
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,5 +16,6 @@ module.exports = {
|
||||||
setSystemProxy,
|
setSystemProxy,
|
||||||
async exec (cmds, args) {
|
async exec (cmds, args) {
|
||||||
return shell.getSystemShell().exec(cmds, args)
|
return shell.getSystemShell().exec(cmds, args)
|
||||||
}
|
},
|
||||||
|
getSystemPlatform: shell.getSystemPlatform
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,16 @@ const executor = {
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
async linux (exec, { certPath }) {
|
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 }) {
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 584 B After Width: | Height: | Size: 552 B |
Before Width: | Height: | Size: 941 B After Width: | Height: | Size: 864 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 353 KiB After Width: | Height: | Size: 353 KiB |
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 584 B After Width: | Height: | Size: 552 B |
Before Width: | Height: | Size: 941 B After Width: | Height: | Size: 864 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 353 KiB After Width: | Height: | Size: 353 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 40 KiB |
|
@ -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 |
After Width: | Height: | Size: 521 KiB |
|
@ -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)
|
const appTray = new Tray(iconPath)
|
||||||
|
|
||||||
// 图标的上下文菜单
|
// 图标的上下文菜单
|
||||||
|
@ -85,7 +85,7 @@ function createWindow () {
|
||||||
nodeIntegration: true// process.env.ELECTRON_NODE_INTEGRATION
|
nodeIntegration: true// process.env.ELECTRON_NODE_INTEGRATION
|
||||||
},
|
},
|
||||||
// eslint-disable-next-line no-undef
|
// 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) {
|
if (process.env.WEBPACK_DEV_SERVER_URL) {
|
||||||
|
@ -125,25 +125,12 @@ async function quit (app, callback) {
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
function setDock () {
|
function setDock () {
|
||||||
const { app, Menu } = require('electron')
|
const { app } = require('electron')
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
const dockMenu = Menu.buildFromTemplate([
|
app.whenReady().then(() => {
|
||||||
{
|
app.dock.setIcon(path.join(__dirname, '../build/icons/1024x1024.png'))
|
||||||
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)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
// -------------执行开始---------------
|
// -------------执行开始---------------
|
||||||
app.disableHardwareAcceleration() // 禁用gpu
|
app.disableHardwareAcceleration() // 禁用gpu
|
||||||
|
@ -220,6 +207,8 @@ if (!isFirstInstance) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setDock()
|
||||||
|
|
||||||
// Exit cleanly on request from parent process in development mode.
|
// Exit cleanly on request from parent process in development mode.
|
||||||
if (isDevelopment) {
|
if (isDevelopment) {
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
|
|
|
@ -33,6 +33,9 @@ const localApi = {
|
||||||
},
|
},
|
||||||
getConfigDir () {
|
getConfigDir () {
|
||||||
return getDefaultConfigBasePath()
|
return getDefaultConfigBasePath()
|
||||||
|
},
|
||||||
|
getSystemPlatform () {
|
||||||
|
return DevSidecar.api.shell.getSystemPlatform()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
请按如下步骤将<b>本地随机生成</b>的根证书添加到<b>信任的根证书颁发机构</b><br/>
|
请按如下步骤将<b>本地随机生成</b>的根证书添加到<b>信任的根证书颁发机构</b><br/>
|
||||||
证书是本地随机生成,所以信任它是安全的
|
证书是本地随机生成,所以信任它是安全的
|
||||||
</div>
|
</div>
|
||||||
<img width="100%" src="/setup.png" />
|
<img width="100%" :src="setupImage" />
|
||||||
|
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
@ -40,9 +40,22 @@ export default {
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
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: {
|
methods: {
|
||||||
afterVisibleChange (val) {
|
afterVisibleChange (val) {
|
||||||
|
|
After Width: | Height: | Size: 18 KiB |
|
@ -7,7 +7,7 @@ config.caKeyFileName = 'dev-sidecar.ca.key.pem'
|
||||||
|
|
||||||
config.defaultPort = 1181
|
config.defaultPort = 1181
|
||||||
|
|
||||||
config.caName = 'This certificate is generated locally'
|
config.caName = 'DevSidecar - This certificate is generated locally'
|
||||||
|
|
||||||
config.caBasePath = buildDefaultCABasePath()
|
config.caBasePath = buildDefaultCABasePath()
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ config.setDefaultCABasePath = function (path) {
|
||||||
config.caBasePath = path
|
config.caBasePath = path
|
||||||
}
|
}
|
||||||
function buildDefaultCABasePath () {
|
function buildDefaultCABasePath () {
|
||||||
const userHome = process.env.USERPROFILE || process.env.HOME
|
const userHome = process.env.USERPROFILE || process.env.HOME || '/'
|
||||||
return path.resolve(userHome, './.dev-sidecar')
|
return path.resolve(userHome, './.dev-sidecar')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ const pki = forge.pki
|
||||||
// }
|
// }
|
||||||
|
|
||||||
utils.createCA = function (CN) {
|
utils.createCA = function (CN) {
|
||||||
const keys = pki.rsa.generateKeyPair(2046)
|
const keys = pki.rsa.generateKeyPair(2048)
|
||||||
const cert = pki.createCertificate()
|
const cert = pki.createCertificate()
|
||||||
cert.publicKey = keys.publicKey
|
cert.publicKey = keys.publicKey
|
||||||
cert.serialNumber = (new Date()).getTime() + ''
|
cert.serialNumber = (new Date()).getTime() + ''
|
||||||
|
@ -74,7 +74,7 @@ utils.covertNodeCertToForgeCert = function (originCertificate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
utils.createFakeCertificateByDomain = function (caKey, caCert, domain) {
|
utils.createFakeCertificateByDomain = function (caKey, caCert, domain) {
|
||||||
const keys = pki.rsa.generateKeyPair(2046)
|
const keys = pki.rsa.generateKeyPair(2048)
|
||||||
const cert = pki.createCertificate()
|
const cert = pki.createCertificate()
|
||||||
cert.publicKey = keys.publicKey
|
cert.publicKey = keys.publicKey
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ utils.createFakeCertificateByDomain = function (caKey, caCert, domain) {
|
||||||
utils.createFakeCertificateByCA = function (caKey, caCert, originCertificate) {
|
utils.createFakeCertificateByCA = function (caKey, caCert, originCertificate) {
|
||||||
const certificate = utils.covertNodeCertToForgeCert(originCertificate)
|
const certificate = utils.covertNodeCertToForgeCert(originCertificate)
|
||||||
|
|
||||||
const keys = pki.rsa.generateKeyPair(2046)
|
const keys = pki.rsa.generateKeyPair(2048)
|
||||||
const cert = pki.createCertificate()
|
const cert = pki.createCertificate()
|
||||||
cert.publicKey = keys.publicKey
|
cert.publicKey = keys.publicKey
|
||||||
|
|
||||||
|
|