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}`)
console.log('npm https proxy set success', ret)
// ret = await winExec(`npm config set cafile ${config.getDefaultCAKeyPath()}`)
// console.log('npm cafile set success', ret)
ret = await winExec(`npm config set ca ${config.getDefaultCAKeyPath()}`)
console.log('npm cafile set success', ret)
ret = await winExec('npm config set strict-ssl false')
console.log('npm strict-ssl false success', ret)
// ret = await winExec('npm config set strict-ssl false')
// console.log('npm strict-ssl false success', ret)
}
static async unsetProxy () {
@ -41,10 +41,10 @@ class WindowsSystemProxy extends SystemProxy {
await winExec('npm config delete https-proxy')
console.log('npm https proxy unset success')
await winExec('npm config delete cafile')
console.log('npm cafile unset success')
await winExec(' npm config delete strict-ssl')
console.log('npm strict-ssl true success')
await winExec('npm config delete ca')
console.log('npm ca unset success')
// await winExec(' npm config delete strict-ssl')
// console.log('npm strict-ssl true success')
}
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}`)
console.log('yarn https proxy set success', ret)
// ret = await winExec(`yarn config set cafile ${config.getDefaultCAKeyPath()}`)
// console.log('yarn cafile set success', ret)
ret = await winExec(`yarn config set ca ${config.getDefaultCAKeyPath()}`)
console.log('yarn cafile set success', ret)
ret = await winExec('yarn config set strict-ssl false')
console.log('yarn strict-ssl false success', ret)
// ret = await winExec('yarn config set strict-ssl false')
// console.log('yarn strict-ssl false success', ret)
}
static async unsetProxy () {
@ -42,10 +42,11 @@ class WindowsSystemProxy extends SystemProxy {
await winExec('yarn config delete https-proxy')
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')
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) {

View File

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