mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
This commit is contained in:
parent
370e6caedc
commit
ed9a72553d
@ -1,7 +1,7 @@
|
|||||||
import React, { Component, PropTypes } from 'react'
|
import React, { Component, PropTypes } from 'react'
|
||||||
import { MessageUtils } from '../flow/utils.js'
|
import { MessageUtils } from '../flow/utils.js'
|
||||||
import { ViewAuto, ViewImage } from './ContentView/ContentViews'
|
import { ViewAuto, ViewImage } from './ContentView/ContentViews'
|
||||||
import * as ContentErrors from './ContentView/ContentErrors'
|
import * as MetaViews from './ContentView/MetaViews'
|
||||||
import ContentLoader from './ContentView/ContentLoader'
|
import ContentLoader from './ContentView/ContentLoader'
|
||||||
import ViewSelector from './ContentView/ViewSelector'
|
import ViewSelector from './ContentView/ViewSelector'
|
||||||
|
|
||||||
@ -45,15 +45,15 @@ export default class ContentView extends Component {
|
|||||||
const { displayLarge, View } = this.state
|
const { displayLarge, View } = this.state
|
||||||
|
|
||||||
if (message.contentLength === 0) {
|
if (message.contentLength === 0) {
|
||||||
return <ContentErrors.ContentEmpty {...this.props}/>
|
return <MetaViews.ContentEmpty {...this.props}/>
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.contentLength === null) {
|
if (message.contentLength === null) {
|
||||||
return <ContentErrors.ContentMissing {...this.props}/>
|
return <MetaViews.ContentMissing {...this.props}/>
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!displayLarge && this.isContentTooLarge(message)) {
|
if (!displayLarge && this.isContentTooLarge(message)) {
|
||||||
return <ContentErrors.ContentTooLarge {...this.props} onClick={this.displayLarge}/>
|
return <MetaViews.ContentTooLarge {...this.props} onClick={this.displayLarge}/>
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { ViewImage } from './ContentViews'
|
|
||||||
import {formatSize} from '../../utils.js'
|
import {formatSize} from '../../utils.js'
|
||||||
|
|
||||||
export function ContentEmpty({ flow, message }) {
|
export function ContentEmpty({ flow, message }) {
|
@ -28,13 +28,9 @@ export function ConnectionInfo({ conn }) {
|
|||||||
<td>Address:</td>
|
<td>Address:</td>
|
||||||
<td>{conn.address.address.join(':')}</td>
|
<td>{conn.address.address.join(':')}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{conn.sni ? (
|
{conn.sni && (
|
||||||
<tr key="sni"></tr>
|
|
||||||
) : (
|
|
||||||
<tr key="sni">
|
<tr key="sni">
|
||||||
<td>
|
<td><abbr title="TLS Server Name Indication">TLS SNI:</abbr></td>
|
||||||
<abbr title="TLS Server Name Indication">TLS SNI:</abbr>
|
|
||||||
</td>
|
|
||||||
<td>{conn.sni}</td>
|
<td>{conn.sni}</td>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
|
@ -36,6 +36,17 @@ export default function Prompt({ prompt, done, options }, context) {
|
|||||||
opts.push(opt)
|
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 (
|
return (
|
||||||
<div tabIndex="0" onKeyDown={onKeyDown} className="prompt-dialog">
|
<div tabIndex="0" onKeyDown={onKeyDown} className="prompt-dialog">
|
||||||
<div className="prompt-content">
|
<div className="prompt-content">
|
||||||
@ -57,15 +68,4 @@ export default function Prompt({ prompt, done, options }, context) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
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()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user