[web] change the path name like _flows to flows.json.

This commit is contained in:
Matthew Shao 2017-08-14 10:11:48 +08:00
parent 7d92cdf3bb
commit cbdddefcc8
3 changed files with 9 additions and 9 deletions

View File

@ -41,7 +41,7 @@ class StaticViewer:
self.flows.add(i)
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 = []
for f in self.flows:
flows.append(flow_to_json(f))
@ -54,8 +54,8 @@ class StaticViewer:
path = os.path.join(self.path, 'flows', f.id, m)
if not os.path.exists(path):
os.makedirs(path)
with open(os.path.join(path, '_content'), 'wb') as file:
file.write(message.raw_content)
with open(os.path.join(path, 'content.json'), 'wb') as content_file:
content_file.write(message.raw_content)
# content_view
view_path = os.path.join(path, 'content')
@ -64,11 +64,11 @@ class StaticViewer:
description, lines, error = contentviews.get_message_content_view(
'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(
lines=list(lines),
description=description
), file)
), view_file)
def save_static(self) -> None:
"""
@ -100,5 +100,5 @@ class StaticViewer:
static.close()
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)

View File

@ -51,8 +51,8 @@ export var MessageUtils = {
}
if (global.MITMWEB_STATIC) {
let url = view ?
`/flows/${flow.id}/${message}/content/${view}` :
`/flows/${flow.id}/${message}/_content`
`/flows/${flow.id}/${message}/content/${view}.json` :
`/flows/${flow.id}/${message}/content.json`
return url;
} else {
return `/flows/${flow.id}/${message}/content` + (view ? `/${view}` : '');

View File

@ -86,7 +86,7 @@ export function fetchApi(url, options={}) {
if (global.MITMWEB_STATIC) {
let path = url.split('/'),
filename = path.pop()
filename = '_' + filename
filename += '.json'
path.push(filename)
let new_url = path.join('/')
return _fetchApi(new_url, options)