From 99bbe962795051da7378540b5eb59f861d33f51b Mon Sep 17 00:00:00 2001 From: nobody42 <5514211-nobody42@users.noreply.gitlab.com> Date: Sat, 2 May 2020 06:58:40 +0200 Subject: [PATCH] Font Awesome injections in Chromium deactivated (Fixed #67) --- core/constants.js | 4 ++++ core/request-analyzer.js | 7 +++++++ pages/updates/updates.html | 1 + 3 files changed, 12 insertions(+) diff --git a/core/constants.js b/core/constants.js index 4717df6b..1d07e9ac 100644 --- a/core/constants.js +++ b/core/constants.js @@ -88,3 +88,7 @@ const Whitelist = { 'TRIM_EXPRESSION': /^;+|;+$/g, 'VALUE_SEPARATOR': ';' }; + +const BrowserType = { + 'CHROMIUM': chrome.runtime.getURL("/").startsWith("chrome-extension") +} diff --git a/core/request-analyzer.js b/core/request-analyzer.js index 8ceeae62..233e5c48 100644 --- a/core/request-analyzer.js +++ b/core/request-analyzer.js @@ -30,6 +30,7 @@ var requestAnalyzer = {}; requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) { let initiatorDomain, isWhitelisted; + let fontawesome = new RegExp('\(font-awesome|fontawesome)'); initiatorDomain = helpers.extractDomainFromUrl(tabDetails.url, true); @@ -43,6 +44,12 @@ requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) { return false; } + // Font Awesome injections in Chromium deactivated (https://gitlab.com/nobody42/localcdn/-/issues/67) + if(BrowserType.CHROMIUM && fontawesome.test(requestDetails.url)) { + console.warn('[ LocalCDN ] Font Awesome is not fully supported by your browser.'); + return false; + } + // Only requests of type GET can be valid candidates. return requestDetails.method === WebRequest.GET; }; diff --git a/pages/updates/updates.html b/pages/updates/updates.html index 11f5a8d6..0d840ec5 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -27,6 +27,7 @@