diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2018-02-24 19:09:32 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2018-02-24 19:09:32 +1300 |
commit | 59db25bd0ff2faaab7ba982cf51d472e108612f6 (patch) | |
tree | 8ff918b3d27fb1e6ef30caa1baafaf8e814a956f /mitmproxy | |
parent | f49aae312fb0df3c4dd484c6790c8a558fe540e8 (diff) | |
download | mitmproxy-59db25bd0ff2faaab7ba982cf51d472e108612f6.tar.gz mitmproxy-59db25bd0ff2faaab7ba982cf51d472e108612f6.tar.bz2 mitmproxy-59db25bd0ff2faaab7ba982cf51d472e108612f6.zip |
Split default_contentview into dumper_* and console_* varieties
Then move the new options into their respective addons. This was a shared
option, and things are much much simpler if it isn't.
Diffstat (limited to 'mitmproxy')
-rw-r--r-- | mitmproxy/addons/dumper.py | 7 | ||||
-rw-r--r-- | mitmproxy/options.py | 7 | ||||
-rw-r--r-- | mitmproxy/tools/console/consoleaddons.py | 7 | ||||
-rw-r--r-- | mitmproxy/tools/console/statusbar.py | 4 |
4 files changed, 14 insertions, 11 deletions
diff --git a/mitmproxy/addons/dumper.py b/mitmproxy/addons/dumper.py index 8cfacde6..0df2d339 100644 --- a/mitmproxy/addons/dumper.py +++ b/mitmproxy/addons/dumper.py @@ -42,6 +42,11 @@ class Dumper: 3: 2 + full response content, content of WebSocket and TCP messages. """ ) + loader.add_option( + "dumper_default_contentview", str, "auto", + "The default content view mode.", + choices = [i.name.lower() for i in contentviews.views] + ) def configure(self, updated): if "view_filter" in updated: @@ -73,7 +78,7 @@ class Dumper: def _echo_message(self, message): _, lines, error = contentviews.get_message_content_view( - ctx.options.default_contentview, + ctx.options.dumper_default_contentview, message ) if error: diff --git a/mitmproxy/options.py b/mitmproxy/options.py index 05332b3f..39fbff8f 100644 --- a/mitmproxy/options.py +++ b/mitmproxy/options.py @@ -1,7 +1,6 @@ from typing import Optional, Sequence from mitmproxy import optmanager -from mitmproxy import contentviews from mitmproxy.net import tls log_verbosity = [ @@ -57,7 +56,6 @@ class Options(optmanager.OptManager): # FIXME: Options that must be migrated to addons, but are complicated # because they're used by more than one addon, or because they're # embedded in the core code somehow. - default_contentview = None # type: str proxyauth = None # type: Optional[str] showhost = None # type: bool verbosity = None # type: str @@ -78,11 +76,6 @@ class Options(optmanager.OptManager): "Log verbosity.", choices=log_verbosity ) - self.add_option( - "default_contentview", str, "auto", - "The default content view mode.", - choices = [i.name.lower() for i in contentviews.views] - ) # Proxy options self.add_option( diff --git a/mitmproxy/tools/console/consoleaddons.py b/mitmproxy/tools/console/consoleaddons.py index 9856e80f..939757d7 100644 --- a/mitmproxy/tools/console/consoleaddons.py +++ b/mitmproxy/tools/console/consoleaddons.py @@ -77,6 +77,11 @@ class ConsoleAddon: def load(self, loader): loader.add_option( + "console_default_contentview", str, "auto", + "The default content view mode.", + choices = [i.name.lower() for i in contentviews.views] + ) + loader.add_option( "console_layout", str, "single", "Console layout.", choices=sorted(console_layouts), @@ -531,7 +536,7 @@ class ConsoleAddon: [ "@focus", "flowview_mode_%s" % idx, - self.master.options.default_contentview, + self.master.options.console_default_contentview, ] ) diff --git a/mitmproxy/tools/console/statusbar.py b/mitmproxy/tools/console/statusbar.py index bdb39013..8553a66f 100644 --- a/mitmproxy/tools/console/statusbar.py +++ b/mitmproxy/tools/console/statusbar.py @@ -197,10 +197,10 @@ class StatusBar(urwid.WidgetWrap): r.append("[") r.append(("heading_key", "u")) r.append(":%s]" % self.master.options.stickyauth) - if self.master.options.default_contentview != "auto": + if self.master.options.console_default_contentview != "auto": r.append("[") r.append(("heading_key", "M")) - r.append(":%s]" % self.master.options.default_contentview) + r.append(":%s]" % self.master.options.console_default_contentview) if self.master.options.has_changed("view_order"): r.append("[") r.append(("heading_key", "o")) |