1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2024-12-27 10:32:24 +01:00

Fixed: Handling of Google Fonts (#85)

This commit is contained in:
nobody 2020-08-23 07:37:58 +02:00
parent 6119cbd4e5
commit 168e2ae6a0
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A

View File

@ -42,15 +42,20 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
targetDetails = requestAnalyzer.getLocalTarget(requestDetails);
targetPath = targetDetails.path;
if (requestDetails.url.includes('fonts.googleapis.com') && !requestDetails.url.includes('Material+Icons')) {
if (Regex.GOOGLE_FONTS.test(requestDetails.url)) {
let initiatorDomain = helpers.extractDomainFromUrl(tab.url, true);
// Check if the website is allowed to load Google Fonts
if (interceptor.blockGoogleFonts === true && !requestAnalyzer.domainsGoogleFonts[initiatorDomain]) {
return {
'cancel': true
};
} else if (interceptor.blockGoogleFonts === false || requestAnalyzer.domainsGoogleFonts[initiatorDomain]) {
return {
'cancel': false
};
}
}
if (!targetDetails) {
return interceptor._handleMissingCandidate(requestDetails.url);
}