added web_response
This commit is contained in:
@@ -286,6 +286,18 @@ fplay.tab_inject_js = async function(ws, tabid, js, isolated = false){
|
||||
};
|
||||
}
|
||||
|
||||
fplay.web_response_whitelist = async function(ws, sources = ["main_frame", "xmlhttprequest"]){
|
||||
|
||||
var whitelist_status = await fplay.send(ws, "web_response_whitelist", {"list": sources});
|
||||
|
||||
if(typeof whitelist_status.status === "boolean"){
|
||||
|
||||
return whitelist_status.status;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
@@ -471,6 +483,11 @@ fplay.event.on("dom_ready", function(data){
|
||||
promise.resolve(data);
|
||||
}
|
||||
});
|
||||
/*
|
||||
fplay.event.on("web_response", function(data){
|
||||
|
||||
console.log(data);
|
||||
});*/
|
||||
|
||||
fplay.event.on("dom_load_fail", function(data){
|
||||
|
||||
@@ -512,6 +529,12 @@ fplay.wss.on("connection", async function(ws){
|
||||
return;
|
||||
}
|
||||
|
||||
if(msg.action == "web_response"){
|
||||
|
||||
// decode base64 as a buffer
|
||||
msg.data.body = Buffer.from(msg.data.body, "base64");
|
||||
}
|
||||
|
||||
// any other message should be an unsolicited event
|
||||
fplay.event.emit(msg.action, msg.data);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user