mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
console: grideditor - re-add column headers
Also remove special-case shortcut for user-agent. This is awkward in the new structure. Down the track we can come up with a more regular mechanism like snippets.
This commit is contained in:
parent
d7cc7e62a2
commit
a4833a5bbf
@ -309,7 +309,8 @@ class BaseGridEditor(urwid.WidgetWrap):
|
|||||||
|
|
||||||
self.walker = GridWalker(self.value, self)
|
self.walker = GridWalker(self.value, self)
|
||||||
self.lb = GridListBox(self.walker)
|
self.lb = GridListBox(self.walker)
|
||||||
w = urwid.Frame(self.lb)
|
w = urwid.Frame(self.lb, header=h)
|
||||||
|
|
||||||
super().__init__(w)
|
super().__init__(w)
|
||||||
signals.footer_help.send(self, helptext="")
|
signals.footer_help.send(self, helptext="")
|
||||||
self.show_empty_msg()
|
self.show_empty_msg()
|
||||||
|
@ -39,7 +39,6 @@ class HeaderEditor(base.FocusEditor):
|
|||||||
urwid.Text([("text", "Special keys:\n")])
|
urwid.Text([("text", "Special keys:\n")])
|
||||||
]
|
]
|
||||||
keys = [
|
keys = [
|
||||||
("U", "add User-Agent header"),
|
|
||||||
]
|
]
|
||||||
text.extend(
|
text.extend(
|
||||||
common.format_keyvals(keys, key="key", val="text", indent=4)
|
common.format_keyvals(keys, key="key", val="text", indent=4)
|
||||||
@ -48,25 +47,6 @@ class HeaderEditor(base.FocusEditor):
|
|||||||
text.extend(h)
|
text.extend(h)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def set_user_agent(self, k):
|
|
||||||
ua = user_agents.get_by_shortcut(k)
|
|
||||||
if ua:
|
|
||||||
self.walker.add_value(
|
|
||||||
[
|
|
||||||
b"User-Agent",
|
|
||||||
ua[2].encode()
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
def handle_key(self, key):
|
|
||||||
if key == "U":
|
|
||||||
signals.status_prompt_onekey.send(
|
|
||||||
prompt="Add User-Agent header:",
|
|
||||||
keys=[(i[0], i[1]) for i in user_agents.UASTRINGS],
|
|
||||||
callback=self.set_user_agent,
|
|
||||||
)
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
class RequestHeaderEditor(HeaderEditor):
|
class RequestHeaderEditor(HeaderEditor):
|
||||||
title = "Edit Request Headers"
|
title = "Edit Request Headers"
|
||||||
|
Loading…
Reference in New Issue
Block a user