Chromium: Remove option to block Google Fonts (#1085)

This commit is contained in:
nobody 2022-07-27 18:22:49 +02:00
parent 61957fb94f
commit f1fb6c9a17
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
7 changed files with 11 additions and 13 deletions

View File

@ -76,13 +76,6 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
'cancel': false 'cancel': false
}; };
} }
} else if (!BrowserType.FIREFOX && (isGoogleFont || isGoogleMaterialIcons)) {
initiatorDomain = helpers.extractDomainFromUrl(tab.url, true);
isListed = helpers.checkAllowlisted(initiatorDomain, interceptor.allowedDomainsGoogleFonts);
// Check if the website is allowed to load Google Fonts
return {
'cancel': interceptor.blockGoogleFonts === true && isListed === false
};
} }
if (targetDetails['result'] === false) { if (targetDetails['result'] === false) {

View File

@ -57,12 +57,6 @@ requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) {
log.append(tabDetails.url, requestDetails.url, LogString.FONT_AWESOME, true); log.append(tabDetails.url, requestDetails.url, LogString.FONT_AWESOME, true);
return false; return false;
} }
if (requestAnalyzer.isGoogleMaterialIcons(requestedDomain, requestDetails.url)) {
// also valid for Google Material icons
console.warn(`${LogString.PREFIX} ${LogString.GOOGLE_MATERIAL_ICONS}`);
log.append(tabDetails.url, requestDetails.url, LogString.GOOGLE_MATERIAL_ICONS, true);
return false;
}
} }
// Ignore requests if website is 'yandex.com' and CDN is 'yastatic.net', because website and CDN are the same. // Ignore requests if website is 'yandex.com' and CDN is 'yastatic.net', because website and CDN are the same.

View File

@ -294,6 +294,9 @@ stateManager.logging = false;
for (let mapping in mappings.cdn) { for (let mapping in mappings.cdn) {
let supportedHost = Address.ANY_PROTOCOL + mapping + Address.ANY_PATH; let supportedHost = Address.ANY_PROTOCOL + mapping + Address.ANY_PATH;
if (!BrowserType.FIREFOX && (mapping === 'fonts.gstatic.com' || mapping === 'fonts.googleapis.com')) {
continue;
}
stateManager.validHosts.push(supportedHost); stateManager.validHosts.push(supportedHost);
} }

View File

@ -38,6 +38,11 @@ ruleGenerator.openRuleSet = function ({target}) {
textArea.style.display = 'block'; textArea.style.display = 'block';
btnCopy.style.display = 'block'; btnCopy.style.display = 'block';
if (!BrowserType.FIREFOX) {
delete urls['fonts.googleapis.com'];
delete urls['fonts.gstatic.com'];
}
for (const domain in urls) { for (const domain in urls) {
if (key === 'uMatrix') { if (key === 'uMatrix') {
content += `* ${domain} script allow\n`; content += `* ${domain} script allow\n`;

View File

@ -59,6 +59,7 @@ optionsAdvanced.init = function (opt) {
if (BrowserType.CHROMIUM) { if (BrowserType.CHROMIUM) {
document.getElementById('html-filter-div').style.display = 'none'; document.getElementById('html-filter-div').style.display = 'none';
document.getElementById('block-google-fonts').style.display = 'none';
} }
document.getElementById('last-mapping-update').textContent += ` ${mappings.lastMappingUpdate}`; document.getElementById('last-mapping-update').textContent += ` ${mappings.lastMappingUpdate}`;

View File

@ -49,6 +49,7 @@ popup._renderContents = function () {
if (BrowserType.CHROMIUM) { if (BrowserType.CHROMIUM) {
document.getElementById('div-manipulateDOM').hidden = true; document.getElementById('div-manipulateDOM').hidden = true;
document.getElementById('div-google-fonts').hidden = true;
} }
}; };

View File

@ -39,6 +39,7 @@
<p>Improved</p> <p>Improved</p>
<ul> <ul>
<li>Chromium: Remove option to change badge color for HTML filter (<a href="https://codeberg.org/nobody/LocalCDN/issues/1082">#1082</a>)</li> <li>Chromium: Remove option to change badge color for HTML filter (<a href="https://codeberg.org/nobody/LocalCDN/issues/1082">#1082</a>)</li>
<li>Chromium: Remove option to block Google Fonts (<a href="https://codeberg.org/nobody/LocalCDN/issues/1085">#1085</a>)</li>
</ul> </ul>
</div> </div>
<div id="generator-section"> <div id="generator-section">