set-global-proxy
Advanced tools
Comparing version 0.1.11 to 0.2.0-beta
22
index.js
var os = require('os'); | ||
var net = require('net'); | ||
var fs = require('fs'); | ||
var AdmZip = require('adm-zip'); | ||
var mac = require('./lib/mac'); | ||
@@ -24,2 +26,17 @@ var win = require('./lib/win'); | ||
function checkExists() { | ||
if (!fs.existsSync(mac.PROXY_HELPER)) { | ||
return false; | ||
} | ||
return fs.statSync(mac.PROXY_HELPER).size > 0; | ||
} | ||
function initProxyHelper() { | ||
if (!checkExists()) { | ||
var buf = fs.readFileSync(mac.PROXY_HELPER + '.jsx'); | ||
var entry = new AdmZip(buf).getEntries()[0]; | ||
fs.writeFileSync(mac.PROXY_HELPER, entry.getData()); | ||
} | ||
} | ||
// only support mac & win | ||
@@ -31,2 +48,7 @@ function getProxyMgr() { | ||
if (platform === 'darwin') { | ||
try { | ||
initProxyHelper(); | ||
} catch (e) { | ||
initProxyHelper(); | ||
} | ||
return mac; | ||
@@ -33,0 +55,0 @@ } |
{ | ||
"name": "set-global-proxy", | ||
"description": "Set global proxy for PC", | ||
"version": "0.1.11", | ||
"version": "0.2.0-beta", | ||
"author": "avenwu <avenwu@vip.qq.com>", | ||
@@ -28,2 +28,5 @@ "contributors": [], | ||
}, | ||
"dependencies": { | ||
"adm-zip": "0.5.10" | ||
}, | ||
"devDependencies": { | ||
@@ -30,0 +33,0 @@ "babel-core": "^6.7.6", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
465
72036
1
2
+ Addedadm-zip@0.5.10
+ Addedadm-zip@0.5.10(transitive)