mirror of
https://github.com/hama3254/Crunchyroll-Downloader-v3.0.git
synced 2024-11-14 12:15:07 +01:00
9f6cdbb705
port config and default subtitles added
33 lines
954 B
JavaScript
33 lines
954 B
JavaScript
browser.webRequest.onHeadersReceived.addListener(
|
|
details => {
|
|
browser.test.log(`onHeadersReceived ${JSON.stringify(details)}\n`);
|
|
if (!details.fromCache) {
|
|
//console.log("not cached");
|
|
browser.test.sendMessage("statusCode", details.statusCode);
|
|
const mime = details.responseHeaders.find(header => {
|
|
return header.value && header.name === "Server";
|
|
});
|
|
if (mime) {
|
|
//console.log(mime.value);
|
|
browser.runtime.sendMessage({
|
|
Server: mime.value
|
|
});
|
|
|
|
} else {
|
|
details.responseHeaders.push({
|
|
name: "Content-Security-Policy",
|
|
value: "upgrade-insecure-requests",
|
|
});
|
|
}
|
|
|
|
return {
|
|
responseHeaders: details.responseHeaders,
|
|
};
|
|
} else {
|
|
console.log("cached");
|
|
}
|
|
}, {
|
|
urls: ["http://127.0.0.1/*"],
|
|
},
|
|
["blocking", "responseHeaders"]);
|