From cbdddefcc8f3ad19e50da5a31532c8abb0cb36f8 Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Mon, 14 Aug 2017 10:11:48 +0800 Subject: [PATCH] [web] change the path name like `_flows` to `flows.json`. --- mitmproxy/tools/web/static_viewer.py | 12 ++++++------ web/src/js/flow/utils.js | 4 ++-- web/src/js/utils.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mitmproxy/tools/web/static_viewer.py b/mitmproxy/tools/web/static_viewer.py index 20815fcd5..23228b3b4 100644 --- a/mitmproxy/tools/web/static_viewer.py +++ b/mitmproxy/tools/web/static_viewer.py @@ -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) diff --git a/web/src/js/flow/utils.js b/web/src/js/flow/utils.js index 9d4e10124..cb37822a4 100644 --- a/web/src/js/flow/utils.js +++ b/web/src/js/flow/utils.js @@ -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}` : ''); diff --git a/web/src/js/utils.js b/web/src/js/utils.js index 68daa1add..505f74df9 100644 --- a/web/src/js/utils.js +++ b/web/src/js/utils.js @@ -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)