1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-02-18 12:50:49 +01: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
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
3 changed files with 14 additions and 3 deletions

View File

@ -33,6 +33,13 @@ var interceptor = {};
interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) { interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
let validCandidate, targetDetails, targetDomain, isGoogleFont, isGoogleMaterialIcons, initiatorDomain, isListed; 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); targetDetails = requestAnalyzer.getLocalTarget(requestDetails, tab.url);
if (targetDetails['result'] === 'blocked') { if (targetDetails['result'] === 'blocked') {
return { return {
@ -85,6 +92,9 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
return interceptor._handleMissingCandidate(requestDetails.url, tabIdentifier); 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 { return {
'redirectUrl': chrome.runtime.getURL(targetDetails.path + fileGuard.secret) 'redirectUrl': chrome.runtime.getURL(targetDetails.path + fileGuard.secret)
}; };

View File

@ -202,9 +202,6 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
break; break;
} }
console.log(`${LogString.PREFIX} ${LogString.REPLACED_RESOURCE} ${targetPath}`);
log.append(initiator, channelHost + channelPath, targetPath, false);
// Prepare and return a local target. // Prepare and return a local target.
return { return {
'source': channelHost, 'source': channelHost,

View File

@ -50,6 +50,10 @@
<li>jquery-minicolors v2.3.6 (<a href="https://codeberg.org/nobody/LocalCDN/issues/1127">#1127</a>)</li> <li>jquery-minicolors v2.3.6 (<a href="https://codeberg.org/nobody/LocalCDN/issues/1127">#1127</a>)</li>
<li>in-view v0.6.1 (<a href="https://codeberg.org/nobody/LocalCDN/issues/1127">#1127</a>)</li> <li>in-view v0.6.1 (<a href="https://codeberg.org/nobody/LocalCDN/issues/1127">#1127</a>)</li>
</ul> </ul>
<p>Improved</p>
<ul>
<li>Call CDNs directly to search something on the website (<a href="https://codeberg.org/nobody/LocalCDN/issues/1137">#1137</a>)</li>
</ul>
</div> </div>
<div id="generator-section"> <div id="generator-section">
<div class="topic-label"> <div class="topic-label">