Chromium: Attach Google Material Icons to Google Fonts (#857)

This commit is contained in:
nobody 2022-01-30 09:32:53 +01:00
parent 30a604c789
commit b61a032db1
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
2 changed files with 15 additions and 3 deletions

View File

@ -31,7 +31,7 @@ var interceptor = {};
*/
interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
let validCandidate, targetDetails, targetDomain;
let validCandidate, targetDetails, targetDomain, isGoogleFont, isGoogleMaterialIcons, initiatorDomain, isListed;
validCandidate = requestAnalyzer.isValidCandidate(requestDetails, tab);
if (!validCandidate) {
@ -49,9 +49,10 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
}
targetDomain = helpers.extractDomainFromUrl(requestDetails.url, true);
isGoogleFont = requestAnalyzer.isGoogleFont(targetDomain);
isGoogleMaterialIcons = requestAnalyzer.isGoogleMaterialIcons(requestDetails.url);
if (requestAnalyzer.isGoogleFont(targetDomain) && !requestAnalyzer.isGoogleMaterialIcons(requestDetails.url)) {
let initiatorDomain, isListed;
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
@ -64,6 +65,13 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) {
'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
};
}
targetDetails = requestAnalyzer.getLocalTarget(requestDetails, tab.url);

View File

@ -58,6 +58,10 @@
<li>search-insights v1.8.0, v2.2.1 (<a href="https://codeberg.org/nobody/LocalCDN/issues/843">#843</a>)</li>
<li>ngx-bootstrap v8.0.0 (<a href="https://codeberg.org/nobody/LocalCDN/issues/847">#847</a>)</li>
</ul>
<p>Improved</p>
<ul>
<li>Chromium: Attach Google Material Icons to Google Fonts (<a href="https://codeberg.org/nobody/LocalCDN/issues/857">#857</a>)</li>
</ul>
</div>
<div id="generator-section">
<div class="topic-label">