From 168e2ae6a09e865219b6bd8c2a6fa4350c53ecd4 Mon Sep 17 00:00:00 2001 From: nobody Date: Sun, 23 Aug 2020 07:37:58 +0200 Subject: [PATCH] Fixed: Handling of Google Fonts (#85) --- core/interceptor.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/interceptor.js b/core/interceptor.js index f74a4e8e..520c7e43 100644 --- a/core/interceptor.js +++ b/core/interceptor.js @@ -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); }