1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-06-05 21:49:31 +02:00

Call CDNs directly to search something on the website (#1137)

This commit is contained in:
nobody
2022-09-18 08:23:13 +02:00
parent a94d670991
commit f2cc4bb2b8
3 changed files with 14 additions and 3 deletions

View File

@ -33,6 +33,13 @@ var interceptor = {};
interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
let validCandidate, targetDetails, targetDomain, isGoogleFont, isGoogleMaterialIcons, initiatorDomain, isListed;
if (requestDetails['type'] === WebRequestType.MAIN_FRAME &&
helpers.checkAllowlisted(tab.url, requestAnalyzer.allowlistedDomains)) {
return {
'cancel': false
};
}
targetDetails = requestAnalyzer.getLocalTarget(requestDetails, tab.url);
if (targetDetails['result'] === 'blocked') {
return {
@ -85,6 +92,9 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
return interceptor._handleMissingCandidate(requestDetails.url, tabIdentifier);
}
console.log(`${LogString.PREFIX} ${LogString.REPLACED_RESOURCE} ${targetDetails.path}`);
log.append(tab.url, requestDetails.url, targetDetails.path, false);
return {
'redirectUrl': chrome.runtime.getURL(targetDetails.path + fileGuard.secret)
};