redirect outdated paths of font-awesome

This commit is contained in:
nobody 2024-09-15 11:37:04 +02:00
parent 67d4f0016f
commit 37c3e99921
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
4 changed files with 17 additions and 2 deletions

View File

@ -37,6 +37,7 @@
"GoogleDomains": true,
"ReqAnalyzer": true,
"MathJax3Files": true,
"RedirectMap": true,
"fileGuard": true,
"files": true,

View File

@ -466,6 +466,13 @@ const LogString = {
'IFRAME': 'Possible iframe request:',
};
const RedirectMap = {
'resources/font-awesome/3.2.1/css/all.min.css': 'resources/font-awesome/3.2.1/css/font-awesome.min.css',
'resources/font-awesome/3.2.1/css/all.css': 'resources/font-awesome/3.2.1/css/font-awesome.min.css',
'resources/font-awesome/4.7.0/css/all.min.css': 'resources/font-awesome/4.7.0/css/font-awesome.min.css',
'resources/font-awesome/4.7.0/css/all.css': 'resources/font-awesome/4.7.0/css/font-awesome.min.css'
};
/**
* https://codeberg.org/nobody/LocalCDN/issues/1560
*/

View File

@ -223,6 +223,8 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
break;
}
targetPath = requestAnalyzer._redirectTargetFile(targetPath);
// Prepare and return a local target.
return {
'source': channelHost,
@ -248,6 +250,11 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
};
};
requestAnalyzer._redirectTargetFile = function (targetPath) {
return RedirectMap[targetPath] || targetPath;
};
requestAnalyzer._getPathOfBundle = function (initiator, channelHost, channelPath, targetPath, bundle) {
let filename = channelPath.split('/').pop();

View File

@ -25,9 +25,9 @@
<h2>New in LocalCDN:</h2>
</div>
<div class="release-notes-area">
<p></p>
<p>Improved</p>
<ul>
<li></li>
<li>redirect outdated paths of font-awesome</li>
</ul>
</div>
<div id="generator-section">