Refactor:Align indent

This commit is contained in:
FoxRefire 2024-06-25 11:11:08 +09:00
parent e0d6e3079e
commit 4237a5bb60
2 changed files with 45 additions and 45 deletions

View File

@ -40,35 +40,35 @@ chrome.webRequest.onBeforeSendHeaders.addListener(
//Get requestBody from POST requests
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
if (details.method === "POST") {
window.bodys.push({
body:details.requestBody.raw ? btoa(String.fromCharCode(...new Uint8Array(details.requestBody.raw[0]['bytes']))) : "",
id:details.requestId
});
}
},
{urls: ["<all_urls>"]},
["requestBody"]
function(details) {
if (details.method === "POST") {
window.bodys.push({
body:details.requestBody.raw ? btoa(String.fromCharCode(...new Uint8Array(details.requestBody.raw[0]['bytes']))) : "",
id:details.requestId
});
}
},
{urls: ["<all_urls>"]},
["requestBody"]
);
//Receive PSSH from content.js
chrome.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
switch(request.type){
case "RESET":
location.reload()
break;
case "PSSH":
window.psshs.push(request.text)
window.pageURL=sender.tab.url
window.targetIds=[sender.tab.id, sender.frameId]
break;
case "CLEARKEY":
window.clearkey=request.text
break;
function (request, sender, sendResponse) {
switch(request.type){
case "RESET":
location.reload()
break;
case "PSSH":
window.psshs.push(request.text)
window.pageURL=sender.tab.url
window.targetIds=[sender.tab.id, sender.frameId]
break;
case "CLEARKEY":
window.clearkey=request.text
break;
}
}
}
);
} )()

View File

@ -12,34 +12,34 @@ if (window === window.parent){
//Send PSSH into background.js
document.addEventListener('pssh', (e) => {
chrome.runtime.sendMessage({
type: "PSSH",
text: e.detail
},null);
chrome.runtime.sendMessage({
type: "PSSH",
text: e.detail
},null);
});
//Send Clearkey into background.js
document.addEventListener('clearkey', (e) => {
chrome.runtime.sendMessage({
type: "CLEARKEY",
text: e.detail
},null);
chrome.runtime.sendMessage({
type: "CLEARKEY",
text: e.detail
},null);
});
//Fetch from original origin
chrome.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
if(request.type=="FETCH"){
let res = fetch(request.u, {
method: request.m,
headers: JSON.parse(request.h),
body: Uint8Array.from(atob(request.b), c => c.charCodeAt(0))
}).then((r)=>r.arrayBuffer()).then((r)=>{
sendResponse(
btoa(String.fromCharCode(...new Uint8Array(r)))
);
})
function (request, sender, sendResponse) {
if(request.type=="FETCH"){
let res = fetch(request.u, {
method: request.m,
headers: JSON.parse(request.h),
body: Uint8Array.from(atob(request.b), c => c.charCodeAt(0))
}).then((r)=>r.arrayBuffer()).then((r)=>{
sendResponse(
btoa(String.fromCharCode(...new Uint8Array(r)))
);
})
}
return true
}
return true
}
);