diff options
author | Clemens <cle1000.cb@gmail.com> | 2016-07-28 17:28:05 +0200 |
---|---|---|
committer | Clemens <cle1000.cb@gmail.com> | 2016-07-28 17:28:05 +0200 |
commit | 2807329fb2ce576ae529afd991e3da3d5f81d637 (patch) | |
tree | 704da65847e8f7c1c37adec2d6a58bd90d303733 /web | |
parent | ad5bebeda0f1da890d8ed94b6096515e03f44a25 (diff) | |
download | mitmproxy-2807329fb2ce576ae529afd991e3da3d5f81d637.tar.gz mitmproxy-2807329fb2ce576ae529afd991e3da3d5f81d637.tar.bz2 mitmproxy-2807329fb2ce576ae529afd991e3da3d5f81d637.zip |
add image to mitmproxy.contentview.image
Diffstat (limited to 'web')
-rw-r--r-- | web/src/js/components/ContentView/ContentViews.jsx | 10 | ||||
-rw-r--r-- | web/src/js/components/ContentView/ViewSelector.jsx | 4 | ||||
-rw-r--r-- | web/src/js/ducks/ui/flow.js | 2 |
3 files changed, 11 insertions, 5 deletions
diff --git a/web/src/js/components/ContentView/ContentViews.jsx b/web/src/js/components/ContentView/ContentViews.jsx index 89e97267..a1bee54e 100644 --- a/web/src/js/components/ContentView/ContentViews.jsx +++ b/web/src/js/components/ContentView/ContentViews.jsx @@ -39,8 +39,11 @@ function ViewAuto({ message, flow, readonly, onChange }) { return <View message={message} flow={flow} readonly={readonly} onChange={onChange}/> } -function ViewServer({content, contentView}){ + +function ViewServer({content, contentView, message, flow}){ let data = JSON.parse(content) + let showImage = isImage.test(MessageUtils.getContentType(message)) + return <div> {contentView != data.description && <div className="alert alert-warning">{data.description}</div> @@ -56,6 +59,11 @@ function ViewServer({content, contentView}){ </div> )} </pre> + {showImage && + <div className="flowview-image"> + <img src={MessageUtils.getContentURL(flow, message)} alt="preview" className="img-thumbnail"/> + </div> + } </div> } diff --git a/web/src/js/components/ContentView/ViewSelector.jsx b/web/src/js/components/ContentView/ViewSelector.jsx index 423cc157..e031b51f 100644 --- a/web/src/js/components/ContentView/ViewSelector.jsx +++ b/web/src/js/components/ContentView/ViewSelector.jsx @@ -35,10 +35,8 @@ function ViewSelector({ message, contentViews }) { return ( <div className="view-selector btn-group btn-group-xs"> - <ViewButton name="ViewAuto">auto: {autoViewName}</ViewButton> - {Object.keys(ContentViews).map(name => - name !== "ViewAuto" && name !== "ViewServer" && + name === "ViewRaw" && <ViewButton key={name} name={name}>{name.toLowerCase().replace('view', '')}</ViewButton> )} diff --git a/web/src/js/ducks/ui/flow.js b/web/src/js/ducks/ui/flow.js index c9435676..549efb1d 100644 --- a/web/src/js/ducks/ui/flow.js +++ b/web/src/js/ducks/ui/flow.js @@ -14,7 +14,7 @@ export const SET_CONTENT_VIEW = 'UI_FLOWVIEW_SET_CONTENT_VIEW', const defaultState = { displayLarge: false, modifiedFlow: false, - contentView: 'ViewAuto', + contentView: 'Auto', tab: 'request', } |