mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
Move console-relatived options into their own addons.
This commit is contained in:
parent
d02c825427
commit
2aa97c9b75
@ -4,29 +4,6 @@ from mitmproxy import optmanager
|
||||
from mitmproxy import contentviews
|
||||
from mitmproxy.net import tcp
|
||||
|
||||
# We redefine these here for now to avoid importing Urwid-related guff on
|
||||
# platforms that don't support it, and circular imports. We can do better using
|
||||
# a lazy checker down the track.
|
||||
console_palettes = [
|
||||
"lowlight",
|
||||
"lowdark",
|
||||
"light",
|
||||
"dark",
|
||||
"solarized_light",
|
||||
"solarized_dark"
|
||||
]
|
||||
view_orders = [
|
||||
"time",
|
||||
"method",
|
||||
"url",
|
||||
"size",
|
||||
]
|
||||
console_layouts = [
|
||||
"single",
|
||||
"vertical",
|
||||
"horizontal",
|
||||
]
|
||||
|
||||
log_verbosity = [
|
||||
"error",
|
||||
"warn",
|
||||
@ -474,43 +451,6 @@ class Options(optmanager.OptManager):
|
||||
"Intercept filter expression."
|
||||
)
|
||||
|
||||
# Console options
|
||||
self.add_option(
|
||||
"console_layout", str, "single",
|
||||
"Console layout.",
|
||||
choices=sorted(console_layouts),
|
||||
)
|
||||
self.add_option(
|
||||
"console_layout_headers", bool, True,
|
||||
"Show layout comonent headers",
|
||||
)
|
||||
self.add_option(
|
||||
"console_focus_follow", bool, False,
|
||||
"Focus follows new flows."
|
||||
)
|
||||
self.add_option(
|
||||
"console_palette", str, "solarized_dark",
|
||||
"Color palette.",
|
||||
choices=sorted(console_palettes),
|
||||
)
|
||||
self.add_option(
|
||||
"console_palette_transparent", bool, False,
|
||||
"Set transparent background for palette."
|
||||
)
|
||||
self.add_option(
|
||||
"console_mouse", bool, True,
|
||||
"Console mouse interaction."
|
||||
)
|
||||
self.add_option(
|
||||
"console_order", str, "time",
|
||||
"Flow sort order.",
|
||||
choices=view_orders,
|
||||
)
|
||||
self.add_option(
|
||||
"console_order_reversed", bool, False,
|
||||
"Reverse the sorting order."
|
||||
)
|
||||
|
||||
self.add_option(
|
||||
"view_filter", Optional[str], None,
|
||||
"Limit which flows are displayed."
|
||||
|
@ -11,6 +11,29 @@ from mitmproxy.tools.console import overlay
|
||||
from mitmproxy.tools.console import signals
|
||||
from mitmproxy.tools.console import keymap
|
||||
|
||||
# We redefine these here for now to avoid importing Urwid-related guff on
|
||||
# platforms that don't support it, and circular imports. We can do better using
|
||||
# a lazy checker down the track.
|
||||
console_palettes = [
|
||||
"lowlight",
|
||||
"lowdark",
|
||||
"light",
|
||||
"dark",
|
||||
"solarized_light",
|
||||
"solarized_dark"
|
||||
]
|
||||
view_orders = [
|
||||
"time",
|
||||
"method",
|
||||
"url",
|
||||
"size",
|
||||
]
|
||||
console_layouts = [
|
||||
"single",
|
||||
"vertical",
|
||||
"horizontal",
|
||||
]
|
||||
|
||||
|
||||
class Logger:
|
||||
def log(self, evt):
|
||||
@ -60,6 +83,43 @@ class ConsoleAddon:
|
||||
self.master = master
|
||||
self.started = False
|
||||
|
||||
def load(self, loader):
|
||||
loader.add_option(
|
||||
"console_layout", str, "single",
|
||||
"Console layout.",
|
||||
choices=sorted(console_layouts),
|
||||
)
|
||||
loader.add_option(
|
||||
"console_layout_headers", bool, True,
|
||||
"Show layout comonent headers",
|
||||
)
|
||||
loader.add_option(
|
||||
"console_focus_follow", bool, False,
|
||||
"Focus follows new flows."
|
||||
)
|
||||
loader.add_option(
|
||||
"console_palette", str, "solarized_dark",
|
||||
"Color palette.",
|
||||
choices=sorted(console_palettes),
|
||||
)
|
||||
loader.add_option(
|
||||
"console_palette_transparent", bool, False,
|
||||
"Set transparent background for palette."
|
||||
)
|
||||
loader.add_option(
|
||||
"console_mouse", bool, True,
|
||||
"Console mouse interaction."
|
||||
)
|
||||
loader.add_option(
|
||||
"console_order", str, "time",
|
||||
"Flow sort order.",
|
||||
choices=view_orders,
|
||||
)
|
||||
loader.add_option(
|
||||
"console_order_reversed", bool, False,
|
||||
"Reverse the sorting order."
|
||||
)
|
||||
|
||||
@command.command("console.layout.options")
|
||||
def layout_options(self) -> typing.Sequence[str]:
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user