mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-06-05 21:49:31 +02:00
Added Google Material Icons v3.0.1 (#41)
This commit is contained in:
@@ -57,11 +57,15 @@ requestAnalyzer.isValidCandidate = function (requestDetails, tabDetails) {
|
||||
requestAnalyzer.getLocalTarget = function (requestDetails) {
|
||||
|
||||
let destinationUrl, destinationHost, destinationPath, hostMappings, basePath, resourceMappings;
|
||||
let destinationSearchString = '';
|
||||
|
||||
destinationUrl = new URL(requestDetails.url);
|
||||
|
||||
destinationHost = destinationUrl.host;
|
||||
destinationPath = destinationUrl.pathname;
|
||||
if (destinationUrl.search) {
|
||||
destinationSearchString = destinationUrl.search;
|
||||
}
|
||||
|
||||
// Use the proper mappings for the targeted host.
|
||||
hostMappings = mappings[destinationHost];
|
||||
@@ -79,7 +83,7 @@ requestAnalyzer.getLocalTarget = function (requestDetails) {
|
||||
}
|
||||
|
||||
// Return either the local target's path or false.
|
||||
return requestAnalyzer._findLocalTarget(resourceMappings, basePath, destinationHost, destinationPath);
|
||||
return requestAnalyzer._findLocalTarget(resourceMappings, basePath, destinationHost, destinationPath, destinationSearchString);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -98,7 +102,7 @@ requestAnalyzer._matchBasePath = function (hostMappings, channelPath) {
|
||||
return false;
|
||||
};
|
||||
|
||||
requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channelHost, channelPath) {
|
||||
requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channelHost, channelPath, destinationSearchString) {
|
||||
|
||||
let resourcePath, versionNumber, resourcePattern, filename, shorthandResource;
|
||||
|
||||
@@ -110,7 +114,7 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
|
||||
versionNumber = resourcePath.match(Resource.VERSION_EXPRESSION);
|
||||
resourcePattern = resourcePath.replace(versionNumber, Resource.VERSION_PLACEHOLDER);
|
||||
|
||||
shorthandResource = shorthands.specialFiles(channelHost, channelPath);
|
||||
shorthandResource = shorthands.specialFiles(channelHost, channelPath, destinationSearchString);
|
||||
if (shorthandResource) {
|
||||
if (requestAnalyzer.logging) {
|
||||
console.log('[ LocalCDN ] Replaced resource: ' + shorthandResource.path);
|
||||
|
||||
Reference in New Issue
Block a user