[web] update HideInStatic and some components.

This commit is contained in:
Matthew Shao 2017-08-08 21:57:42 +08:00
parent 07b3900ac5
commit 756b734ae2
5 changed files with 20 additions and 8 deletions

View File

@ -2,6 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types' import PropTypes from 'prop-types'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { formatSize } from '../utils.js' import { formatSize } from '../utils.js'
import HideInStatic from '../components/common/HideInStatic'
Footer.propTypes = { Footer.propTypes = {
settings: PropTypes.object.isRequired, settings: PropTypes.object.isRequired,
@ -49,13 +50,14 @@ function Footer({ settings }) {
<span className="label label-success">stream: {formatSize(stream_large_bodies)}</span> <span className="label label-success">stream: {formatSize(stream_large_bodies)}</span>
)} )}
<div className="pull-right"> <div className="pull-right">
{ MITMWEB_STATIC ? <HideInStatic>
(<span className="label label-primary" title="static">Static</span>): {
server && ( server && (
<span className="label label-primary" title="HTTP Proxy Server Address"> <span className="label label-primary" title="HTTP Proxy Server Address">
{listen_host||"*"}:{listen_port} {listen_host||"*"}:{listen_port}
</span>) </span>)
} }
</HideInStatic>
<span className="label label-info" title="Mitmproxy Version"> <span className="label label-info" title="Mitmproxy Version">
v{version} v{version}
</span> </span>

View File

@ -37,6 +37,7 @@ export function FileMenu ({clearFlows, loadFlows, saveFlows, openModal}) {
&nbsp;Save... &nbsp;Save...
</a> </a>
<HideInStatic>
<a href="#" onClick={e => { e.preventDefault(); openModal(); }}> <a href="#" onClick={e => { e.preventDefault(); openModal(); }}>
<i className="fa fa-fw fa-cog"></i> <i className="fa fa-fw fa-cog"></i>
&nbsp;Options &nbsp;Options
@ -47,6 +48,7 @@ export function FileMenu ({clearFlows, loadFlows, saveFlows, openModal}) {
<i className="fa fa-fw fa-external-link"></i> <i className="fa fa-fw fa-external-link"></i>
&nbsp;Install Certificates... &nbsp;Install Certificates...
</a> </a>
</HideInStatic>
</Dropdown> </Dropdown>
) )
} }

View File

@ -23,7 +23,8 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow
return <div/> return <div/>
return ( return (
<div> <div>
<HideInStatic className="menu-group"> <HideInStatic>
<div className="menu-group">
<div className="menu-content"> <div className="menu-content">
<Button title="[r]eplay flow" icon="fa-repeat text-primary" <Button title="[r]eplay flow" icon="fa-repeat text-primary"
onClick={() => replayFlow(flow)}> onClick={() => replayFlow(flow)}>
@ -43,6 +44,7 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow
</Button> </Button>
</div> </div>
<div className="menu-legend">Flow Modification</div> <div className="menu-legend">Flow Modification</div>
</div>
</HideInStatic> </HideInStatic>
<div className="menu-group"> <div className="menu-group">
@ -55,7 +57,8 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow
<div className="menu-legend">Export</div> <div className="menu-legend">Export</div>
</div> </div>
<HideInStatic className="menu-group"> <HideInStatic>
<div className="menu-group">
<div className="menu-content"> <div className="menu-content">
<Button disabled={!flow || !flow.intercepted} title="[a]ccept intercepted flow" <Button disabled={!flow || !flow.intercepted} title="[a]ccept intercepted flow"
icon="fa-play text-success" onClick={() => resumeFlow(flow)}> icon="fa-play text-success" onClick={() => resumeFlow(flow)}>
@ -67,6 +70,7 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow
</Button> </Button>
</div> </div>
<div className="menu-legend">Interception</div> <div className="menu-legend">Interception</div>
</div>
</HideInStatic> </HideInStatic>

View File

@ -10,16 +10,19 @@ OptionMenu.title = 'Options'
export default function OptionMenu() { export default function OptionMenu() {
return ( return (
<div> <div>
<HideInStatic className="menu-group"> <HideInStatic>
<div className="menu-group">
<div className="menu-content"> <div className="menu-content">
<SettingsToggle setting="http2">HTTP/2.0</SettingsToggle> <SettingsToggle setting="http2">HTTP/2.0</SettingsToggle>
<SettingsToggle setting="websocket">WebSockets</SettingsToggle> <SettingsToggle setting="websocket">WebSockets</SettingsToggle>
<SettingsToggle setting="rawtcp">Raw TCP</SettingsToggle> <SettingsToggle setting="rawtcp">Raw TCP</SettingsToggle>
</div> </div>
<div className="menu-legend">Protocol Support</div> <div className="menu-legend">Protocol Support</div>
</div>
</HideInStatic> </HideInStatic>
<HideInStatic className="menu-group"> <HideInStatic>
<div className="menu-group">
<div className="menu-content"> <div className="menu-content">
<SettingsToggle setting="anticache"> <SettingsToggle setting="anticache">
Disable Caching <DocsLink resource="features/anticache.html"/> Disable Caching <DocsLink resource="features/anticache.html"/>
@ -30,6 +33,7 @@ export default function OptionMenu() {
</SettingsToggle> </SettingsToggle>
</div> </div>
<div className="menu-legend">HTTP Options</div> <div className="menu-legend">HTTP Options</div>
</div>
</HideInStatic> </HideInStatic>
<div className="menu-group"> <div className="menu-group">

View File

@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
export default function HideInStatic({className, children }) { export default function HideInStatic({ children }) {
return MITMWEB_STATIC ? null : ( <div className={className}>{children}</div> ) return global.MITMWEB_STATIC ? null : [children]
} }