mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
[web] Broadcast options update in backend.
This commit is contained in:
parent
aa01a62df7
commit
c1553c7602
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user