aboutsummaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorMatthew Shao <me@matshao.com>2017-08-08 21:57:42 +0800
committerMatthew Shao <me@matshao.com>2017-08-08 21:57:42 +0800
commit756b734ae294da09041303be52f9e9ced0b40d2d (patch)
tree4f1056796a5e6e3e016687d4ebdfcb63f38c74c3 /web
parent07b3900ac5f057de96e4c511bdb7d8c1754c9be7 (diff)
downloadmitmproxy-756b734ae294da09041303be52f9e9ced0b40d2d.tar.gz
mitmproxy-756b734ae294da09041303be52f9e9ced0b40d2d.tar.bz2
mitmproxy-756b734ae294da09041303be52f9e9ced0b40d2d.zip
[web] update HideInStatic and some components.
Diffstat (limited to 'web')
-rw-r--r--web/src/js/components/Footer.jsx6
-rw-r--r--web/src/js/components/Header/FileMenu.jsx2
-rw-r--r--web/src/js/components/Header/FlowMenu.jsx8
-rw-r--r--web/src/js/components/Header/OptionMenu.jsx8
-rw-r--r--web/src/js/components/common/HideInStatic.jsx4
5 files changed, 20 insertions, 8 deletions
diff --git a/web/src/js/components/Footer.jsx b/web/src/js/components/Footer.jsx
index 9a2f6cf4..db9afe6f 100644
--- a/web/src/js/components/Footer.jsx
+++ b/web/src/js/components/Footer.jsx
@@ -2,6 +2,7 @@ import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { formatSize } from '../utils.js'
+import HideInStatic from '../components/common/HideInStatic'
Footer.propTypes = {
settings: PropTypes.object.isRequired,
@@ -49,13 +50,14 @@ function Footer({ settings }) {
<span className="label label-success">stream: {formatSize(stream_large_bodies)}</span>
)}
<div className="pull-right">
- { MITMWEB_STATIC ?
- (<span className="label label-primary" title="static">Static</span>):
+ <HideInStatic>
+ {
server && (
<span className="label label-primary" title="HTTP Proxy Server Address">
{listen_host||"*"}:{listen_port}
</span>)
}
+ </HideInStatic>
<span className="label label-info" title="Mitmproxy Version">
v{version}
</span>
diff --git a/web/src/js/components/Header/FileMenu.jsx b/web/src/js/components/Header/FileMenu.jsx
index cf346343..5cb8e507 100644
--- a/web/src/js/components/Header/FileMenu.jsx
+++ b/web/src/js/components/Header/FileMenu.jsx
@@ -37,6 +37,7 @@ export function FileMenu ({clearFlows, loadFlows, saveFlows, openModal}) {
&nbsp;Save...
</a>
+ <HideInStatic>
<a href="#" onClick={e => { e.preventDefault(); openModal(); }}>
<i className="fa fa-fw fa-cog"></i>
&nbsp;Options
@@ -47,6 +48,7 @@ export function FileMenu ({clearFlows, loadFlows, saveFlows, openModal}) {
<i className="fa fa-fw fa-external-link"></i>
&nbsp;Install Certificates...
</a>
+ </HideInStatic>
</Dropdown>
)
}
diff --git a/web/src/js/components/Header/FlowMenu.jsx b/web/src/js/components/Header/FlowMenu.jsx
index dc822150..70c8bfcf 100644
--- a/web/src/js/components/Header/FlowMenu.jsx
+++ b/web/src/js/components/Header/FlowMenu.jsx
@@ -23,7 +23,8 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow
return <div/>
return (
<div>
- <HideInStatic className="menu-group">
+ <HideInStatic>
+ <div className="menu-group">
<div className="menu-content">
<Button title="[r]eplay flow" icon="fa-repeat text-primary"
onClick={() => replayFlow(flow)}>
@@ -43,6 +44,7 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow
</Button>
</div>
<div className="menu-legend">Flow Modification</div>
+ </div>
</HideInStatic>
<div className="menu-group">
@@ -55,7 +57,8 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow
<div className="menu-legend">Export</div>
</div>
- <HideInStatic className="menu-group">
+ <HideInStatic>
+ <div className="menu-group">
<div className="menu-content">
<Button disabled={!flow || !flow.intercepted} title="[a]ccept intercepted flow"
icon="fa-play text-success" onClick={() => resumeFlow(flow)}>
@@ -67,6 +70,7 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow
</Button>
</div>
<div className="menu-legend">Interception</div>
+ </div>
</HideInStatic>
diff --git a/web/src/js/components/Header/OptionMenu.jsx b/web/src/js/components/Header/OptionMenu.jsx
index 566db42f..78519a34 100644
--- a/web/src/js/components/Header/OptionMenu.jsx
+++ b/web/src/js/components/Header/OptionMenu.jsx
@@ -10,16 +10,19 @@ OptionMenu.title = 'Options'
export default function OptionMenu() {
return (
<div>
- <HideInStatic className="menu-group">
+ <HideInStatic>
+ <div className="menu-group">
<div className="menu-content">
<SettingsToggle setting="http2">HTTP/2.0</SettingsToggle>
<SettingsToggle setting="websocket">WebSockets</SettingsToggle>
<SettingsToggle setting="rawtcp">Raw TCP</SettingsToggle>
</div>
<div className="menu-legend">Protocol Support</div>
+ </div>
</HideInStatic>
- <HideInStatic className="menu-group">
+ <HideInStatic>
+ <div className="menu-group">
<div className="menu-content">
<SettingsToggle setting="anticache">
Disable Caching <DocsLink resource="features/anticache.html"/>
@@ -30,6 +33,7 @@ export default function OptionMenu() {
</SettingsToggle>
</div>
<div className="menu-legend">HTTP Options</div>
+ </div>
</HideInStatic>
<div className="menu-group">
diff --git a/web/src/js/components/common/HideInStatic.jsx b/web/src/js/components/common/HideInStatic.jsx
index 9f515c97..c5f3bf47 100644
--- a/web/src/js/components/common/HideInStatic.jsx
+++ b/web/src/js/components/common/HideInStatic.jsx
@@ -1,5 +1,5 @@
import React from 'react'
-export default function HideInStatic({className, children }) {
- return MITMWEB_STATIC ? null : ( <div className={className}>{children}</div> )
+export default function HideInStatic({ children }) {
+ return global.MITMWEB_STATIC ? null : [children]
}