mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
basic file up and download working
This commit is contained in:
parent
cf544318ae
commit
a219d33430
@ -178,6 +178,7 @@ class DumpFlows(RequestHandler):
|
||||
sio.close()
|
||||
|
||||
def post(self):
|
||||
# self.state.clear()
|
||||
sio = StringIO(self.request.body)
|
||||
self.state.load_flows(FlowReader(sio).stream())
|
||||
sio.close()
|
||||
|
@ -122,7 +122,7 @@ export var FlowActions = {
|
||||
upload: (file) => {
|
||||
var filereader = new FileReader();
|
||||
filereader.file = file;
|
||||
filereader.onload = (e) => $.post("/flows/dump", e.target.result);
|
||||
filereader.onload = (e) => {$.post("/flows/dump", e.target.result); e.preventDefault();};
|
||||
filereader.readAsBinaryString(file);
|
||||
}
|
||||
};
|
||||
|
@ -344,11 +344,15 @@ var FileMenu = React.createClass({
|
||||
}
|
||||
},
|
||||
handleOpenClick: function (e) {
|
||||
$('#uploadFileInput').trigger('click');
|
||||
e.preventDefault();
|
||||
},
|
||||
handleOpenChange: function (e) {
|
||||
handleOpenFile: function (e) {
|
||||
if (e.target.files.length > 0) {
|
||||
FlowActions.upload(e.target.files[0]);
|
||||
$('#uploadFileInput').val("");
|
||||
}
|
||||
e.preventDefault();
|
||||
FlowActions.upload(e.target.files[0]);
|
||||
},
|
||||
handleSaveClick: function (e) {
|
||||
e.preventDefault();
|
||||
@ -372,7 +376,12 @@ var FileMenu = React.createClass({
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<input type="file" onChange={this.handleOpenChange}/>
|
||||
<a href="#" onClick={this.handleOpenClick}>
|
||||
<i className="fa fa-fw fa-folder-open"></i>
|
||||
Open...
|
||||
</a>
|
||||
<input id="uploadFileInput" className="hidden" type="file" onChange={this.handleOpenFile}/>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" onClick={this.handleSaveClick}>
|
||||
|
Loading…
Reference in New Issue
Block a user