File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515from typing import List , Union
1616from typing import Optional
1717
18+ import blinker
19+
1820from mitmproxy import flow
1921from mitmproxy import http
2022from mitmproxy .utils import strutils
2931
3032views : List [View ] = []
3133
34+ on_add = blinker .Signal ()
35+ """A new contentview has been added."""
36+
3237
3338def get (name : str ) -> Optional [View ]:
3439 for i in views :
@@ -44,6 +49,7 @@ def add(view: View) -> None:
4449 raise ValueError ("Duplicate view: " + view .name )
4550
4651 views .append (view )
52+ on_add .send (view )
4753
4854
4955def remove (view : View ) -> None :
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ def __init__(self, master):
4949 super ().__init__ ([])
5050 self .show ()
5151 self .last_displayed_body = None
52+ contentviews .on_add .connect (self .contentview_added )
5253
5354 @property
5455 def view (self ):
@@ -58,6 +59,12 @@ def view(self):
5859 def flow (self ) -> mitmproxy .flow .Flow :
5960 return self .master .view .focus .flow
6061
62+ def contentview_added (self , view ):
63+ # this is called when a contentview addon is live-reloaded.
64+ # we clear our cache and then rerender
65+ self ._get_content_view .cache_clear ()
66+ self .show ()
67+
6168 def focus_changed (self ):
6269 f = self .flow
6370 if f :
You can’t perform that action at this time.
0 commit comments