From f7b494ccf2a90d8c54df760e5142f34f11f8cf3c Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Mon, 7 Aug 2017 11:05:02 +0800 Subject: [PATCH] [web] Add HideInStatic Component HideInStaic compoent will check the MITMWEB_STATIC var, and hide the responsive components in static mode. --- web/src/js/components/Footer.jsx | 8 +++++--- web/src/js/components/Header.jsx | 5 ++++- web/src/js/components/Header/FileMenu.jsx | 2 +- web/src/js/components/Header/FlowMenu.jsx | 11 +++++++---- web/src/js/components/Header/OptionMenu.jsx | 14 ++++++++++---- web/src/js/components/common/HideInStatic.jsx | 5 +++++ 6 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 web/src/js/components/common/HideInStatic.jsx diff --git a/web/src/js/components/Footer.jsx b/web/src/js/components/Footer.jsx index 08d154962..9a2f6cf48 100644 --- a/web/src/js/components/Footer.jsx +++ b/web/src/js/components/Footer.jsx @@ -49,11 +49,13 @@ function Footer({ settings }) { stream: {formatSize(stream_large_bodies)} )}
- {server && ( + { MITMWEB_STATIC ? + (Static): + server && ( {listen_host||"*"}:{listen_port} - - )} + ) + } v{version} diff --git a/web/src/js/components/Header.jsx b/web/src/js/components/Header.jsx index ebe7453c0..9b7354eb5 100644 --- a/web/src/js/components/Header.jsx +++ b/web/src/js/components/Header.jsx @@ -8,6 +8,7 @@ import FileMenu from './Header/FileMenu' import FlowMenu from './Header/FlowMenu' import {setActiveMenu} from '../ducks/ui/header' import ConnectionIndicator from "./Header/ConnectionIndicator" +import HideInStatic from './common/HideInStatic' class Header extends Component { static entries = [MainMenu, OptionMenu] @@ -40,7 +41,9 @@ class Header extends Component { {Entry.title} ))} - + + +
diff --git a/web/src/js/components/Header/FileMenu.jsx b/web/src/js/components/Header/FileMenu.jsx index 62f721cff..cf3463434 100644 --- a/web/src/js/components/Header/FileMenu.jsx +++ b/web/src/js/components/Header/FileMenu.jsx @@ -5,6 +5,7 @@ import FileChooser from '../common/FileChooser' import Dropdown, {Divider} from '../common/Dropdown' import * as flowsActions from '../../ducks/flows' import * as modalActions from '../../ducks/ui/modal' +import HideInStatic from "../common/HideInStatic"; FileMenu.propTypes = { clearFlows: PropTypes.func.isRequired, @@ -40,7 +41,6 @@ export function FileMenu ({clearFlows, loadFlows, saveFlows, openModal}) {  Options - diff --git a/web/src/js/components/Header/FlowMenu.jsx b/web/src/js/components/Header/FlowMenu.jsx index 8f1042136..dc8221501 100644 --- a/web/src/js/components/Header/FlowMenu.jsx +++ b/web/src/js/components/Header/FlowMenu.jsx @@ -4,6 +4,7 @@ import { connect } from "react-redux" import Button from "../common/Button" import { MessageUtils } from "../../flow/utils.js" import * as flowsActions from "../../ducks/flows" +import HideInStatic from "../common/HideInStatic"; FlowMenu.title = 'Flow' @@ -22,7 +23,7 @@ export function FlowMenu({ flow, resumeFlow, killFlow, replayFlow, duplicateFlow return
return (
-
+
Flow Modification
-
+ +
-
+ +
Interception
-
+
diff --git a/web/src/js/components/Header/OptionMenu.jsx b/web/src/js/components/Header/OptionMenu.jsx index b33d578d2..566db42f9 100644 --- a/web/src/js/components/Header/OptionMenu.jsx +++ b/web/src/js/components/Header/OptionMenu.jsx @@ -3,21 +3,23 @@ import PropTypes from 'prop-types' import { connect } from "react-redux" import { SettingsToggle, EventlogToggle } from "./MenuToggle" import DocsLink from "../common/DocsLink" +import HideInStatic from "../common/HideInStatic"; OptionMenu.title = 'Options' export default function OptionMenu() { return (
-
+
HTTP/2.0 WebSockets Raw TCP
Protocol Support
-
-
+ + +
Disable Caching @@ -28,13 +30,17 @@ export default function OptionMenu() {
HTTP Options
-
+ +
+ Use Host Header + +
View Options
diff --git a/web/src/js/components/common/HideInStatic.jsx b/web/src/js/components/common/HideInStatic.jsx new file mode 100644 index 000000000..9f515c972 --- /dev/null +++ b/web/src/js/components/common/HideInStatic.jsx @@ -0,0 +1,5 @@ +import React from 'react' + +export default function HideInStatic({className, children }) { + return MITMWEB_STATIC ? null : (
{children}
) +}