diff --git a/proxy.js b/proxy.js index a0854fc..7d35fc1 100644 --- a/proxy.js +++ b/proxy.js @@ -23,7 +23,6 @@ var http = require('http'), events = require("events"), express = require("express"), ip = require("ip"), - ent = require("ent"), ThrottleGroup = require("stream-throttle").ThrottleGroup, iconv = require('iconv-lite'), Buffer = require('buffer').Buffer; diff --git a/web/anyproxy_wsUtil.js b/web/anyproxy_wsUtil.js index 29d0803..a4509f0 100644 --- a/web/anyproxy_wsUtil.js +++ b/web/anyproxy_wsUtil.js @@ -39,21 +39,21 @@ function anyproxy_wsUtil(config){ type = data.type, content = data.content, reqRef = data.reqRef; - - if(type == "update"){ - config.onGetUpdate && config.onGetUpdate.call(self, content); - - }else if(type == "body"){ - config.onGetBody && config.onGetBody.call(self, content, reqRef); - - if(data.reqRef && self.bodyCbMap[reqRef]){ - self.bodyCbMap[reqRef].call(self,content); - } - } - }catch(e){ config.onError && config.onError.call(self, new Error("failed to parse socket data - " + e.toString()) ); } + + + if(type == "update"){ + config.onGetUpdate && config.onGetUpdate.call(self, content); + + }else if(type == "body"){ + config.onGetBody && config.onGetBody.call(self, content, reqRef); + + if(data.reqRef && self.bodyCbMap[reqRef]){ + self.bodyCbMap[reqRef].call(self,content); + } + } } dataSocket.onopen = function(e){ diff --git a/web/index.html b/web/index.html index c2d80a6..19e9b95 100644 --- a/web/index.html +++ b/web/index.html @@ -37,23 +37,8 @@
-
- - - - - - - - - - - - - -
idmethodcodehostpathmime typetime
-
+
-
- - - + diff --git a/web/list.js b/web/list.js index 37c97d9..b40d272 100644 --- a/web/list.js +++ b/web/list.js @@ -14,8 +14,6 @@ seajs.use(['$', 'Underscore', 'Backbone',"Handlebars","Popup","./detail"], funct var isInApp = window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.list; - - //record detail var DetailView = function(){ var self = this, @@ -142,9 +140,6 @@ seajs.use(['$', 'Underscore', 'Backbone',"Handlebars","Popup","./detail"], funct recList.reset(); } - //pause btn - var ifPause = false, - indicatorEl = $("#J_indicator"); (function(){ var statusBtn = $(".J_statusBtn"); statusBtn.on("click",function(e){ @@ -166,45 +161,7 @@ seajs.use(['$', 'Underscore', 'Backbone',"Handlebars","Popup","./detail"], funct }); })(); - //invoke AnyProxy web socket util - (function(){ - try{ - var ws = window.ws = new anyproxy_wsUtil({ - baseUrl : $("#baseUrl").val(), - port : $("#socketPort").val(), - onOpen : function(){ - indicatorEl.css("visibility","visible"); - }, - onGetUpdate : function(content){ - if(ifPause) return; - var reqDate = new Date(content.startTime); - content.startTimeStr = reqDate.format("hh:mm:ss") + ""; - - var previous; - if(previous = recList.get(content.id)){ - previous.set(content); - }else{ - recList.add(new RecordModel(content),{merge: true}); - } - }, - onError : function(e){ - console.log(e); - indicatorEl.css("visibility","hidden"); - alert("socket err, please refresh"); - }, - onClose : function(e){ - console.log(e); - indicatorEl.css("visibility","hidden"); - alert("socket closed, please refresh"); - } - }); - window.ws = ws; - - }catch(e){ - alert("failed to invoking web socket on this browser"); - } - })(); //draggable panel (function(){