From 44cf42d83937030e65d38d8b4727e6ac755df0e5 Mon Sep 17 00:00:00 2001 From: nobody Date: Tue, 17 Jan 2023 06:12:18 +0100 Subject: [PATCH] Allow Fork-Awesome in Chromium (#1296) --- core/constants.js | 2 +- core/request-analyzer.js | 21 ++++++++++++++++++--- pages/updates/updates.html | 4 ++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/core/constants.js b/core/constants.js index 38a75c27..9cccaa75 100644 --- a/core/constants.js +++ b/core/constants.js @@ -439,7 +439,7 @@ const BadResources = { const LogString = { 'PREFIX': '[ LocalCDN ]', - 'FONT_AWESOME': 'Font Awesome is not fully supported by your browser.', + 'NOT_SUPPORTED': 'is not fully supported by your browser.', 'GOOGLE_MATERIAL_ICONS': 'Google Material Icons are not fully supported by your browser.', 'YANDEX': 'Workaround. Disable LocalCDN if website and CDN are the same', 'REPLACED_RESOURCE': 'Replaced resource:', diff --git a/core/request-analyzer.js b/core/request-analyzer.js index 5255abe4..8698720c 100644 --- a/core/request-analyzer.js +++ b/core/request-analyzer.js @@ -52,9 +52,10 @@ requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) { // Font Awesome injections in Chromium deactivated (https://gitlab.com/nobody42/localcdn/-/issues/67) if (!BrowserType.FIREFOX) { - if (requestDetails.url.includes('font-awesome') || requestDetails.url.includes('fontawesome')) { - console.warn(`${LogString.PREFIX} ${LogString.FONT_AWESOME}`); - log.append(tabDetails.url, requestDetails.url, LogString.FONT_AWESOME, true); + let requestType = requestAnalyzer.chromeSupport(requestDetails.url); + if (requestType !== '') { + console.warn(`${LogString.PREFIX} ${requestType} ${LogString.NOT_SUPPORTED}`); + log.append(tabDetails.url, requestDetails.url, `${requestType} ${LogString.NOT_SUPPORTED}`, true); return false; } } @@ -69,6 +70,20 @@ requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) { return requestDetails.method === WebRequest.GET; }; +requestAnalyzer.chromeSupport = function (url) { + let value = ''; + + if (url.includes('font-awesome')) { + value = 'font-awesome'; + } else if (url.includes('fontawesome')) { + value = 'font-awesome'; + } else if (url.includes('fork-awesome')) { + value = 'fork-awesome'; + } + + return value; +}; + requestAnalyzer.isGoogleMaterialIcons = function (url) { return url.includes('Material+Icons') || url.includes('materialicons'); }; diff --git a/pages/updates/updates.html b/pages/updates/updates.html index 0b0c024c..b097f9a2 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -45,6 +45,10 @@ +

Improved

+