-
Notifications
You must be signed in to change notification settings - Fork 0
/
bg.js
24 lines (24 loc) · 994 Bytes
/
bg.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
chrome.webRequest.onHeadersReceived.addListener(
details => {
let idCSPHeader = details.responseHeaders.findIndex(header => /content-security-policy/i.test(header.name));
if (-1 != idCSPHeader) {
details.responseHeaders[idCSPHeader].value = details.responseHeaders[idCSPHeader].value.replace(
"img-src", "img-src https://*.cdninstagram.com");
details.responseHeaders[idCSPHeader].value = details.responseHeaders[idCSPHeader].value.replace(
"media-src", "media-src https://*.cdninstagram.com");
details.responseHeaders[idCSPHeader].value = details.responseHeaders[idCSPHeader].value.replace(
"connect-src", "connect-src https://www.instagram.com");
}
return {
responseHeaders: details.responseHeaders,
};
},
{
urls: ["*://twitter.com/*"],
types: ["main_frame"],
},
[
"blocking",
"responseHeaders",
]
);