mirror of
https://github.com/zhigang1992/mitmproxy.git
synced 2026-04-01 21:02:35 +08:00
console: scripts to new options screen
This commit is contained in:
@@ -575,6 +575,7 @@ class ConsoleMaster(flow.FlowMaster):
|
||||
self.unload_scripts()
|
||||
for command in commands:
|
||||
self.load_script(command)
|
||||
signals.update_settings.send(self)
|
||||
|
||||
def edit_tcp_filter(self, tcp):
|
||||
patterns = (x[0] for x in tcp)
|
||||
|
||||
@@ -90,7 +90,6 @@ class HelpView(urwid.ListBox):
|
||||
("o", "options"),
|
||||
("q", "quit / return to flow list"),
|
||||
("Q", "quit without confirm prompt"),
|
||||
("s", "add/remove scripts"),
|
||||
("S", "server replay"),
|
||||
("t", "set sticky cookie expression"),
|
||||
("T", "set tcp proxying pattern"),
|
||||
|
||||
@@ -152,7 +152,9 @@ class Options(urwid.WidgetWrap):
|
||||
),
|
||||
Option(
|
||||
"Scripts",
|
||||
"S"
|
||||
"S",
|
||||
lambda: master.scripts,
|
||||
self.scripts
|
||||
),
|
||||
|
||||
Heading("Interface"),
|
||||
@@ -239,6 +241,7 @@ class Options(urwid.WidgetWrap):
|
||||
self.master.setheaders.clear()
|
||||
self.master.replacehooks.clear()
|
||||
self.master.set_ignore_filter([])
|
||||
self.master.scripts = []
|
||||
signals.update_settings.send(self)
|
||||
signals.status_message.send(
|
||||
message = "All options cleared",
|
||||
@@ -300,3 +303,12 @@ class Options(urwid.WidgetWrap):
|
||||
_set
|
||||
)
|
||||
)
|
||||
|
||||
def scripts(self):
|
||||
self.master.view_grideditor(
|
||||
grideditor.ScriptEditor(
|
||||
self.master,
|
||||
[[i.command] for i in self.master.scripts],
|
||||
self.master.edit_scripts
|
||||
)
|
||||
)
|
||||
|
||||
@@ -60,14 +60,6 @@ class Window(urwid.Frame):
|
||||
keys = contentview.view_prompts,
|
||||
callback = self.master.change_default_display_mode
|
||||
)
|
||||
elif k == "s":
|
||||
self.master.view_grideditor(
|
||||
grideditor.ScriptEditor(
|
||||
self.master,
|
||||
[[i.command] for i in self.master.scripts],
|
||||
self.master.edit_scripts
|
||||
)
|
||||
)
|
||||
elif k == "S":
|
||||
if not self.master.server_playback:
|
||||
signals.status_prompt_path.send(
|
||||
|
||||
Reference in New Issue
Block a user