diff --git a/lib/certMgr.js b/lib/certMgr.js index c115be3..18dfde3 100644 --- a/lib/certMgr.js +++ b/lib/certMgr.js @@ -8,6 +8,7 @@ var exec = require('child_process').exec, util = require('./util'), asyncTask = require("async-task-mgr"); +//TODO : unstable in windows var certDir = path.join(util.getUserHome(),"/.anyproxy_certs/"), cmdDir = path.join(__dirname,"..","./cert/"), cmd_genRoot = path.join(cmdDir,"./gen-rootCA"), diff --git a/lib/recorder.js b/lib/recorder.js index 9b89488..a2f546c 100644 --- a/lib/recorder.js +++ b/lib/recorder.js @@ -115,7 +115,7 @@ function normalizeInfo(id,info){ singleRecord.reqHeader = info.req.headers; singleRecord.startTime = info.startTime; singleRecord.reqBody = info.reqBody || ""; - singleRecord.protocol = info.protocol; + singleRecord.protocol = info.protocol || ""; //res if(info.endTime){ diff --git a/lib/rule_default.js b/lib/rule_default.js index aaa3121..c1e9bf1 100644 --- a/lib/rule_default.js +++ b/lib/rule_default.js @@ -4,7 +4,7 @@ module.exports = { summary:function(){ var tip = "the default rule for anyproxy, support : CORS. "; if(isRootCAFileExists){ - tip += "\nRoot CA exists, will intercept all https requests for you"; + tip += "\nRoot CA exists, will intercept all https requests."; } return tip; }, diff --git a/package.json b/package.json index 9871675..6d520b4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "anyproxy", - "version": "2.9.0", + "version": "2.9.1", "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 ff3ec6d..35381f3 100644 --- a/proxy.js +++ b/proxy.js @@ -51,9 +51,10 @@ var T_TYPE_HTTP = 0, DEFAULT_TYPE = T_TYPE_HTTP; var default_rule = require('./lib/rule_default'); + //may be unreliable in windows -var anyproxyHome = path.join(util.getUserHome(),"/.anyproxy/"); try{ + var anyproxyHome = path.join(util.getUserHome(),"/.anyproxy/"); if(!fs.existsSync(anyproxyHome)){ fs.mkdirSync(anyproxyHome); } @@ -63,9 +64,7 @@ try{ if(fs.existsSync(path.join(process.cwd(),'rule.js'))){ default_rule = require(path.join(process.cwd(),'rule')); } -}catch(e){ - -} +}catch(e){} //option //option.type : 'http'(default) or 'https' @@ -184,11 +183,11 @@ function proxyServer(option){ var tipText,webUrl; webUrl = "http://" + ip.address() + ":" + proxyWebPort +"/"; - tipText = "web interface started at : " + webUrl; + tipText = "GUI interface started at : " + webUrl; console.log(color.green(tipText)); - tipText = "[alpha]qr code to for iOS client: " + webUrl + "qr"; - console.log(color.green(tipText)); + // tipText = "[alpha]qr code to for iOS client: " + webUrl + "qr"; + // console.log(color.green(tipText)); callback(null); } } @@ -197,7 +196,7 @@ function proxyServer(option){ //final callback function(err,result){ if(!err){ - var tipText = (proxyType == T_TYPE_HTTP ? "Http" : "Https") + " proxy started at port " + proxyPort; + var tipText = (proxyType == T_TYPE_HTTP ? "Http" : "Https") + " proxy started at " + color.bold(ip.address() + ":" + proxyPort); console.log(color.green(tipText)); }else{ var tipText = "err when start proxy server :("; diff --git a/web/css/page.css b/web/css/page.css index a2739db..63aebcd 100644 --- a/web/css/page.css +++ b/web/css/page.css @@ -29,10 +29,48 @@ width: 220px; height: 55px; overflow: hidden; + position: relative; } -.topHead h1{ - color: #CCCCCC; +.topHead .logoWrapper h1{ + color: #333; + line-height: 55px; + text-align: center; + margin: 0; +} + +.topHead .logoWrapper .logo_bottom { + position: absolute; + left: -25px; + bottom: 0px; +} + +.anim_rotation{ + -webkit-animation: rotation 1.2s infinite cubic-bezier(.63,.33,.46,.71); +} + +@-webkit-keyframes rotation { + 0% { + -webkit-transform: rotate(0deg); + opacity: 0.1; + } + + 20% { + opacity: 0.1; + } + + 40% { + opacity: 0.25; + } + + 80% { + opacity: 0.1; + } + + 100% { + -webkit-transform: rotate(359deg); + opacity: 0.1; + } } .topHead .ctrlWrapper{ @@ -88,6 +126,11 @@ table-layout: fixed; } +.mainTableWrapper thead{ + background: #DDD; + border-bottom: 1px solid #777; +} + .mainTableWrapper td, .mainTableWrapper th{ padding: 4px 12px; @@ -205,7 +248,7 @@ } .http_status{ - font-weight: 700; + /*font-weight: 700;*/ } .http_status_200{ diff --git a/web/index.html b/web/index.html index 27194a3..1105577 100644 --- a/web/index.html +++ b/web/index.html @@ -13,8 +13,11 @@

Anyproxy

+
+ +
Stop Resume diff --git a/web/list.js b/web/list.js index c384222..15aa2dd 100644 --- a/web/list.js +++ b/web/list.js @@ -141,7 +141,8 @@ seajs.use(['$', 'Underscore', 'Backbone',"./detail"], function($, _, Backbone,De } //pause btn - var ifPause = false; + var ifPause = false, + indicatorEl = $("#J_indicator"); (function(){ var statusBtn = $(".J_statusBtn"); statusBtn.on("click",function(e){ @@ -153,8 +154,12 @@ seajs.use(['$', 'Underscore', 'Backbone',"./detail"], function($, _, Backbone,De if(/stop/i.test($(this).html()) ){ ifPause = true; + indicatorEl.fadeOut(); + // indicatorEl.css("visibility","hidden"); }else{ ifPause = false; + indicatorEl.fadeIn(); + // indicatorEl.css("visibility","visible"); } }); })(); @@ -165,9 +170,11 @@ seajs.use(['$', 'Underscore', 'Backbone',"./detail"], function($, _, Backbone,De return; } var socketPort = $("#socketPort").val(), - baseUrl = $("#baseUrl").val(), - dataSocket = new WebSocket("ws://" + baseUrl + ":" + socketPort); - dataSocket.onopen = function(){} + baseUrl = $("#baseUrl").val(), + dataSocket = new WebSocket("ws://" + baseUrl + ":" + socketPort); + dataSocket.onopen = function(){ + indicatorEl.css("visibility","visible"); + } dataSocket.onmessage = function(event){ if(ifPause) return; @@ -184,8 +191,12 @@ seajs.use(['$', 'Underscore', 'Backbone',"./detail"], function($, _, Backbone,De } } + dataSocket.onclose = function(e){ + } + dataSocket.onerror = function(e){ console.log(e); + indicatorEl.css("visibility","hidden"); alert("socket err, please refresh"); }