New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [web] Static viewer for mitmweb #2504

Merged
merged 9 commits into from Aug 8, 2017

Conversation

Projects
None yet
2 participants
@MatthewShao
Contributor

MatthewShao commented Aug 7, 2017

ref: mitmproxy/mitmweb#23 -> mhils' comment

  • Add static.js to index.html
  • Add StaticBackend beside WebSocketBackend
  • Create <HideInStatic> component
  • Hide some components in static mode

For now, we hide following responsive components:

  • <ConnectionIndicator/>
  • Protocol Support menu in Options Header
  • Http Options menu in Options Header
  • Use Host Header toggler in Options Header
  • Flow Modification menu in Flow Header
  • Interception menu in Flow Header
    Also:
  • set proxy server information label to Static in static mode.

And there are some components which I'm not sure whether we should hide in static mode:

  • Option Modal
  • Install Certificates Option in File Menu
  • Eventlog: This probably should be kept in static mode, however we need to have some designs to store the log information in a file, maybe just in the flow file.
@mhils

Very, very cool. Super excited for this! 😃

  • Why is c6385e8 required? That shouldn't be necessary. Ideally we'd only use MITMWEB_STATIC in app.js and HideInStatic, maybe prefix with global. there so that it doesn't raise if it doesn't exist?
  • I think all the components you mentioned in your original post can be hidden, except for the event log, which we can just keep around for now. :)
Show outdated Hide outdated web/src/js/backends/static.js
Show outdated Hide outdated web/src/js/components/Footer.jsx
Show outdated Hide outdated web/src/js/components/common/HideInStatic.jsx
Show outdated Hide outdated web/src/js/backends/static.js
Show outdated Hide outdated web/src/js/components/Header/OptionMenu.jsx
import React from 'react'
export default function HideInStatic({ children }) {
return global.MITMWEB_STATIC ? null : [children]

This comment has been minimized.

@mhils

mhils Aug 8, 2017

Member

children instead of [children] doesn't work?

@mhils

mhils Aug 8, 2017

Member

children instead of [children] doesn't work?

This comment has been minimized.

@MatthewShao

MatthewShao Aug 8, 2017

Contributor

yeah, the new feature has to return an array of components.

@MatthewShao

MatthewShao Aug 8, 2017

Contributor

yeah, the new feature has to return an array of components.

@@ -72,17 +72,9 @@ exports[`FileMenu Component should render correctly 1`] = `
/>
 Options
</a>
</li>
<li>

This comment has been minimized.

@mhils

mhils Aug 8, 2017

Member

I'll bite... any idea why there is a diff here? 😄

@mhils

mhils Aug 8, 2017

Member

I'll bite... any idea why there is a diff here? 😄

This comment has been minimized.

@MatthewShao

MatthewShao Aug 8, 2017

Contributor

I think this is because we just upgraded the react-test-renderer, some rendering algorithm might have been updated, so it makes a diff... This file is generated automatically by jest, so I believe that the diff is innocuous.

@MatthewShao

MatthewShao Aug 8, 2017

Contributor

I think this is because we just upgraded the react-test-renderer, some rendering algorithm might have been updated, so it makes a diff... This file is generated automatically by jest, so I believe that the diff is innocuous.

This comment has been minimized.

@mhils

mhils Aug 8, 2017

Member

FWIW I don't think it's the rendering algorithm - looks more like a bug to me. There clearly should be a <li> here generated by this:

{children.map ( (item, i) => <li key={i}> {item} </li> )}

Does the file menu still look the same? If so, I think we can tolerate this for now.

@mhils

mhils Aug 8, 2017

Member

FWIW I don't think it's the rendering algorithm - looks more like a bug to me. There clearly should be a <li> here generated by this:

{children.map ( (item, i) => <li key={i}> {item} </li> )}

Does the file menu still look the same? If so, I think we can tolerate this for now.

This comment has been minimized.

@MatthewShao

MatthewShao Aug 8, 2017

Contributor

yeah, don't worry, it looks totally the same.

@MatthewShao

MatthewShao Aug 8, 2017

Contributor

yeah, don't worry, it looks totally the same.

@mhils

mhils approved these changes Aug 8, 2017

@mhils mhils merged commit 802e8cb into mitmproxy:master Aug 8, 2017

0 of 2 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment