add image to mitmproxy.contentview.image

This commit is contained in:
Clemens 2016-07-28 17:28:05 +02:00
parent ad5bebeda0
commit 2807329fb2
3 changed files with 11 additions and 5 deletions

View File

@ -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>
}

View File

@ -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>
)}

View File

@ -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',
}