diff --git a/README.md b/README.md index 5aec734..a78182a 100644 --- a/README.md +++ b/README.md @@ -207,6 +207,7 @@ Using https features #### about certs * root certs and temperary certs are stored at ``path.join(util.getUserHome(),"/.anyproxy_certs/")`` +* to get the rootCA.crt file , you may either find it in local dir or download it via anyproxy web interface * to clear all the temperary certificates ``anyproxy --clear`` Others diff --git a/lib/certMgr.js b/lib/certMgr.js index 1151fa7..1c2b159 100644 --- a/lib/certMgr.js +++ b/lib/certMgr.js @@ -72,7 +72,7 @@ function checkRootCA(){ if(!isRootCAFileExists()){ console.log(color.red("can not find rootCA.crt or rootCA.key")); console.log(color.red("you may generate one by the following methods")); - console.log(color.red("\twhen using globally : sudo anyproxy --root")); + console.log(color.red("\twhen using globally : anyproxy --root")); console.log(color.red("\twhen using as a module : require(\"anyproxy\").generateRootCA();")); process.exit(0); } @@ -110,6 +110,7 @@ function generateRootCA(){ if(code == 0){ console.log(color.green("rootCA generated")); console.log(color.green(color.bold("please trust the rootCA.crt in " + certDir))); + console.log(color.green(color.bold("or you may get it via anyproxy webinterface"))); process.exit(0); }else{ console.log(color.red("fail to generate root CA")); @@ -120,6 +121,16 @@ function generateRootCA(){ } } + +function getRootCAFilePath(){ + if(isRootCAFileExists()){ + return path.join(certDir,"rootCA.crt"); + }else{ + return ""; + } +} + +module.exports.getRootCAFilePath = getRootCAFilePath; module.exports.generateRootCA = generateRootCA; module.exports.getCertificate = getCertificate; module.exports.createCert = createCert; diff --git a/package.json b/package.json index 8275741..f856e55 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anyproxy", - "version": "2.7.6", + "version": "2.8.0", "description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.", "main": "proxy.js", "bin": { diff --git a/proxy.js b/proxy.js index 8cdf2a3..d130db7 100644 --- a/proxy.js +++ b/proxy.js @@ -146,10 +146,12 @@ function proxyServer(option){ //TODO : uncaught exception //kill web server when father process exits - process.on("exit",function(){ + process.on("exit uncaughtException",function(){ child_webServer.kill(); + process.exit(); }); + GLOBAL.recorder.on("update",function(data){ child_webServer.send({ type: "update", diff --git a/web/index.html b/web/index.html index 68232fb..bb97e28 100644 --- a/web/index.html +++ b/web/index.html @@ -15,6 +15,7 @@ Clear Logs(Ctrl+X) Stop Resume + Fetch rootCA.crt Config Local Response(beta)