mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 07:08:10 +00:00
add keyboard shortcut n to mitmweb (by using runCommand inside the kb shortcut handler) (#5061)
* add keyboard shortcut n to mitmweb (by creating /flows/create route) * add keyboard shortcut n to mitmweb (simplified, by using runCommand instead of a new route)
This commit is contained in:
parent
2455632a9c
commit
1abb8f6921
@ -22,6 +22,7 @@
|
||||
* Fix a bug where `running()` is invoked twice on startup (#3584, @mhils)
|
||||
* Correct documentation example for User-Agent header modification (#4997, @jamesyale)
|
||||
* Fix random connection stalls (#5040, @EndUser509)
|
||||
* Add `n` new flow keybind to mitmweb (#5061, @ianklatzco)
|
||||
|
||||
## 28 September 2021: mitmproxy 7.0.4
|
||||
|
||||
|
@ -2,7 +2,7 @@ import reduceFlows, * as flowsActions from "../../../ducks/flows";
|
||||
import {onKeyDown} from '../../../ducks/ui/keyboard'
|
||||
import * as UIActions from '../../../ducks/ui/flow'
|
||||
import * as modalActions from '../../../ducks/ui/modal'
|
||||
import {fetchApi} from '../../../utils'
|
||||
import {fetchApi, runCommand} from '../../../utils'
|
||||
import {TStore} from "../tutils";
|
||||
|
||||
jest.mock('../../../utils')
|
||||
@ -102,6 +102,11 @@ describe('onKeyDown', () => {
|
||||
|
||||
})
|
||||
|
||||
it('should handle create action', () => {
|
||||
store.dispatch(createKeyEvent("n"))
|
||||
expect(runCommand).toBeCalledWith('view.flows.create', "get", "https://example.com/")
|
||||
})
|
||||
|
||||
it('should handle duplicate action', () => {
|
||||
store.dispatch(createKeyEvent("D"))
|
||||
expect(fetchApi).toBeCalledWith('/flows/1/duplicate', {method: 'POST'})
|
||||
|
@ -2,6 +2,7 @@ import {selectTab} from "./flow"
|
||||
import * as flowsActions from "../flows"
|
||||
import * as modalActions from "./modal"
|
||||
import {tabsForFlow} from "../../components/FlowView";
|
||||
import {runCommand} from "../../utils"
|
||||
|
||||
|
||||
export function onKeyDown(e: KeyboardEvent) {
|
||||
@ -80,6 +81,11 @@ export function onKeyDown(e: KeyboardEvent) {
|
||||
break
|
||||
}
|
||||
|
||||
case "n": {
|
||||
runCommand("view.flows.create", "get", "https://example.com/")
|
||||
break
|
||||
}
|
||||
|
||||
case "D": {
|
||||
if (!flow) {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user