1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-06-05 21:49:31 +02:00

Initial commit to add wildcard for Google Fonts and HTML filters (#613)

This commit is contained in:
nobody
2021-08-07 08:39:10 +02:00
parent 67b67bbd68
commit 651d19bfa6
6 changed files with 13 additions and 11 deletions

View File

@@ -46,13 +46,16 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
if (Regex.GOOGLE_FONTS.test(requestDetails.url)) {
let initiatorDomain = helpers.extractDomainFromUrl(tab.url, true);
let initiatorDomain, isListed;
initiatorDomain = helpers.extractDomainFromUrl(tab.url, true);
isListed = helpers.checkAllowlisted(initiatorDomain, interceptor.allowedDomainsGoogleFonts);
// Check if the website is allowed to load Google Fonts
if (interceptor.blockGoogleFonts === true && !interceptor.allowedDomainsGoogleFonts[initiatorDomain]) {
if (interceptor.blockGoogleFonts === true && isListed === false) {
return {
'cancel': true
};
} else if (interceptor.blockGoogleFonts === false || interceptor.allowedDomainsGoogleFonts[initiatorDomain]) {
} else if (interceptor.blockGoogleFonts === false || isListed === true) {
return {
'cancel': false
};