From ed9a72553df91085021cc2a9187287ac73cc458c Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Sun, 26 Jun 2016 02:17:07 -0700 Subject: [PATCH] fix mitmproxy/mitmweb#25 --- web/src/js/components/ContentView.jsx | 8 +++---- .../{ContentErrors.jsx => MetaViews.jsx} | 1 - web/src/js/components/FlowView/Details.jsx | 8 ++----- web/src/js/components/Prompt.jsx | 22 +++++++++---------- 4 files changed, 17 insertions(+), 22 deletions(-) rename web/src/js/components/ContentView/{ContentErrors.jsx => MetaViews.jsx} (94%) diff --git a/web/src/js/components/ContentView.jsx b/web/src/js/components/ContentView.jsx index af3bffc19..1533684e4 100644 --- a/web/src/js/components/ContentView.jsx +++ b/web/src/js/components/ContentView.jsx @@ -1,7 +1,7 @@ import React, { Component, PropTypes } from 'react' import { MessageUtils } from '../flow/utils.js' import { ViewAuto, ViewImage } from './ContentView/ContentViews' -import * as ContentErrors from './ContentView/ContentErrors' +import * as MetaViews from './ContentView/MetaViews' import ContentLoader from './ContentView/ContentLoader' import ViewSelector from './ContentView/ViewSelector' @@ -45,15 +45,15 @@ export default class ContentView extends Component { const { displayLarge, View } = this.state if (message.contentLength === 0) { - return + return } if (message.contentLength === null) { - return + return } if (!displayLarge && this.isContentTooLarge(message)) { - return + return } return ( diff --git a/web/src/js/components/ContentView/ContentErrors.jsx b/web/src/js/components/ContentView/MetaViews.jsx similarity index 94% rename from web/src/js/components/ContentView/ContentErrors.jsx rename to web/src/js/components/ContentView/MetaViews.jsx index 11594c7fa..83720a137 100644 --- a/web/src/js/components/ContentView/ContentErrors.jsx +++ b/web/src/js/components/ContentView/MetaViews.jsx @@ -1,5 +1,4 @@ import React from 'react' -import { ViewImage } from './ContentViews' import {formatSize} from '../../utils.js' export function ContentEmpty({ flow, message }) { diff --git a/web/src/js/components/FlowView/Details.jsx b/web/src/js/components/FlowView/Details.jsx index 78e68ecf5..6a16a98e0 100644 --- a/web/src/js/components/FlowView/Details.jsx +++ b/web/src/js/components/FlowView/Details.jsx @@ -28,13 +28,9 @@ export function ConnectionInfo({ conn }) { Address: {conn.address.address.join(':')} - {conn.sni ? ( - - ) : ( + {conn.sni && ( - - TLS SNI: - + TLS SNI: {conn.sni} )} diff --git a/web/src/js/components/Prompt.jsx b/web/src/js/components/Prompt.jsx index 701a0b85e..e6564896c 100755 --- a/web/src/js/components/Prompt.jsx +++ b/web/src/js/components/Prompt.jsx @@ -35,6 +35,17 @@ export default function Prompt({ prompt, done, options }, context) { } opts.push(opt) } + + function onKeyDown(event) { + event.stopPropagation() + event.preventDefault() + const key = opts.find(opt => Key[opt.key.toUpperCase()] === event.keyCode) + if (!key && event.keyCode !== Key.ESC && event.keyCode !== Key.ENTER) { + return + } + done(key.key || false) + context.returnFocus() + } return (
@@ -57,15 +68,4 @@ export default function Prompt({ prompt, done, options }, context) {
) - - function onKeyDown(event) { - event.stopPropagation() - event.preventDefault() - const key = opts.find(opt => Key[opt.key.toUpperCase()] === event.keyCode) - if (!key && event.keyCode !== Key.ESC && event.keyCode !== Key.ENTER) { - return - } - done(key.key || false) - context.returnFocus() - } }