From ebc3f940ea0d48d60dbb77d444f9cd25edd90656 Mon Sep 17 00:00:00 2001 From: liqiang <974923609@qq.com> Date: Wed, 24 Mar 2021 19:19:19 +0800 Subject: [PATCH] chore: web addon build frontend --- addon/web/client/build/asset-manifest.json | 6 +++--- addon/web/client/build/index.html | 2 +- addon/web/client/build/static/js/main.37b6cc16.chunk.js | 2 ++ addon/web/client/build/static/js/main.37b6cc16.chunk.js.map | 1 + addon/web/client/build/static/js/main.c16ab123.chunk.js | 2 -- addon/web/client/build/static/js/main.c16ab123.chunk.js.map | 1 - 6 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 addon/web/client/build/static/js/main.37b6cc16.chunk.js create mode 100644 addon/web/client/build/static/js/main.37b6cc16.chunk.js.map delete mode 100644 addon/web/client/build/static/js/main.c16ab123.chunk.js delete mode 100644 addon/web/client/build/static/js/main.c16ab123.chunk.js.map diff --git a/addon/web/client/build/asset-manifest.json b/addon/web/client/build/asset-manifest.json index 89c06ca..27fb283 100644 --- a/addon/web/client/build/asset-manifest.json +++ b/addon/web/client/build/asset-manifest.json @@ -1,8 +1,8 @@ { "files": { "main.css": "/static/css/main.cb45a0e0.chunk.css", - "main.js": "/static/js/main.c16ab123.chunk.js", - "main.js.map": "/static/js/main.c16ab123.chunk.js.map", + "main.js": "/static/js/main.37b6cc16.chunk.js", + "main.js.map": "/static/js/main.37b6cc16.chunk.js.map", "runtime-main.js": "/static/js/runtime-main.e3236fc4.js", "runtime-main.js.map": "/static/js/runtime-main.e3236fc4.js.map", "static/css/2.150d169a.chunk.css": "/static/css/2.150d169a.chunk.css", @@ -20,6 +20,6 @@ "static/css/2.150d169a.chunk.css", "static/js/2.e37d223a.chunk.js", "static/css/main.cb45a0e0.chunk.css", - "static/js/main.c16ab123.chunk.js" + "static/js/main.37b6cc16.chunk.js" ] } \ No newline at end of file diff --git a/addon/web/client/build/index.html b/addon/web/client/build/index.html index dd3f97f..5e2f089 100644 --- a/addon/web/client/build/index.html +++ b/addon/web/client/build/index.html @@ -1 +1 @@ -go-mitmproxy
\ No newline at end of file +go-mitmproxy
\ No newline at end of file diff --git a/addon/web/client/build/static/js/main.37b6cc16.chunk.js b/addon/web/client/build/static/js/main.37b6cc16.chunk.js new file mode 100644 index 0000000..f304ff2 --- /dev/null +++ b/addon/web/client/build/static/js/main.37b6cc16.chunk.js @@ -0,0 +1,2 @@ +(this.webpackJsonpclient=this.webpackJsonpclient||[]).push([[0],{30:function(e,t,n){},35:function(e,t,n){"use strict";n.r(t);var s=n(0),r=n.n(s),i=n(9),c=n.n(i),a=(n(29),n(12)),l=n(13),o=n(18),d=n(17),h=n(24),j=n(7),u=n(10),b=(n(30),n(11)),f=n(14),O=n(16),p=n(19),w=n(15),x=n(1),v=function(e){Object(o.a)(n,e);var t=Object(d.a)(n);function n(e){var s;return Object(a.a)(this,n),(s=t.call(this,e)).state={show:!1,rule:{method:"ALL",url:"",action:"1"}},s.handleClose=s.handleClose.bind(Object(f.a)(s)),s.handleShow=s.handleShow.bind(Object(f.a)(s)),s.handleSave=s.handleSave.bind(Object(f.a)(s)),s}return Object(l.a)(n,[{key:"handleClose",value:function(){this.setState({show:!1})}},{key:"handleShow",value:function(){this.setState({show:!0})}},{key:"handleSave",value:function(){var e=this.state.rule,t=[];e.url&&t.push({method:"ALL"===e.method?"":e.method,url:e.url,action:parseInt(e.action)}),this.props.onSave(t),this.handleClose()}},{key:"render",value:function(){var e=this,t=this.state.rule;return Object(x.jsxs)("div",{children:[Object(x.jsx)(u.a,{size:"sm",onClick:this.handleShow,children:"BreakPoint"}),Object(x.jsxs)(O.a,{show:this.state.show,onHide:this.handleClose,children:[Object(x.jsx)(O.a.Header,{closeButton:!0,children:Object(x.jsx)(O.a.Title,{children:"Set BreakPoint"})}),Object(x.jsx)(O.a.Body,{children:Object(x.jsxs)(j.a,{children:[Object(x.jsxs)(j.a.Group,{as:p.a,children:[Object(x.jsx)(j.a.Label,{column:!0,sm:2,children:"Method"}),Object(x.jsx)(w.a,{sm:10,children:Object(x.jsxs)(j.a.Control,{as:"select",value:t.method,onChange:function(n){e.setState({rule:Object(b.a)(Object(b.a)({},t),{},{method:n.target.value})})},children:[Object(x.jsx)("option",{children:"ALL"}),Object(x.jsx)("option",{children:"GET"}),Object(x.jsx)("option",{children:"POST"}),Object(x.jsx)("option",{children:"PUT"}),Object(x.jsx)("option",{children:"DELETE"})]})})]}),Object(x.jsxs)(j.a.Group,{as:p.a,children:[Object(x.jsx)(j.a.Label,{column:!0,sm:2,children:"URL"}),Object(x.jsx)(w.a,{sm:10,children:Object(x.jsx)(j.a.Control,{value:t.url,onChange:function(n){e.setState({rule:Object(b.a)(Object(b.a)({},t),{},{url:n.target.value})})}})})]}),Object(x.jsxs)(j.a.Group,{as:p.a,children:[Object(x.jsx)(j.a.Label,{column:!0,sm:2,children:"Action"}),Object(x.jsx)(w.a,{sm:10,children:Object(x.jsxs)(j.a.Control,{as:"select",value:t.action,onChange:function(n){e.setState({rule:Object(b.a)(Object(b.a)({},t),{},{action:n.target.value})})},children:[Object(x.jsx)("option",{value:"1",children:"Request"}),Object(x.jsx)("option",{value:"2",children:"Response"}),Object(x.jsx)("option",{value:"3",children:"Both"})]})})]})]})}),Object(x.jsxs)(O.a.Footer,{children:[Object(x.jsx)(u.a,{variant:"secondary",onClick:this.handleClose,children:"Close"}),Object(x.jsx)(u.a,{variant:"primary",onClick:this.handleSave,children:"Save Changes"})]})]})]})}}]),n}(r.a.Component),m=function(){function e(){Object(a.a)(this,e),this.items=[],this._map=new Map,this.filterText="",this.filterTimer=null,this.num=0,this.max=1e3}return Object(l.a)(e,[{key:"showList",value:function(){var e=this;return this.filterText?this.items.filter((function(t){return t.request.url.includes(e.filterText)})):this.items}},{key:"add",value:function(e){if(e.no=++this.num,this.items.push(e),this._map.set(e.id,e),this.items.length>this.max){var t=this.items.shift();this._map.delete(t.id)}}},{key:"get",value:function(e){return this._map.get(e)}},{key:"changeFilter",value:function(e){this.filterText=e}},{key:"changeFilterLazy",value:function(e,t){var n=this;this.filterTimer&&(clearTimeout(this.filterTimer),this.filterTimer=null),this.filterTimer=setTimeout((function(){n.filterText=e,t()}),300)}},{key:"clear",value:function(){this.items=[],this._map=new Map}}]),e}(),y=function(e){return!!e&&(!!e.header&&(!!e.header["Content-Type"]&&/text|javascript|json/.test(e.header["Content-Type"].join(""))))},g=function(e){return e&&e.header?(e.header["Content-Length"]?t=parseInt(e.header["Content-Length"][0]):e&&e.body&&(t=e.body.byteLength),t?isNaN(t)||t<=0?"0":t<1024?"".concat(t," B"):t<1048576?"".concat((t/1024).toFixed(2)," KB"):"".concat((t/1048576).toFixed(2)," MB"):"0"):"0";var t},k=n(23),C={request:1,requestBody:2,response:3,responseBody:4},S=Object.keys(C).map((function(e){return C[e]})),L=Object.keys(C).reduce((function(e,t){return e[C[t]]=t,e}),{}),T=11,N=12,M=21,R=function(e){Object(o.a)(n,e);var t=Object(d.a)(n);function n(e){var s;return Object(a.a)(this,n),(s=t.call(this,e)).flowMgr=new m,s.state={flows:s.flowMgr.showList(),flow:null,flowTab:"Headers"},s.ws=null,s}return Object(l.a)(n,[{key:"componentDidMount",value:function(){this.initWs()}},{key:"componentWillUnmount",value:function(){this.ws&&this.ws.close()}},{key:"initWs",value:function(){var e,t=this;this.ws||(e=new URL(document.URL).host,this.ws=new WebSocket("ws://".concat(e,"/echo")),this.ws.binaryType="arraybuffer",this.ws.onopen=function(){console.log("OPEN")},this.ws.onclose=function(){console.log("CLOSE")},this.ws.onmessage=function(e){var n=function(e){if(e.byteLength<39)return null;var t=new Int8Array(e.slice(0,39));if(1!==t[0])return null;var n=t[1];if(!S.includes(n))return null;var s=(new TextDecoder).decode(e.slice(2,38)),r=1===t[38],i={type:L[n],id:s,waitIntercept:r};if(39===e.byteLength)return i;if(n===C.requestBody||n===C.responseBody)return i.content=e.slice(39),i;var c=(new TextDecoder).decode(e.slice(39));try{c=JSON.parse(c)}catch(a){return null}return i.content=c,i}(e.data);if(n){if("request"===n.type){var s={id:n.id,request:n.content,waitIntercept:n.waitIntercept};t.flowMgr.add(s),t.setState({flows:t.flowMgr.showList()})}else if("requestBody"===n.type){var r=t.flowMgr.get(n.id);if(!r)return;r.waitIntercept=n.waitIntercept,r.request.body=n.content,t.setState({flows:t.state.flows})}else if("response"===n.type){var i=t.flowMgr.get(n.id);if(!i)return;i.waitIntercept=n.waitIntercept,i.response=n.content,t.setState({flows:t.state.flows})}else if("responseBody"===n.type){var c=t.flowMgr.get(n.id);if(!c||!c.response)return;c.waitIntercept=n.waitIntercept,c.response.body=n.content,t.setState({flows:t.state.flows})}}else console.error("parse error:",e.data)},this.ws.onerror=function(e){console.log("ERROR:",e)})}},{key:"renderFlow",value:function(){var e=this,t=this.state,n=t.flow,s=t.flowTab;if(!n)return null;var r=n.request,i=n.response||{};return Object(x.jsxs)("div",{className:"flow-detail",children:[Object(x.jsxs)("div",{className:"header-tabs",children:[Object(x.jsx)("span",{onClick:function(){e.setState({flow:null})},children:"x"}),Object(x.jsx)("span",{className:"Headers"===s?"selected":null,onClick:function(){e.setState({flowTab:"Headers"})},children:"Headers"}),Object(x.jsx)("span",{className:"Preview"===s?"selected":null,onClick:function(){e.setState({flowTab:"Preview"})},children:"Preview"}),Object(x.jsx)("span",{className:"Response"===s?"selected":null,onClick:function(){e.setState({flowTab:"Response"})},children:"Response"}),n.waitIntercept?Object(x.jsxs)("div",{className:"flow-wait-area",children:[Object(x.jsx)(u.a,{size:"sm",onClick:function(){var t=function(e,t){var n,s;if(e===T){var r=t.request;s=r.body,n=Object(k.a)(r,["body"])}else{if(e!==N)throw new Error("invalid message type");var i=t.response;s=i.body,n=Object(k.a)(i,["body"])}var c=s&&s.byteLength?s.byteLength:0,a=(new TextEncoder).encode(JSON.stringify(n)),l=42+a.byteLength+4+c,o=new ArrayBuffer(l),d=new Uint8Array(o);d[0]=1,d[1]=e,d.set((new TextEncoder).encode(t.id),2),d.set(a,42),c&&d.set(s,42+a.byteLength+4);var h=new DataView(o);return h.setUint32(38,a.byteLength),h.setUint32(42+a.byteLength,c),d}(T,n);e.ws.send(t),n.waitIntercept=!1,e.setState({flows:e.state.flows})},children:"Continue"}),Object(x.jsx)(u.a,{size:"sm",children:"Drop"})]}):null]}),Object(x.jsxs)("div",{style:{padding:"20px"},children:["Headers"!==s?null:Object(x.jsxs)("div",{children:[Object(x.jsxs)("div",{className:"header-block",children:[Object(x.jsx)("p",{children:"General"}),Object(x.jsxs)("div",{className:"header-block-content",children:[Object(x.jsxs)("p",{children:["Request URL: ",r.url]}),Object(x.jsxs)("p",{children:["Request Method: ",r.method]}),Object(x.jsxs)("p",{children:["Status Code: ","".concat(i.statusCode||"(pending)")]})]})]}),i.header?Object(x.jsxs)("div",{className:"header-block",children:[Object(x.jsx)("p",{children:"Response Headers"}),Object(x.jsx)("div",{className:"header-block-content",children:Object.keys(i.header).map((function(e){return Object(x.jsxs)("p",{children:[e,": ",i.header[e].join(" ")]},e)}))})]}):null,Object(x.jsxs)("div",{className:"header-block",children:[Object(x.jsx)("p",{children:"Request Headers"}),Object(x.jsx)("div",{className:"header-block-content",children:r.header?Object.keys(r.header).map((function(e){return Object(x.jsxs)("p",{children:[e,": ",r.header[e].join(" ")]},e)})):null})]}),r.body&&r.body.byteLength?Object(x.jsxs)("div",{className:"header-block",children:[Object(x.jsx)("p",{children:"Request Body"}),Object(x.jsx)("div",{className:"header-block-content",children:Object(x.jsx)("p",{children:y(r)?(new TextDecoder).decode(r.body):"Not text"})})]}):null]}),"Response"!==s?null:i.body&&i.body.byteLength?y(i)?Object(x.jsx)("div",{children:(new TextDecoder).decode(i.body)}):Object(x.jsx)("div",{children:"Not text response"}):Object(x.jsx)("div",{children:"No response"})]})]})}},{key:"render",value:function(){var e=this,t=this.state.flows;return Object(x.jsxs)("div",{className:"main-table-wrap",children:[Object(x.jsxs)("div",{className:"top-control",children:[Object(x.jsx)("div",{children:Object(x.jsx)(u.a,{size:"sm",onClick:function(){e.flowMgr.clear(),e.setState({flows:e.flowMgr.showList(),flow:null})},children:"Clear"})}),Object(x.jsx)("div",{children:Object(x.jsx)(j.a.Control,{size:"sm",placeholder:"Filter",onChange:function(t){var n=t.target.value;e.flowMgr.changeFilterLazy(n,(function(){e.setState({flows:e.flowMgr.showList()})}))}})}),Object(x.jsx)(v,{onSave:function(t){var n=function(e,t){if(e!==M)throw new Error("invalid message type");var n=(new TextEncoder).encode(JSON.stringify(t)),s=new Uint8Array(2+n.byteLength);return s[0]=1,s[1]=e,s.set(n,2),s}(M,t);e.ws.send(n)}})]}),Object(x.jsxs)(h.a,{striped:!0,bordered:!0,size:"sm",children:[Object(x.jsx)("thead",{children:Object(x.jsxs)("tr",{children:[Object(x.jsx)("th",{children:"No"}),Object(x.jsx)("th",{children:"Host"}),Object(x.jsx)("th",{children:"Path"}),Object(x.jsx)("th",{children:"Method"}),Object(x.jsx)("th",{children:"Status"}),Object(x.jsx)("th",{children:"Size"})]})}),Object(x.jsx)("tbody",{children:t.map((function(t){var n=t.request.url,s=new URL(n),r=s.host;r.length>35&&(r=r.slice(0,35)+"...");var i=s.pathname+s.search;i.length>65&&(i=i.slice(0,65)+"...");var c=t.request,a=t.response||{},l=[];return e.state.flow&&e.state.flow.id===t.id&&l.push("tr-selected"),t.waitIntercept&&l.push("tr-wait-intercept"),Object(x.jsxs)("tr",{className:l.length?l.join(" "):null,onClick:function(){e.setState({flow:t})},children:[Object(x.jsx)("td",{children:t.no}),Object(x.jsx)("td",{children:r}),Object(x.jsx)("td",{children:i}),Object(x.jsx)("td",{children:c.method}),Object(x.jsx)("td",{children:a.statusCode||"(pending)"}),Object(x.jsx)("td",{children:g(a)})]},t.id)}))})]}),this.renderFlow()]})}}]),n}(r.a.Component),B=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,37)).then((function(t){var n=t.getCLS,s=t.getFID,r=t.getFCP,i=t.getLCP,c=t.getTTFB;n(e),s(e),r(e),i(e),c(e)}))};c.a.render(Object(x.jsx)(r.a.StrictMode,{children:Object(x.jsx)(R,{})}),document.getElementById("root")),B()}},[[35,1,2]]]); +//# sourceMappingURL=main.37b6cc16.chunk.js.map \ No newline at end of file diff --git a/addon/web/client/build/static/js/main.37b6cc16.chunk.js.map b/addon/web/client/build/static/js/main.37b6cc16.chunk.js.map new file mode 100644 index 0000000..eea72e4 --- /dev/null +++ b/addon/web/client/build/static/js/main.37b6cc16.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["components/BreakPoint.js","flow.js","utils.js","message.js","App.js","reportWebVitals.js","index.js"],"names":["BreakPoint","props","state","show","rule","method","url","action","handleClose","bind","handleShow","handleSave","this","setState","rules","push","parseInt","onSave","Button","size","onClick","Modal","onHide","Header","closeButton","Title","Body","Form","Group","as","Row","Label","column","sm","Col","Control","value","onChange","e","target","Footer","variant","React","Component","FlowManager","items","_map","Map","filterText","filterTimer","num","max","filter","item","request","includes","no","set","id","length","oldest","shift","delete","get","text","callback","clearTimeout","setTimeout","isTextResponse","response","header","test","join","getSize","len","body","byteLength","isNaN","toFixed","messageEnum","allMessageBytes","Object","keys","map","k","messageByteMap","reduce","m","sendMessageEnum","App","flowMgr","flows","showList","flow","flowTab","ws","initWs","close","host","URL","document","WebSocket","binaryType","onopen","console","log","onclose","onmessage","evt","msg","data","meta","Int8Array","slice","type","TextDecoder","decode","waitIntercept","resp","content","JSON","parse","err","parseMessage","add","error","onerror","className","messageType","Error","bodyLen","headerBytes","TextEncoder","encode","stringify","ArrayBuffer","view","Uint8Array","view2","DataView","setUint32","buildMessageEdit","send","style","padding","statusCode","key","clear","placeholder","changeFilterLazy","rulesBytes","buildMessageMeta","Table","striped","bordered","f","u","path","pathname","search","classNames","renderFlow","reportWebVitals","onPerfEntry","Function","then","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","StrictMode","getElementById"],"mappings":"uRA4GeA,E,kDApGb,WAAYC,GAAQ,IAAD,8BACjB,cAAMA,IAEDC,MAAQ,CACXC,MAAM,EAENC,KAAM,CACJC,OAAQ,MACRC,IAAK,GACLC,OAAQ,MAIZ,EAAKC,YAAc,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EAAKe,MAAM,EAAG,IAAM,OACjD,IAAI4C,EAAOD,EAAEE,SAAWF,EAAEG,OACtBF,EAAKlG,OAAS,KAAIkG,EAAOA,EAAK5C,MAAM,EAAG,IAAM,OAEjD,IAAM3D,EAAUqG,EAAErG,QACZe,EAAWsF,EAAEtF,UAAY,GAEzB2F,EAAa,GAInB,OAHI,EAAK9J,MAAM2F,MAAQ,EAAK3F,MAAM2F,KAAKnC,KAAOiG,EAAEjG,IAAIsG,EAAWjJ,KAAK,eAChE4I,EAAEtC,eAAe2C,EAAWjJ,KAAK,qBAGnC,qBAAIgH,UAAWiC,EAAWrG,OAASqG,EAAWxF,KAAK,KAAO,KACxDpD,QAAS,WACP,EAAKP,SAAS,CAAEgF,KAAM8D,KAF1B,UAKE,6BAAKA,EAAEnG,KACP,6BAAK0C,IACL,6BAAK2D,IACL,6BAAKvG,EAAQjD,SACb,6BAAKgE,EAAS4E,YAAc,cAC5B,6BAAKxE,EAAQJ,OAVsDsF,EAAEjG,YAkBhF9C,KAAKqJ,oB,GAlQIvH,IAAMC,WCATuH,EAZS,SAAAC,GAClBA,GAAeA,aAAuBC,UACxC,6BAAqBC,MAAK,YAAkD,IAA/CC,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QAC3DJ,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAON,GACPO,EAAQP,OCDdQ,IAASC,OACP,cAAC,IAAMC,WAAP,UACE,cAAC,EAAD,MAEFzE,SAAS0E,eAAe,SAM1BZ,M","file":"static/js/main.37b6cc16.chunk.js","sourcesContent":["import React from 'react'\nimport Button from 'react-bootstrap/Button'\nimport Modal from 'react-bootstrap/Modal'\nimport Form from 'react-bootstrap/Form'\nimport Row from 'react-bootstrap/Row'\nimport Col from 'react-bootstrap/Col'\n\nclass BreakPoint extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n show: false,\n\n rule: {\n method: 'ALL',\n url: '',\n action: '1',\n }\n }\n\n this.handleClose = this.handleClose.bind(this)\n this.handleShow = this.handleShow.bind(this)\n this.handleSave = this.handleSave.bind(this)\n }\n\n handleClose() {\n this.setState({ show: false })\n }\n\n handleShow() {\n this.setState({ show: true })\n }\n\n handleSave() {\n const { rule } = this.state\n const rules = []\n if (rule.url) {\n rules.push({\n method: rule.method === 'ALL' ? '' : rule.method,\n url: rule.url,\n action: parseInt(rule.action)\n })\n }\n\n this.props.onSave(rules)\n this.handleClose()\n }\n\n render() {\n const { rule } = this.state\n\n return (\n
\n \n\n \n \n Set BreakPoint\n \n\n \n
\n \n Method\n \n { this.setState({ rule: { ...rule, method: e.target.value } }) }}>\n \n \n \n \n \n \n \n \n\n \n URL\n { this.setState({ rule: { ...rule, url: e.target.value } }) }} />\n \n\n \n Action\n \n { this.setState({ rule: { ...rule, action: e.target.value } }) }}>\n \n \n \n \n \n \n
\n
\n\n \n \n \n \n
\n
\n )\n }\n}\n\nexport default BreakPoint\n","export class FlowManager {\n constructor() {\n this.items = []\n this._map = new Map()\n this.filterText = ''\n this.filterTimer = null\n this.num = 0\n\n this.max = 1000\n }\n\n showList() {\n if (!this.filterText) return this.items\n return this.items.filter(item => {\n return item.request.url.includes(this.filterText)\n })\n }\n\n add(item) {\n item.no = ++this.num\n this.items.push(item)\n this._map.set(item.id, item)\n \n if (this.items.length > this.max) {\n const oldest = this.items.shift()\n this._map.delete(oldest.id)\n }\n }\n\n get(id) {\n return this._map.get(id)\n }\n\n changeFilter(text) {\n this.filterText = text\n }\n\n changeFilterLazy(text, callback) {\n if (this.filterTimer) {\n clearTimeout(this.filterTimer)\n this.filterTimer = null\n }\n\n this.filterTimer = setTimeout(() => {\n this.filterText = text\n callback()\n }, 300)\n }\n\n clear() {\n this.items = []\n this._map = new Map()\n }\n}\n","export const isTextResponse = response => {\n if (!response) return false\n if (!response.header) return false\n if (!response.header['Content-Type']) return false\n\n return /text|javascript|json/.test(response.header['Content-Type'].join(''))\n}\n\nexport const getSize = response => {\n if (!response) return '0'\n if (!response.header) return '0'\n\n let len\n if (response.header['Content-Length']) {\n len = parseInt(response.header['Content-Length'][0])\n } else if (response && response.body) {\n len = response.body.byteLength\n }\n if (!len) return '0'\n if (isNaN(len)) return '0'\n if (len <= 0) return '0'\n \n if (len < 1024) return `${len} B`\n if (len < 1024*1024) return `${(len/1024).toFixed(2)} KB`\n return `${(len/(1024*1024)).toFixed(2)} MB`\n}\n","const messageEnum = {\n 'request': 1,\n 'requestBody': 2,\n 'response': 3,\n 'responseBody': 4,\n}\n\nconst allMessageBytes = Object.keys(messageEnum).map(k => messageEnum[k])\n\nconst messageByteMap = Object.keys(messageEnum).reduce((m, k) => {\n m[messageEnum[k]] = k\n return m\n}, {})\n\n\n// type: 1/2/3/4\n// messageFlow\n// version 1 byte + type 1 byte + id 36 byte + waitIntercept 1 byte + content left bytes\nexport const parseMessage = data => {\n if (data.byteLength < 39) return null\n const meta = new Int8Array(data.slice(0, 39))\n const version = meta[0]\n if (version !== 1) return null\n const type = meta[1]\n if (!allMessageBytes.includes(type)) return null\n const id = new TextDecoder().decode(data.slice(2, 38))\n const waitIntercept = meta[38] === 1\n\n const resp = {\n type: messageByteMap[type],\n id,\n waitIntercept,\n }\n if (data.byteLength === 39) return resp\n if (type === messageEnum['requestBody'] || type === messageEnum['responseBody']) {\n resp.content = data.slice(39)\n return resp\n }\n\n let content = new TextDecoder().decode(data.slice(39))\n try {\n content = JSON.parse(content)\n } catch (err) {\n return null\n }\n\n resp.content = content\n return resp\n}\n\n\nexport const sendMessageEnum = {\n 'changeRequest': 11,\n 'changeResponse': 12,\n 'changeBreakPointRules': 21,\n}\n\n// type: 11/12\n// messageEdit\n// version 1 byte + type 1 byte + id 36 byte + header len 4 byte + header content bytes + body len 4 byte + [body content bytes]\nexport const buildMessageEdit = (messageType, flow) => {\n let header, body\n \n if (messageType === sendMessageEnum.changeRequest) {\n ({ body, ...header } = flow.request)\n } else if (messageType === sendMessageEnum.changeResponse) {\n ({ body, ...header } = flow.response)\n } else {\n throw new Error('invalid message type')\n }\n \n const bodyLen = (body && body.byteLength) ? body.byteLength : 0\n const headerBytes = new TextEncoder().encode(JSON.stringify(header))\n const len = 2 + 36 + 4 + headerBytes.byteLength + 4 + bodyLen\n const data = new ArrayBuffer(len)\n const view = new Uint8Array(data)\n view[0] = 1\n view[1] = messageType\n view.set(new TextEncoder().encode(flow.id), 2)\n view.set(headerBytes, 2 + 36 + 4)\n if (bodyLen) view.set(body, 2 + 36 + 4 + headerBytes.byteLength + 4)\n\n const view2 = new DataView(data)\n view2.setUint32(2 + 36, headerBytes.byteLength)\n view2.setUint32(2 + 36 + 4 + headerBytes.byteLength, bodyLen)\n\n return view\n}\n\n\n// type: 21\n// messageMeta\n// version 1 byte + type 1 byte + content left bytes\nexport const buildMessageMeta = (messageType, rules) => {\n if (messageType !== sendMessageEnum.changeBreakPointRules) {\n throw new Error('invalid message type')\n }\n\n const rulesBytes = new TextEncoder().encode(JSON.stringify(rules))\n const view = new Uint8Array(2 + rulesBytes.byteLength)\n view[0] = 1\n view[1] = messageType\n view.set(rulesBytes, 2)\n\n return view\n}\n","import React from 'react'\nimport Table from 'react-bootstrap/Table'\nimport Form from 'react-bootstrap/Form'\nimport Button from 'react-bootstrap/Button'\nimport './App.css'\n\nimport BreakPoint from './components/BreakPoint'\n\nimport { FlowManager } from './flow'\nimport { isTextResponse, getSize } from './utils'\nimport { parseMessage, sendMessageEnum, buildMessageEdit, buildMessageMeta } from './message'\n\nclass App extends React.Component {\n\n constructor(props) {\n super(props)\n\n this.flowMgr = new FlowManager()\n\n this.state = {\n flows: this.flowMgr.showList(),\n flow: null,\n\n flowTab: 'Headers', // Headers, Preview, Response\n }\n\n this.ws = null\n }\n\n componentDidMount() {\n this.initWs()\n }\n\n componentWillUnmount() {\n if (this.ws) {\n this.ws.close()\n }\n }\n\n initWs() {\n if (this.ws) return\n\n let host\n if (process.env.NODE_ENV === 'development') {\n host = 'localhost:9081'\n } else {\n host = new URL(document.URL).host\n }\n this.ws = new WebSocket(`ws://${host}/echo`)\n this.ws.binaryType = 'arraybuffer'\n this.ws.onopen = () => { console.log('OPEN') }\n this.ws.onclose = () => { console.log('CLOSE') }\n this.ws.onmessage = evt => {\n const msg = parseMessage(evt.data)\n if (!msg) {\n console.error('parse error:', evt.data)\n return\n }\n // console.log('msg:', msg)\n\n if (msg.type === 'request') {\n const flow = { id: msg.id, request: msg.content, waitIntercept: msg.waitIntercept }\n this.flowMgr.add(flow)\n this.setState({ flows: this.flowMgr.showList() })\n }\n else if (msg.type === 'requestBody') {\n const flow = this.flowMgr.get(msg.id)\n if (!flow) return\n flow.waitIntercept = msg.waitIntercept\n flow.request.body = msg.content\n this.setState({ flows: this.state.flows })\n }\n else if (msg.type === 'response') {\n const flow = this.flowMgr.get(msg.id)\n if (!flow) return\n flow.waitIntercept = msg.waitIntercept\n flow.response = msg.content\n this.setState({ flows: this.state.flows })\n }\n else if (msg.type === 'responseBody') {\n const flow = this.flowMgr.get(msg.id)\n if (!flow || !flow.response) return\n flow.waitIntercept = msg.waitIntercept\n flow.response.body = msg.content\n this.setState({ flows: this.state.flows })\n }\n }\n this.ws.onerror = evt => {\n console.log('ERROR:', evt)\n }\n }\n\n renderFlow() {\n const { flow, flowTab } = this.state\n if (!flow) return null\n\n const request = flow.request\n const response = flow.response || {}\n\n return (\n
\n
\n { this.setState({ flow: null }) }}>x\n { this.setState({ flowTab: 'Headers' }) }}>Headers\n { this.setState({ flowTab: 'Preview' }) }}>Preview\n { this.setState({ flowTab: 'Response' }) }}>Response\n {\n !flow.waitIntercept ? null :\n
\n \n \n
\n }\n
\n\n
\n {\n !(flowTab === 'Headers') ? null :\n
\n
\n

General

\n
\n

Request URL: {request.url}

\n

Request Method: {request.method}

\n

Status Code: {`${response.statusCode || '(pending)'}`}

\n
\n
\n\n {\n !(response.header) ? null :\n
\n

Response Headers

\n
\n {\n Object.keys(response.header).map(key => {\n return (\n

{key}: {response.header[key].join(' ')}

\n )\n })\n }\n
\n
\n }\n\n
\n

Request Headers

\n
\n {\n !(request.header) ? null :\n Object.keys(request.header).map(key => {\n return (\n

{key}: {request.header[key].join(' ')}

\n )\n })\n }\n
\n
\n\n {\n !(request.body && request.body.byteLength) ? null :\n
\n

Request Body

\n
\n

\n {\n !(isTextResponse(request)) ? \"Not text\" :\n new TextDecoder().decode(request.body)\n }\n

\n
\n
\n }\n\n
\n }\n\n {\n !(flowTab === 'Response') ? null :\n !(response.body && response.body.byteLength) ?
No response
:\n !(isTextResponse(response)) ?
Not text response
:\n
\n {new TextDecoder().decode(response.body)}\n
\n }\n
\n\n
\n )\n }\n \n render() {\n const { flows } = this.state\n return (\n
\n
\n
\n
\n {\n const value = e.target.value\n this.flowMgr.changeFilterLazy(value, () => {\n this.setState({ flows: this.flowMgr.showList() })\n })\n }}\n >\n \n
\n\n {\n const msg = buildMessageMeta(sendMessageEnum.changeBreakPointRules, rules)\n this.ws.send(msg)\n }} />\n
\n\n \n \n \n \n \n \n \n \n \n \n \n \n {\n flows.map(f => {\n const url = f.request.url\n const u = new URL(url)\n let host = u.host\n if (host.length > 35) host = host.slice(0, 35) + '...'\n let path = u.pathname + u.search\n if (path.length > 65) path = path.slice(0, 65) + '...'\n\n const request = f.request\n const response = f.response || {}\n\n const classNames = []\n if (this.state.flow && this.state.flow.id === f.id) classNames.push('tr-selected')\n if (f.waitIntercept) classNames.push('tr-wait-intercept')\n\n return (\n {\n this.setState({ flow: f })\n }}\n >\n \n \n \n \n \n \n \n )\n })\n }\n \n
NoHostPathMethodStatusSize
{f.no}{host}{path}{request.method}{response.statusCode || '(pending)'}{getSize(response)}
\n\n {this.renderFlow()}\n
\n )\n }\n}\n\nexport default App\n","const reportWebVitals = onPerfEntry => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry)\n getFID(onPerfEntry)\n getFCP(onPerfEntry)\n getLCP(onPerfEntry)\n getTTFB(onPerfEntry)\n })\n }\n}\n\nexport default reportWebVitals\n","import React from 'react'\nimport ReactDOM from 'react-dom'\nimport 'bootstrap/dist/css/bootstrap.min.css'\nimport App from './App'\nimport reportWebVitals from './reportWebVitals'\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root')\n)\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals()\n"],"sourceRoot":""} \ No newline at end of file diff --git a/addon/web/client/build/static/js/main.c16ab123.chunk.js b/addon/web/client/build/static/js/main.c16ab123.chunk.js deleted file mode 100644 index c5156a5..0000000 --- a/addon/web/client/build/static/js/main.c16ab123.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -(this.webpackJsonpclient=this.webpackJsonpclient||[]).push([[0],{30:function(e,t,n){},35:function(e,t,n){"use strict";n.r(t);var s=n(0),r=n.n(s),i=n(9),c=n.n(i),a=(n(29),n(12)),l=n(13),o=n(18),d=n(17),h=n(24),j=n(7),u=n(10),b=(n(30),n(11)),f=n(14),O=n(16),x=n(19),p=n(15),w=n(1),v=function(e){Object(o.a)(n,e);var t=Object(d.a)(n);function n(e){var s;return Object(a.a)(this,n),(s=t.call(this,e)).state={show:!1,rule:{method:"ALL",url:"",action:"1"}},s.handleClose=s.handleClose.bind(Object(f.a)(s)),s.handleShow=s.handleShow.bind(Object(f.a)(s)),s.handleSave=s.handleSave.bind(Object(f.a)(s)),s}return Object(l.a)(n,[{key:"handleClose",value:function(){this.setState({show:!1})}},{key:"handleShow",value:function(){this.setState({show:!0})}},{key:"handleSave",value:function(){var e=this.state.rule,t=[];e.url&&t.push({method:"ALL"===e.method?"":e.method,url:e.url,action:parseInt(e.action)}),this.props.onSave(t),this.handleClose()}},{key:"render",value:function(){var e=this,t=this.state.rule;return Object(w.jsxs)("div",{children:[Object(w.jsx)(u.a,{size:"sm",onClick:this.handleShow,children:"BreakPoint"}),Object(w.jsxs)(O.a,{show:this.state.show,onHide:this.handleClose,children:[Object(w.jsx)(O.a.Header,{closeButton:!0,children:Object(w.jsx)(O.a.Title,{children:"Set BreakPoint"})}),Object(w.jsx)(O.a.Body,{children:Object(w.jsxs)(j.a,{children:[Object(w.jsxs)(j.a.Group,{as:x.a,children:[Object(w.jsx)(j.a.Label,{column:!0,sm:2,children:"Method"}),Object(w.jsx)(p.a,{sm:10,children:Object(w.jsxs)(j.a.Control,{as:"select",value:t.method,onChange:function(n){e.setState({rule:Object(b.a)(Object(b.a)({},t),{},{method:n.target.value})})},children:[Object(w.jsx)("option",{children:"ALL"}),Object(w.jsx)("option",{children:"GET"}),Object(w.jsx)("option",{children:"POST"}),Object(w.jsx)("option",{children:"PUT"}),Object(w.jsx)("option",{children:"DELETE"})]})})]}),Object(w.jsxs)(j.a.Group,{as:x.a,children:[Object(w.jsx)(j.a.Label,{column:!0,sm:2,children:"URL"}),Object(w.jsx)(p.a,{sm:10,children:Object(w.jsx)(j.a.Control,{value:t.url,onChange:function(n){e.setState({rule:Object(b.a)(Object(b.a)({},t),{},{url:n.target.value})})}})})]}),Object(w.jsxs)(j.a.Group,{as:x.a,children:[Object(w.jsx)(j.a.Label,{column:!0,sm:2,children:"Action"}),Object(w.jsx)(p.a,{sm:10,children:Object(w.jsxs)(j.a.Control,{as:"select",value:t.action,onChange:function(n){e.setState({rule:Object(b.a)(Object(b.a)({},t),{},{action:n.target.value})})},children:[Object(w.jsx)("option",{value:"1",children:"Request"}),Object(w.jsx)("option",{value:"2",children:"Response"}),Object(w.jsx)("option",{value:"3",children:"Both"})]})})]})]})}),Object(w.jsxs)(O.a.Footer,{children:[Object(w.jsx)(u.a,{variant:"secondary",onClick:this.handleClose,children:"Close"}),Object(w.jsx)(u.a,{variant:"primary",onClick:this.handleSave,children:"Save Changes"})]})]})]})}}]),n}(r.a.Component),m=function(){function e(){Object(a.a)(this,e),this.items=[],this._map=new Map,this.filterText="",this.filterTimer=null,this.num=0,this.max=1e3}return Object(l.a)(e,[{key:"showList",value:function(){var e=this;return this.filterText?this.items.filter((function(t){return t.request.url.includes(e.filterText)})):this.items}},{key:"add",value:function(e){if(e.no=++this.num,this.items.push(e),this._map.set(e.id,e),this.items.length>this.max){var t=this.items.shift();this._map.delete(t.id)}}},{key:"get",value:function(e){return this._map.get(e)}},{key:"changeFilter",value:function(e){this.filterText=e}},{key:"changeFilterLazy",value:function(e,t){var n=this;this.filterTimer&&(clearTimeout(this.filterTimer),this.filterTimer=null),this.filterTimer=setTimeout((function(){n.filterText=e,t()}),300)}},{key:"clear",value:function(){this.items=[],this._map=new Map}}]),e}(),y=function(e){return!!e&&(!!e.header&&(!!e.header["Content-Type"]&&/text|javascript|json/.test(e.header["Content-Type"].join(""))))},g=function(e){return e&&e.header?(e.header["Content-Length"]?t=parseInt(e.header["Content-Length"][0]):e&&e.body&&(t=e.body.byteLength),t?isNaN(t)||t<=0?"0":t<1024?"".concat(t," B"):t<1048576?"".concat((t/1024).toFixed(2)," KB"):"".concat((t/1048576).toFixed(2)," MB"):"0"):"0";var t},k=n(23),C={request:1,requestBody:2,response:3,responseBody:4},S=Object.keys(C).map((function(e){return C[e]})),L=Object.keys(C).reduce((function(e,t){return e[C[t]]=t,e}),{}),T=11,N=12,M=21,R=function(e){Object(o.a)(n,e);var t=Object(d.a)(n);function n(e){var s;return Object(a.a)(this,n),(s=t.call(this,e)).flowMgr=new m,s.state={flows:s.flowMgr.showList(),flow:null,flowTab:"Headers"},s.ws=null,s}return Object(l.a)(n,[{key:"componentDidMount",value:function(){this.initWs()}},{key:"componentWillUnmount",value:function(){this.ws&&this.ws.close()}},{key:"initWs",value:function(){var e,t=this;this.ws||(e=new URL(document.URL).host,this.ws=new WebSocket("ws://".concat(e,"/echo")),this.ws.binaryType="arraybuffer",this.ws.onopen=function(){console.log("OPEN")},this.ws.onclose=function(){console.log("CLOSE")},this.ws.onmessage=function(e){var n=function(e){if(e.byteLength<39)return null;var t=new Int8Array(e.slice(0,39));if(1!==t[0])return null;var n=t[1];if(!S.includes(n))return null;var s=(new TextDecoder).decode(e.slice(2,38)),r=1===t[38],i={type:L[n],id:s,waitIntercept:r};if(39===e.byteLength)return i;if(n===C.requestBody||n===C.responseBody)return i.content=e.slice(39),i;var c=(new TextDecoder).decode(e.slice(39));try{c=JSON.parse(c)}catch(a){return null}return i.content=c,i}(e.data);if(n){if("request"===n.type){var s={id:n.id,request:n.content,waitIntercept:n.waitIntercept};t.flowMgr.add(s),t.setState({flows:t.flowMgr.showList()})}else if("requestBody"===n.type){var r=t.flowMgr.get(n.id);if(!r)return;r.request.body=n.content,t.setState({flows:t.state.flows})}else if("response"===n.type){var i=t.flowMgr.get(n.id);if(!i)return;i.waitIntercept=n.waitIntercept,i.response=n.content,t.setState({flows:t.state.flows})}else if("responseBody"===n.type){var c=t.flowMgr.get(n.id);if(!c||!c.response)return;c.waitIntercept=n.waitIntercept,c.response.body=n.content,t.setState({flows:t.state.flows})}}else console.error("parse error:",e.data)},this.ws.onerror=function(e){console.log("ERROR:",e)})}},{key:"renderFlow",value:function(){var e=this,t=this.state,n=t.flow,s=t.flowTab;if(!n)return null;var r=n.request,i=n.response||{};return Object(w.jsxs)("div",{className:"flow-detail",children:[Object(w.jsxs)("div",{className:"header-tabs",children:[Object(w.jsx)("span",{onClick:function(){e.setState({flow:null})},children:"x"}),Object(w.jsx)("span",{className:"Headers"===s?"selected":null,onClick:function(){e.setState({flowTab:"Headers"})},children:"Headers"}),Object(w.jsx)("span",{className:"Preview"===s?"selected":null,onClick:function(){e.setState({flowTab:"Preview"})},children:"Preview"}),Object(w.jsx)("span",{className:"Response"===s?"selected":null,onClick:function(){e.setState({flowTab:"Response"})},children:"Response"}),n.waitIntercept?Object(w.jsxs)("div",{className:"flow-wait-area",children:[Object(w.jsx)(u.a,{size:"sm",onClick:function(){var t=function(e,t){var n,s;if(e===T){var r=t.request;s=r.body,n=Object(k.a)(r,["body"])}else{if(e!==N)throw new Error("invalid message type");var i=t.response;s=i.body,n=Object(k.a)(i,["body"])}var c=(new TextEncoder).encode(JSON.stringify(n)),a=42+c.byteLength+4+s.byteLength,l=new ArrayBuffer(a),o=new Uint8Array(l);o[0]=1,o[1]=e,o.set((new TextEncoder).encode(t.id),3),o.set(c,42),o.set(s,42+c.byteLength+4);var d=new DataView(l);return d.setUint32(38,c.byteLength),d.setUint32(42+c.byteLength,s.byteLength),o}(T,n);e.ws.send(t),n.waitIntercept=!1,e.setState({flows:e.state.flows})},children:"Continue"}),Object(w.jsx)(u.a,{size:"sm",children:"Drop"})]}):null]}),Object(w.jsxs)("div",{style:{padding:"20px"},children:["Headers"!==s?null:Object(w.jsxs)("div",{children:[Object(w.jsxs)("div",{className:"header-block",children:[Object(w.jsx)("p",{children:"General"}),Object(w.jsxs)("div",{className:"header-block-content",children:[Object(w.jsxs)("p",{children:["Request URL: ",r.url]}),Object(w.jsxs)("p",{children:["Request Method: ",r.method]}),Object(w.jsxs)("p",{children:["Status Code: ","".concat(i.statusCode||"(pending)")]})]})]}),i.header?Object(w.jsxs)("div",{className:"header-block",children:[Object(w.jsx)("p",{children:"Response Headers"}),Object(w.jsx)("div",{className:"header-block-content",children:Object.keys(i.header).map((function(e){return Object(w.jsxs)("p",{children:[e,": ",i.header[e].join(" ")]},e)}))})]}):null,Object(w.jsxs)("div",{className:"header-block",children:[Object(w.jsx)("p",{children:"Request Headers"}),Object(w.jsx)("div",{className:"header-block-content",children:r.header?Object.keys(r.header).map((function(e){return Object(w.jsxs)("p",{children:[e,": ",r.header[e].join(" ")]},e)})):null})]}),r.body&&r.body.byteLength?Object(w.jsxs)("div",{className:"header-block",children:[Object(w.jsx)("p",{children:"Request Body"}),Object(w.jsx)("div",{className:"header-block-content",children:Object(w.jsx)("p",{children:y(r)?(new TextDecoder).decode(r.body):"Not text"})})]}):null]}),"Response"!==s?null:i.body&&i.body.byteLength?y(i)?Object(w.jsx)("div",{children:(new TextDecoder).decode(i.body)}):Object(w.jsx)("div",{children:"Not text response"}):Object(w.jsx)("div",{children:"No response"})]})]})}},{key:"render",value:function(){var e=this,t=this.state.flows;return Object(w.jsxs)("div",{className:"main-table-wrap",children:[Object(w.jsxs)("div",{className:"top-control",children:[Object(w.jsx)("div",{children:Object(w.jsx)(u.a,{size:"sm",onClick:function(){e.flowMgr.clear(),e.setState({flows:e.flowMgr.showList(),flow:null})},children:"Clear"})}),Object(w.jsx)("div",{children:Object(w.jsx)(j.a.Control,{size:"sm",placeholder:"Filter",onChange:function(t){var n=t.target.value;e.flowMgr.changeFilterLazy(n,(function(){e.setState({flows:e.flowMgr.showList()})}))}})}),Object(w.jsx)(v,{onSave:function(t){var n=function(e,t){if(e!==M)throw new Error("invalid message type");var n=(new TextEncoder).encode(JSON.stringify(t)),s=new Uint8Array(2+n.byteLength);return s[0]=1,s[1]=e,s.set(n,2),s}(M,t);e.ws.send(n)}})]}),Object(w.jsxs)(h.a,{striped:!0,bordered:!0,size:"sm",children:[Object(w.jsx)("thead",{children:Object(w.jsxs)("tr",{children:[Object(w.jsx)("th",{children:"No"}),Object(w.jsx)("th",{children:"Host"}),Object(w.jsx)("th",{children:"Path"}),Object(w.jsx)("th",{children:"Method"}),Object(w.jsx)("th",{children:"Status"}),Object(w.jsx)("th",{children:"Size"})]})}),Object(w.jsx)("tbody",{children:t.map((function(t){var n=t.request.url,s=new URL(n),r=s.host;r.length>35&&(r=r.slice(0,35)+"...");var i=s.pathname+s.search;i.length>65&&(i=i.slice(0,65)+"...");var c=t.request,a=t.response||{},l=[];return e.state.flow&&e.state.flow.id===t.id&&l.push("tr-selected"),t.waitIntercept&&l.push("tr-wait-intercept"),Object(w.jsxs)("tr",{className:l.length?l.join(" "):null,onClick:function(){e.setState({flow:t})},children:[Object(w.jsx)("td",{children:t.no}),Object(w.jsx)("td",{children:r}),Object(w.jsx)("td",{children:i}),Object(w.jsx)("td",{children:c.method}),Object(w.jsx)("td",{children:a.statusCode||"(pending)"}),Object(w.jsx)("td",{children:g(a)})]},t.id)}))})]}),this.renderFlow()]})}}]),n}(r.a.Component),B=function(e){e&&e instanceof Function&&n.e(3).then(n.bind(null,37)).then((function(t){var n=t.getCLS,s=t.getFID,r=t.getFCP,i=t.getLCP,c=t.getTTFB;n(e),s(e),r(e),i(e),c(e)}))};c.a.render(Object(w.jsx)(r.a.StrictMode,{children:Object(w.jsx)(R,{})}),document.getElementById("root")),B()}},[[35,1,2]]]); -//# sourceMappingURL=main.c16ab123.chunk.js.map \ No newline at end of file diff --git a/addon/web/client/build/static/js/main.c16ab123.chunk.js.map b/addon/web/client/build/static/js/main.c16ab123.chunk.js.map deleted file mode 100644 index 6801f3f..0000000 --- a/addon/web/client/build/static/js/main.c16ab123.chunk.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["components/BreakPoint.js","flow.js","utils.js","message.js","App.js","reportWebVitals.js","index.js"],"names":["BreakPoint","props","state","show","rule","method","url","action","handleClose","bind","handleShow","handleSave","this","setState","rules","push","parseInt","onSave","Button","size","onClick","Modal","onHide","Header","closeButton","Title","Body","Form","Group","as","Row","Label","column","sm","Col","Control","value","onChange","e","target","Footer","variant","React","Component","FlowManager","items","_map","Map","filterText","filterTimer","num","max","filter","item","request","includes","no","set","id","length","oldest","shift","delete","get","text","callback","clearTimeout","setTimeout","isTextResponse","response","header","test","join","getSize","len","body","byteLength","isNaN","toFixed","messageEnum","allMessageBytes","Object","keys","map","k","messageByteMap","reduce","m","sendMessageEnum","App","flowMgr","flows","showList","flow","flowTab","ws","initWs","close","host","URL","document","WebSocket","binaryType","onopen","console","log","onclose","onmessage","evt","msg","data","meta","Int8Array","slice","type","TextDecoder","decode","waitIntercept","resp","content","JSON","parse","err","parseMessage","add","error","onerror","className","messageType","Error","headerBytes","TextEncoder","encode","stringify","ArrayBuffer","view","Uint8Array","view2","DataView","setUint32","buildMessageEdit","send","style","padding","statusCode","key","clear","placeholder","changeFilterLazy","rulesBytes","buildMessageMeta","Table","striped","bordered","f","u","path","pathname","search","classNames","renderFlow","reportWebVitals","onPerfEntry","Function","then","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","StrictMode","getElementById"],"mappings":"uRA4GeA,E,kDApGb,WAAYC,GAAQ,IAAD,8BACjB,cAAMA,IAEDC,MAAQ,CACXC,MAAM,EAENC,KAAM,CACJC,OAAQ,MACRC,IAAK,GACLC,OAAQ,MAIZ,EAAKC,YAAc,EAAKA,YAAYC,KAAjB,gBACnB,EAAKC,WAAa,EAAKA,WAAWD,KAAhB,gBAClB,EAAKE,WAAa,EAAKA,WAAWF,KAAhB,gBAfD,E,+CAkBnB,WACEG,KAAKC,SAAS,CAAEV,MAAM,M,wBAGxB,WACES,KAAKC,SAAS,CAAEV,MAAM,M,wBAGxB,WAAc,IACJC,EAASQ,KAAKV,MAAdE,KACFU,EAAQ,GACVV,EAAKE,KACPQ,EAAMC,KAAK,CACTV,OAAwB,QAAhBD,EAAKC,OAAmB,GAAKD,EAAKC,OAC1CC,IAAKF,EAAKE,IACVC,OAAQS,SAASZ,EAAKG,UAI1BK,KAAKX,MAAMgB,OAAOH,GAClBF,KAAKJ,gB,oBAGP,WAAU,IAAD,OACCJ,EAASQ,KAAKV,MAAdE,KAER,OACE,gCACE,cAACc,EAAA,EAAD,CAAQC,KAAK,KAAKC,QAASR,KAAKF,WAAhC,wBAEA,eAACW,EAAA,EAAD,CAAOlB,KAAMS,KAAKV,MAAMC,KAAMmB,OAAQV,KAAKJ,YAA3C,UACE,cAACa,EAAA,EAAME,OAAP,CAAcC,aAAW,EAAzB,SACE,cAACH,EAAA,EAAMI,MAAP,+BAGF,cAACJ,EAAA,EAAMK,KAAP,UACE,eAACC,EAAA,EAAD,WACE,eAACA,EAAA,EAAKC,MAAN,CAAYC,GAAIC,IAAhB,UACE,cAACH,EAAA,EAAKI,MAAN,CAAYC,QAAM,EAACC,GAAI,EAAvB,oBACA,cAACC,EAAA,EAAD,CAAKD,GAAI,GAAT,SACE,eAACN,EAAA,EAAKQ,QAAN,CAAcN,GAAG,SAASO,MAAOhC,EA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AI,SAAAuE,GACR,IAAMpJ,EAAMoJ,EAAEpG,QAAQhD,IAChBqJ,EAAI,IAAIxD,IAAI7F,GACd4F,EAAOyD,EAAEzD,KACTA,EAAKvC,OAAS,KAAIuC,EAAOA,EAAKe,MAAM,EAAG,IAAM,OACjD,IAAI2C,EAAOD,EAAEE,SAAWF,EAAEG,OACtBF,EAAKjG,OAAS,KAAIiG,EAAOA,EAAK3C,MAAM,EAAG,IAAM,OAEjD,IAAM3D,EAAUoG,EAAEpG,QACZe,EAAWqF,EAAErF,UAAY,GAEzB0F,EAAa,GAInB,OAHI,EAAK7J,MAAM2F,MAAQ,EAAK3F,MAAM2F,KAAKnC,KAAOgG,EAAEhG,IAAIqG,EAAWhJ,KAAK,eAChE2I,EAAErC,eAAe0C,EAAWhJ,KAAK,qBAGnC,qBAAIgH,UAAWgC,EAAWpG,OAASoG,EAAWvF,KAAK,KAAO,KACxDpD,QAAS,WACP,EAAKP,SAAS,CAAEgF,KAAM6D,KAF1B,UAKE,6BAAKA,EAAElG,KACP,6BAAK0C,IACL,6BAAK0D,IACL,6BAAKtG,EAAQjD,SACb,6BAAKgE,EAAS2E,YAAc,cAC5B,6BAAKvE,EAAQJ,OAVsDqF,EAAEhG,YAkBhF9C,KAAKoJ,oB,GAjQItH,IAAMC,WCATsH,EAZS,SAAAC,GAClBA,GAAeA,aAAuBC,UACxC,6BAAqBC,MAAK,YAAkD,IAA/CC,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QAC3DJ,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAON,GACPO,EAAQP,OCDdQ,IAASC,OACP,cAAC,IAAMC,WAAP,UACE,cAAC,EAAD,MAEFxE,SAASyE,eAAe,SAM1BZ,M","file":"static/js/main.c16ab123.chunk.js","sourcesContent":["import React from 'react'\nimport Button from 'react-bootstrap/Button'\nimport Modal from 'react-bootstrap/Modal'\nimport Form from 'react-bootstrap/Form'\nimport Row from 'react-bootstrap/Row'\nimport Col from 'react-bootstrap/Col'\n\nclass BreakPoint extends React.Component {\n constructor(props) {\n super(props)\n\n this.state = {\n show: false,\n\n rule: {\n method: 'ALL',\n url: '',\n action: '1',\n }\n }\n\n this.handleClose = this.handleClose.bind(this)\n this.handleShow = this.handleShow.bind(this)\n this.handleSave = this.handleSave.bind(this)\n }\n\n handleClose() {\n this.setState({ show: false })\n }\n\n handleShow() {\n this.setState({ show: true })\n }\n\n handleSave() {\n const { rule } = this.state\n const rules = []\n if (rule.url) {\n rules.push({\n method: rule.method === 'ALL' ? '' : rule.method,\n url: rule.url,\n action: parseInt(rule.action)\n })\n }\n\n this.props.onSave(rules)\n this.handleClose()\n }\n\n render() {\n const { rule } = this.state\n\n return (\n
\n \n\n \n \n Set BreakPoint\n \n\n \n
\n \n Method\n \n { this.setState({ rule: { ...rule, method: e.target.value } }) }}>\n \n \n \n \n \n \n \n \n\n \n URL\n { this.setState({ rule: { ...rule, url: e.target.value } }) }} />\n \n\n \n Action\n \n { this.setState({ rule: { ...rule, action: e.target.value } }) }}>\n \n \n \n \n \n \n
\n
\n\n \n \n \n \n
\n
\n )\n }\n}\n\nexport default BreakPoint\n","export class FlowManager {\n constructor() {\n this.items = []\n this._map = new Map()\n this.filterText = ''\n this.filterTimer = null\n this.num = 0\n\n this.max = 1000\n }\n\n showList() {\n if (!this.filterText) return this.items\n return this.items.filter(item => {\n return item.request.url.includes(this.filterText)\n })\n }\n\n add(item) {\n item.no = ++this.num\n this.items.push(item)\n this._map.set(item.id, item)\n \n if (this.items.length > this.max) {\n const oldest = this.items.shift()\n this._map.delete(oldest.id)\n }\n }\n\n get(id) {\n return this._map.get(id)\n }\n\n changeFilter(text) {\n this.filterText = text\n }\n\n changeFilterLazy(text, callback) {\n if (this.filterTimer) {\n clearTimeout(this.filterTimer)\n this.filterTimer = null\n }\n\n this.filterTimer = setTimeout(() => {\n this.filterText = text\n callback()\n }, 300)\n }\n\n clear() {\n this.items = []\n this._map = new Map()\n }\n}\n","export const isTextResponse = response => {\n if (!response) return false\n if (!response.header) return false\n if (!response.header['Content-Type']) return false\n\n return /text|javascript|json/.test(response.header['Content-Type'].join(''))\n}\n\nexport const getSize = response => {\n if (!response) return '0'\n if (!response.header) return '0'\n\n let len\n if (response.header['Content-Length']) {\n len = parseInt(response.header['Content-Length'][0])\n } else if (response && response.body) {\n len = response.body.byteLength\n }\n if (!len) return '0'\n if (isNaN(len)) return '0'\n if (len <= 0) return '0'\n \n if (len < 1024) return `${len} B`\n if (len < 1024*1024) return `${(len/1024).toFixed(2)} KB`\n return `${(len/(1024*1024)).toFixed(2)} MB`\n}\n","const messageEnum = {\n 'request': 1,\n 'requestBody': 2,\n 'response': 3,\n 'responseBody': 4,\n}\n\nconst allMessageBytes = Object.keys(messageEnum).map(k => messageEnum[k])\n\nconst messageByteMap = Object.keys(messageEnum).reduce((m, k) => {\n m[messageEnum[k]] = k\n return m\n}, {})\n\n\n// type: 1/2/3/4\n// messageFlow\n// version 1 byte + type 1 byte + id 36 byte + waitIntercept 1 byte + content left bytes\nexport const parseMessage = data => {\n if (data.byteLength < 39) return null\n const meta = new Int8Array(data.slice(0, 39))\n const version = meta[0]\n if (version !== 1) return null\n const type = meta[1]\n if (!allMessageBytes.includes(type)) return null\n const id = new TextDecoder().decode(data.slice(2, 38))\n const waitIntercept = meta[38] === 1\n\n const resp = {\n type: messageByteMap[type],\n id,\n waitIntercept,\n }\n if (data.byteLength === 39) return resp\n if (type === messageEnum['requestBody'] || type === messageEnum['responseBody']) {\n resp.content = data.slice(39)\n return resp\n }\n\n let content = new TextDecoder().decode(data.slice(39))\n try {\n content = JSON.parse(content)\n } catch (err) {\n return null\n }\n\n resp.content = content\n return resp\n}\n\n\nexport const sendMessageEnum = {\n 'changeRequest': 11,\n 'changeResponse': 12,\n 'changeBreakPointRules': 21,\n}\n\n// type: 11/12\n// messageEdit\n// version 1 byte + type 1 byte + id 36 byte + header len 4 byte + header content bytes + body len 4 byte + [body content bytes]\nexport const buildMessageEdit = (messageType, flow) => {\n let header, body\n \n if (messageType === sendMessageEnum.changeRequest) {\n ({ body, ...header } = flow.request)\n } else if (messageType === sendMessageEnum.changeResponse) {\n ({ body, ...header } = flow.response)\n } else {\n throw new Error('invalid message type')\n }\n \n const headerBytes = new TextEncoder().encode(JSON.stringify(header))\n const len = 2 + 36 + 4 + headerBytes.byteLength + 4 + body.byteLength\n const data = new ArrayBuffer(len)\n const view = new Uint8Array(data)\n view[0] = 1\n view[1] = messageType\n view.set(new TextEncoder().encode(flow.id), 3)\n view.set(headerBytes, 2 + 36 + 4)\n view.set(body, 2 + 36 + 4 + headerBytes.byteLength + 4)\n\n const view2 = new DataView(data)\n view2.setUint32(2 + 36, headerBytes.byteLength)\n view2.setUint32(2 + 36 + 4 + headerBytes.byteLength, body.byteLength)\n\n return view\n}\n\n\n// type: 21\n// messageMeta\n// version 1 byte + type 1 byte + content left bytes\nexport const buildMessageMeta = (messageType, rules) => {\n if (messageType !== sendMessageEnum.changeBreakPointRules) {\n throw new Error('invalid message type')\n }\n\n const rulesBytes = new TextEncoder().encode(JSON.stringify(rules))\n const view = new Uint8Array(2 + rulesBytes.byteLength)\n view[0] = 1\n view[1] = messageType\n view.set(rulesBytes, 2)\n\n return view\n}\n","import React from 'react'\nimport Table from 'react-bootstrap/Table'\nimport Form from 'react-bootstrap/Form'\nimport Button from 'react-bootstrap/Button'\nimport './App.css'\n\nimport BreakPoint from './components/BreakPoint'\n\nimport { FlowManager } from './flow'\nimport { isTextResponse, getSize } from './utils'\nimport { parseMessage, sendMessageEnum, buildMessageEdit, buildMessageMeta } from './message'\n\nclass App extends React.Component {\n\n constructor(props) {\n super(props)\n\n this.flowMgr = new FlowManager()\n\n this.state = {\n flows: this.flowMgr.showList(),\n flow: null,\n\n flowTab: 'Headers', // Headers, Preview, Response\n }\n\n this.ws = null\n }\n\n componentDidMount() {\n this.initWs()\n }\n\n componentWillUnmount() {\n if (this.ws) {\n this.ws.close()\n }\n }\n\n initWs() {\n if (this.ws) return\n\n let host\n if (process.env.NODE_ENV === 'development') {\n host = 'localhost:9081'\n } else {\n host = new URL(document.URL).host\n }\n this.ws = new WebSocket(`ws://${host}/echo`)\n this.ws.binaryType = 'arraybuffer'\n this.ws.onopen = () => { console.log('OPEN') }\n this.ws.onclose = () => { console.log('CLOSE') }\n this.ws.onmessage = evt => {\n const msg = parseMessage(evt.data)\n if (!msg) {\n console.error('parse error:', evt.data)\n return\n }\n // console.log('msg:', msg)\n\n if (msg.type === 'request') {\n const flow = { id: msg.id, request: msg.content, waitIntercept: msg.waitIntercept }\n this.flowMgr.add(flow)\n this.setState({ flows: this.flowMgr.showList() })\n }\n else if (msg.type === 'requestBody') {\n const flow = this.flowMgr.get(msg.id)\n if (!flow) return\n flow.request.body = msg.content\n this.setState({ flows: this.state.flows })\n }\n else if (msg.type === 'response') {\n const flow = this.flowMgr.get(msg.id)\n if (!flow) return\n flow.waitIntercept = msg.waitIntercept\n flow.response = msg.content\n this.setState({ flows: this.state.flows })\n }\n else if (msg.type === 'responseBody') {\n const flow = this.flowMgr.get(msg.id)\n if (!flow || !flow.response) return\n flow.waitIntercept = msg.waitIntercept\n flow.response.body = msg.content\n this.setState({ flows: this.state.flows })\n }\n }\n this.ws.onerror = evt => {\n console.log('ERROR:', evt)\n }\n }\n\n renderFlow() {\n const { flow, flowTab } = this.state\n if (!flow) return null\n\n const request = flow.request\n const response = flow.response || {}\n\n return (\n
\n
\n { this.setState({ flow: null }) }}>x\n { this.setState({ flowTab: 'Headers' }) }}>Headers\n { this.setState({ flowTab: 'Preview' }) }}>Preview\n { this.setState({ flowTab: 'Response' }) }}>Response\n {\n !flow.waitIntercept ? null :\n
\n \n \n
\n }\n
\n\n
\n {\n !(flowTab === 'Headers') ? null :\n
\n
\n

General

\n
\n

Request URL: {request.url}

\n

Request Method: {request.method}

\n

Status Code: {`${response.statusCode || '(pending)'}`}

\n
\n
\n\n {\n !(response.header) ? null :\n
\n

Response Headers

\n
\n {\n Object.keys(response.header).map(key => {\n return (\n

{key}: {response.header[key].join(' ')}

\n )\n })\n }\n
\n
\n }\n\n
\n

Request Headers

\n
\n {\n !(request.header) ? null :\n Object.keys(request.header).map(key => {\n return (\n

{key}: {request.header[key].join(' ')}

\n )\n })\n }\n
\n
\n\n {\n !(request.body && request.body.byteLength) ? null :\n
\n

Request Body

\n
\n

\n {\n !(isTextResponse(request)) ? \"Not text\" :\n new TextDecoder().decode(request.body)\n }\n

\n
\n
\n }\n\n
\n }\n\n {\n !(flowTab === 'Response') ? null :\n !(response.body && response.body.byteLength) ?
No response
:\n !(isTextResponse(response)) ?
Not text response
:\n
\n {new TextDecoder().decode(response.body)}\n
\n }\n
\n\n
\n )\n }\n \n render() {\n const { flows } = this.state\n return (\n
\n
\n
\n
\n {\n const value = e.target.value\n this.flowMgr.changeFilterLazy(value, () => {\n this.setState({ flows: this.flowMgr.showList() })\n })\n }}\n >\n \n
\n\n {\n const msg = buildMessageMeta(sendMessageEnum.changeBreakPointRules, rules)\n this.ws.send(msg)\n }} />\n
\n\n \n \n \n \n \n \n \n \n \n \n \n \n {\n flows.map(f => {\n const url = f.request.url\n const u = new URL(url)\n let host = u.host\n if (host.length > 35) host = host.slice(0, 35) + '...'\n let path = u.pathname + u.search\n if (path.length > 65) path = path.slice(0, 65) + '...'\n\n const request = f.request\n const response = f.response || {}\n\n const classNames = []\n if (this.state.flow && this.state.flow.id === f.id) classNames.push('tr-selected')\n if (f.waitIntercept) classNames.push('tr-wait-intercept')\n\n return (\n {\n this.setState({ flow: f })\n }}\n >\n \n \n \n \n \n \n \n )\n })\n }\n \n
NoHostPathMethodStatusSize
{f.no}{host}{path}{request.method}{response.statusCode || '(pending)'}{getSize(response)}
\n\n {this.renderFlow()}\n
\n )\n }\n}\n\nexport default App\n","const reportWebVitals = onPerfEntry => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry)\n getFID(onPerfEntry)\n getFCP(onPerfEntry)\n getLCP(onPerfEntry)\n getTTFB(onPerfEntry)\n })\n }\n}\n\nexport default reportWebVitals\n","import React from 'react'\nimport ReactDOM from 'react-dom'\nimport 'bootstrap/dist/css/bootstrap.min.css'\nimport App from './App'\nimport reportWebVitals from './reportWebVitals'\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root')\n)\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals()\n"],"sourceRoot":""} \ No newline at end of file