Allow Fork-Awesome in Chromium (#1296)

This commit is contained in:
nobody 2023-01-17 06:12:18 +01:00
parent 5312bbc8aa
commit 44cf42d839
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
3 changed files with 23 additions and 4 deletions

View File

@ -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:',

View File

@ -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');
};

View File

@ -45,6 +45,10 @@
<ul>
<li>Direct call of Google Material Icons (<a href="https://codeberg.org/nobody/LocalCDN/issues/1295">#1295</a>)</li>
</ul>
<p>Improved</p>
<ul>
<li>Allow Fork-Awesome in Chromium (<a href="https://codeberg.org/nobody/LocalCDN/issues/1296">#1296</a>)</li>
</ul>
</div>
<div id="generator-section">
<div class="topic-label">