From c1553c7602f43f2b566435b765c285596d03c2f5 Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Wed, 5 Jul 2017 08:42:41 +0800 Subject: [PATCH] [web] Broadcast options update in backend. --- mitmproxy/tools/web/master.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mitmproxy/tools/web/master.py b/mitmproxy/tools/web/master.py index c09fe0a20..8c2433ec6 100644 --- a/mitmproxy/tools/web/master.py +++ b/mitmproxy/tools/web/master.py @@ -5,6 +5,7 @@ import tornado.ioloop from mitmproxy import addons from mitmproxy import log from mitmproxy import master +from mitmproxy import optmanager from mitmproxy.addons import eventstore from mitmproxy.addons import intercept from mitmproxy.addons import readfile @@ -29,6 +30,7 @@ class WebMaster(master.Master): self.events.sig_refresh.connect(self._sig_events_refresh) self.options.changed.connect(self._sig_options_update) + self.options.changed.connect(self._sig_settings_update) self.addons.add(*addons.default_addons()) self.addons.add( @@ -86,6 +88,14 @@ class WebMaster(master.Master): ) def _sig_options_update(self, options, updated): + options_dict = optmanager.dump_dicts(options, updated) + app.ClientConnection.broadcast( + resource="options", + cmd="update", + data=options_dict + ) + + def _sig_settings_update(self, options, updated): app.ClientConnection.broadcast( resource="settings", cmd="update",