-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): upgrade kkt to ~7.1.5 & Migrating to Manifest V3
- Loading branch information
1 parent
4e950ee
commit 6a90313
Showing
11 changed files
with
29,380 additions
and
10,968 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
|
||
chrome.browserAction.onClicked.addListener(function () { | ||
chrome.management.getSelf(function (res) { | ||
// moz-extension://9dc71e1a-5801-b14e-906e-883d3c24d07e/7e4e10b3bb36ac2d03095a183833b2b1.html#/ | ||
chrome.tabs.create({ url: 'chrome-extension://' + res.id + '/index.html#normal' }); | ||
}); | ||
// chrome.tabs.create({ url: 'chrome://newtab' }); | ||
}); | ||
// chrome.action.onClicked.addListener(tab => { | ||
// chrome.management.getSelf(function (res) { | ||
// // moz-extension://9dc71e1a-5801-b14e-906e-883d3c24d07e/7e4e10b3bb36ac2d03095a183833b2b1.html#/ | ||
// chrome.tabs.create({ url: 'chrome-extension://' + res.id + '/index.html#normal' }); | ||
// }); | ||
// }); | ||
|
||
|
||
chrome.webRequest.onHeadersReceived.addListener(details => { | ||
const responseHeaders = details.responseHeaders.map(header => { | ||
const isCSPHeader = /content-security-policy/i.test(header.name); | ||
const isFrameHeader = /x-frame-options/i.test(header.name); | ||
if (isCSPHeader) { | ||
let csp = header.value | ||
// csp = csp.replace('script-src', `script-src ${hosts}`) | ||
// csp = csp.replace('style-src', `style-src ${hosts}`) | ||
// csp = csp.replace('frame-src', `frame-src ${iframeHosts}`) | ||
// csp = csp.replace('child-src', `child-src ${hosts}`) | ||
csp = csp.replace(/frame-ancestors (.*?);/ig, ""); | ||
// header.value = csp; | ||
header.value = csp + 'sandbox;'; | ||
} else if (isFrameHeader) { | ||
header.value = 'ALLOWALL'; | ||
} | ||
return header | ||
}); | ||
return { responseHeaders }; | ||
}, | ||
{ | ||
urls: ['<all_urls>', '*://*/*'], | ||
types: ['sub_frame'] | ||
}, | ||
[ | ||
'blocking', | ||
'responseHeaders' | ||
] | ||
) | ||
// chrome.webRequest.onHeadersReceived.addListener(details => { | ||
// const responseHeaders = details.responseHeaders.map(header => { | ||
// const isCSPHeader = /content-security-policy/i.test(header.name); | ||
// const isFrameHeader = /x-frame-options/i.test(header.name); | ||
// if (isCSPHeader) { | ||
// let csp = header.value | ||
// // csp = csp.replace('script-src', `script-src ${hosts}`) | ||
// // csp = csp.replace('style-src', `style-src ${hosts}`) | ||
// // csp = csp.replace('frame-src', `frame-src ${iframeHosts}`) | ||
// // csp = csp.replace('child-src', `child-src ${hosts}`) | ||
// csp = csp.replace(/frame-ancestors (.*?);/ig, ""); | ||
// // header.value = csp; | ||
// header.value = csp + 'sandbox;'; | ||
// } else if (isFrameHeader) { | ||
// header.value = 'ALLOWALL'; | ||
// } | ||
// return header | ||
// }); | ||
// return { responseHeaders }; | ||
// }, | ||
// { | ||
// urls: ['<all_urls>', '*://*/*'], | ||
// types: ['sub_frame'] | ||
// }, | ||
// [ | ||
// 'blocking', | ||
// 'responseHeaders' | ||
// ] | ||
// ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.