mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
[web] change the path name like _flows
to flows.json
.
This commit is contained in:
parent
7d92cdf3bb
commit
cbdddefcc8
@ -41,7 +41,7 @@ class StaticViewer:
|
|||||||
self.flows.add(i)
|
self.flows.add(i)
|
||||||
|
|
||||||
def save_flows(self) -> None:
|
def save_flows(self) -> None:
|
||||||
with open(os.path.join(self.path, '_flows'), 'w') as file:
|
with open(os.path.join(self.path, 'flows.json'), 'w') as file:
|
||||||
flows = []
|
flows = []
|
||||||
for f in self.flows:
|
for f in self.flows:
|
||||||
flows.append(flow_to_json(f))
|
flows.append(flow_to_json(f))
|
||||||
@ -54,8 +54,8 @@ class StaticViewer:
|
|||||||
path = os.path.join(self.path, 'flows', f.id, m)
|
path = os.path.join(self.path, 'flows', f.id, m)
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
with open(os.path.join(path, '_content'), 'wb') as file:
|
with open(os.path.join(path, 'content.json'), 'wb') as content_file:
|
||||||
file.write(message.raw_content)
|
content_file.write(message.raw_content)
|
||||||
|
|
||||||
# content_view
|
# content_view
|
||||||
view_path = os.path.join(path, 'content')
|
view_path = os.path.join(path, 'content')
|
||||||
@ -64,11 +64,11 @@ class StaticViewer:
|
|||||||
description, lines, error = contentviews.get_message_content_view(
|
description, lines, error = contentviews.get_message_content_view(
|
||||||
'Auto', message
|
'Auto', message
|
||||||
)
|
)
|
||||||
with open(os.path.join(view_path, 'Auto'), 'w') as file:
|
with open(os.path.join(view_path, 'Auto.json'), 'w') as view_file:
|
||||||
json.dump(dict(
|
json.dump(dict(
|
||||||
lines=list(lines),
|
lines=list(lines),
|
||||||
description=description
|
description=description
|
||||||
), file)
|
), view_file)
|
||||||
|
|
||||||
def save_static(self) -> None:
|
def save_static(self) -> None:
|
||||||
"""
|
"""
|
||||||
@ -100,5 +100,5 @@ class StaticViewer:
|
|||||||
static.close()
|
static.close()
|
||||||
|
|
||||||
def save_filter_help(self) -> None:
|
def save_filter_help(self) -> None:
|
||||||
with open(os.path.join(self.path, '_filter-help'), 'w') as file:
|
with open(os.path.join(self.path, 'filter-help.json'), 'w') as file:
|
||||||
json.dump(dict(commands=flowfilter.help), file)
|
json.dump(dict(commands=flowfilter.help), file)
|
||||||
|
@ -51,8 +51,8 @@ export var MessageUtils = {
|
|||||||
}
|
}
|
||||||
if (global.MITMWEB_STATIC) {
|
if (global.MITMWEB_STATIC) {
|
||||||
let url = view ?
|
let url = view ?
|
||||||
`/flows/${flow.id}/${message}/content/${view}` :
|
`/flows/${flow.id}/${message}/content/${view}.json` :
|
||||||
`/flows/${flow.id}/${message}/_content`
|
`/flows/${flow.id}/${message}/content.json`
|
||||||
return url;
|
return url;
|
||||||
} else {
|
} else {
|
||||||
return `/flows/${flow.id}/${message}/content` + (view ? `/${view}` : '');
|
return `/flows/${flow.id}/${message}/content` + (view ? `/${view}` : '');
|
||||||
|
@ -86,7 +86,7 @@ export function fetchApi(url, options={}) {
|
|||||||
if (global.MITMWEB_STATIC) {
|
if (global.MITMWEB_STATIC) {
|
||||||
let path = url.split('/'),
|
let path = url.split('/'),
|
||||||
filename = path.pop()
|
filename = path.pop()
|
||||||
filename = '_' + filename
|
filename += '.json'
|
||||||
path.push(filename)
|
path.push(filename)
|
||||||
let new_url = path.join('/')
|
let new_url = path.join('/')
|
||||||
return _fetchApi(new_url, options)
|
return _fetchApi(new_url, options)
|
||||||
|
Loading…
Reference in New Issue
Block a user