refactor: proxy

pull/180/head
xiaojunnuo 2020-10-26 22:50:42 +08:00
parent c5b1f0bf6d
commit ea8ea38cd4
3 changed files with 18 additions and 16 deletions

View File

@ -28,11 +28,11 @@ class WindowsSystemProxy extends SystemProxy {
ret = await winExec(`npm config set https-proxy=http://${ip}:${port}`) ret = await winExec(`npm config set https-proxy=http://${ip}:${port}`)
console.log('npm https proxy set success', ret) console.log('npm https proxy set success', ret)
// ret = await winExec(`npm config set cafile ${config.getDefaultCAKeyPath()}`) ret = await winExec(`npm config set ca ${config.getDefaultCAKeyPath()}`)
// console.log('npm cafile set success', ret) console.log('npm cafile set success', ret)
ret = await winExec('npm config set strict-ssl false') // ret = await winExec('npm config set strict-ssl false')
console.log('npm strict-ssl false success', ret) // console.log('npm strict-ssl false success', ret)
} }
static async unsetProxy () { static async unsetProxy () {
@ -41,10 +41,10 @@ class WindowsSystemProxy extends SystemProxy {
await winExec('npm config delete https-proxy') await winExec('npm config delete https-proxy')
console.log('npm https proxy unset success') console.log('npm https proxy unset success')
await winExec('npm config delete cafile') await winExec('npm config delete ca')
console.log('npm cafile unset success') console.log('npm ca unset success')
await winExec(' npm config delete strict-ssl') // await winExec(' npm config delete strict-ssl')
console.log('npm strict-ssl true success') // console.log('npm strict-ssl true success')
} }
static _asyncRegSet (regKey, name, type, value) { static _asyncRegSet (regKey, name, type, value) {

View File

@ -29,11 +29,11 @@ class WindowsSystemProxy extends SystemProxy {
ret = await winExec(`yarn config set https-proxy=http://${ip}:${port}`) ret = await winExec(`yarn config set https-proxy=http://${ip}:${port}`)
console.log('yarn https proxy set success', ret) console.log('yarn https proxy set success', ret)
// ret = await winExec(`yarn config set cafile ${config.getDefaultCAKeyPath()}`) ret = await winExec(`yarn config set ca ${config.getDefaultCAKeyPath()}`)
// console.log('yarn cafile set success', ret) console.log('yarn cafile set success', ret)
ret = await winExec('yarn config set strict-ssl false') // ret = await winExec('yarn config set strict-ssl false')
console.log('yarn strict-ssl false success', ret) // console.log('yarn strict-ssl false success', ret)
} }
static async unsetProxy () { static async unsetProxy () {
@ -42,10 +42,11 @@ class WindowsSystemProxy extends SystemProxy {
await winExec('yarn config delete https-proxy') await winExec('yarn config delete https-proxy')
console.log('yarn https proxy unset success') console.log('yarn https proxy unset success')
await winExec('yarn config delete cafile') await winExec('yarn config delete ca')
console.log('yarn cafile unset success') console.log('yarn cafile unset success')
await winExec(' yarn config delete strict-ssl')
console.log('yarn strict-ssl true success') // await winExec(' yarn config delete strict-ssl')
// console.log('yarn strict-ssl true success')
} }
static _asyncRegSet (regKey, name, type, value) { static _asyncRegSet (regKey, name, type, value) {

View File

@ -29,8 +29,9 @@ bindApi('server.close')
bindApi('proxy.system.open') bindApi('proxy.system.open')
bindApi('proxy.system.close') bindApi('proxy.system.close')
bindApi('proxy.npm.open') bindApi('proxy.npm.open')
bindApi('proxy.npm.close') bindApi('proxy.npm.close')
bindApi('proxy.yarn.open')
bindApi('proxy.yarn.close')
export default apiObj export default apiObj