mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-06-05 21:49:31 +02:00
Fixed #55
This commit is contained in:
@@ -25,6 +25,10 @@ var files = {
|
|||||||
// AlgoliaSearch
|
// AlgoliaSearch
|
||||||
'resources/algoliasearch/3.35.1/algoliasearch.min.jsm': true,
|
'resources/algoliasearch/3.35.1/algoliasearch.min.jsm': true,
|
||||||
|
|
||||||
|
// TEMPORARY SOLUTION
|
||||||
|
// algoliasearch@3(algoliasearchLite.min.js),algoliasearch.helper@2
|
||||||
|
'resources/algoliasearch3.33.0_algoliasearchLite_algoliasearchHelper.jsm': true,
|
||||||
|
|
||||||
// Angular Bootstrap
|
// Angular Bootstrap
|
||||||
'resources/angular-ui-bootstrap/1.3.3/ui-bootstrap-tpls.min.jsm': true,
|
'resources/angular-ui-bootstrap/1.3.3/ui-bootstrap-tpls.min.jsm': true,
|
||||||
|
|
||||||
|
@@ -214,6 +214,10 @@ var mappings = {
|
|||||||
'underscorejs/{version}/underscore.': resources.underscore,
|
'underscorejs/{version}/underscore.': resources.underscore,
|
||||||
'underscorejs/{version}/underscore-min.': resources.underscore,
|
'underscorejs/{version}/underscore-min.': resources.underscore,
|
||||||
'webfontloader/{version}/webfont': resources.webfont
|
'webfontloader/{version}/webfont': resources.webfont
|
||||||
|
},
|
||||||
|
// TEMPORARY SOLUTION
|
||||||
|
'/g/': {
|
||||||
|
'algoliasearch@3(algoliasearchLite.min.js),algoliasearch.helper@2': resources.algoliasearchSearchlightHelper
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Yandex CDN
|
// Yandex CDN
|
||||||
|
@@ -89,7 +89,7 @@ requestAnalyzer._matchBasePath = function (hostMappings, channelPath) {
|
|||||||
|
|
||||||
requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channelHost, channelPath) {
|
requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channelHost, channelPath) {
|
||||||
|
|
||||||
let resourcePath, versionNumber, resourcePattern, filename;
|
let resourcePath, versionNumber, resourcePattern, filename, shorthandResource;
|
||||||
|
|
||||||
chrome.storage.local.get(Setting.LOGGING, function (items) {
|
chrome.storage.local.get(Setting.LOGGING, function (items) {
|
||||||
requestAnalyzer.logging = items.enableLogging;
|
requestAnalyzer.logging = items.enableLogging;
|
||||||
@@ -99,26 +99,11 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
|
|||||||
versionNumber = resourcePath.match(Resource.VERSION_EXPRESSION);
|
versionNumber = resourcePath.match(Resource.VERSION_EXPRESSION);
|
||||||
resourcePattern = resourcePath.replace(versionNumber, Resource.VERSION_PLACEHOLDER);
|
resourcePattern = resourcePath.replace(versionNumber, Resource.VERSION_PLACEHOLDER);
|
||||||
|
|
||||||
/*
|
shorthandResource = shorthands.specialFiles(channelHost, channelPath);
|
||||||
NOTE:
|
if (shorthandResource) {
|
||||||
jsDelivr allows to load several files in one request
|
return shorthandResource;
|
||||||
This is just a workaround. If there are more websites which use this, we will have to do crazy things here to find and redirect these files.
|
|
||||||
|
|
||||||
It's not possible to respond to a request with multiple redirections
|
|
||||||
https://gitlab.com/nobody42/localcdn/-/issues/45
|
|
||||||
*/
|
|
||||||
let regexJsDelivr = RegExp(/\/combine.*jquery.*hogan.*algoliasearch.*autocomplete.*/);
|
|
||||||
if (channelHost.includes('cdn.jsdelivr.net') && regexJsDelivr.test(channelPath)) {
|
|
||||||
return {
|
|
||||||
'source': channelHost,
|
|
||||||
'version': 'beta',
|
|
||||||
'path': 'resources/jsdelivr-combine-jquery-hogan-algoliasearch-autocomplete.jsm',
|
|
||||||
'bundle': ''
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (let resourceMold of Object.keys(resourceMappings)) {
|
for (let resourceMold of Object.keys(resourceMappings)) {
|
||||||
|
|
||||||
if (resourcePattern.startsWith(resourceMold)) {
|
if (resourcePattern.startsWith(resourceMold)) {
|
||||||
|
@@ -24,6 +24,12 @@ var resources = {
|
|||||||
'path': 'resources/algoliasearch/3.35.1/algoliasearch.min.jsm',
|
'path': 'resources/algoliasearch/3.35.1/algoliasearch.min.jsm',
|
||||||
'type': 'application/javascript'
|
'type': 'application/javascript'
|
||||||
},
|
},
|
||||||
|
// TEMPORARY SOLUTION
|
||||||
|
// algoliasearch@3(algoliasearchLite.min.js),algoliasearch.helper@2
|
||||||
|
'algoliasearchSearchlightHelper': {
|
||||||
|
'path': 'resources/algoliasearch3.33.0_algoliasearchLite_algoliasearchHelper.jsm',
|
||||||
|
'type': 'application/javascript'
|
||||||
|
},
|
||||||
// AnguComplete
|
// AnguComplete
|
||||||
'anguComplete': {
|
'anguComplete': {
|
||||||
'path': 'resources/angucomplete-alt/{version}/angucomplete-alt.min.jsm',
|
'path': 'resources/angucomplete-alt/{version}/angucomplete-alt.min.jsm',
|
||||||
|
@@ -80,3 +80,33 @@ shorthands['sdn.geekzu.org'] = shorthands['ajax.googleapis.com'];
|
|||||||
|
|
||||||
// USTC Linux User Group [Mirror]
|
// USTC Linux User Group [Mirror]
|
||||||
shorthands['ajax.proxy.ustclug.org'] = shorthands['ajax.googleapis.com'];
|
shorthands['ajax.proxy.ustclug.org'] = shorthands['ajax.googleapis.com'];
|
||||||
|
|
||||||
|
shorthands.specialFiles = function (channelHost, channelPath) {
|
||||||
|
/*
|
||||||
|
NOTE:
|
||||||
|
jsDelivr allows to load several files in one request
|
||||||
|
This is just a workaround. If there are more websites which use this, we will have to do crazy things here to find and redirect these files.
|
||||||
|
|
||||||
|
It's not possible to respond to a request with multiple redirections
|
||||||
|
https://gitlab.com/nobody42/localcdn/-/issues/45
|
||||||
|
*/
|
||||||
|
let regexJsDelivr = RegExp(/\/combine.*jquery.*hogan.*algoliasearch.*autocomplete.*/);
|
||||||
|
if (channelHost.includes('cdn.jsdelivr.net') && regexJsDelivr.test(channelPath)) {
|
||||||
|
return {
|
||||||
|
'source': channelHost,
|
||||||
|
'version': 'beta',
|
||||||
|
'path': 'resources/jsdelivr-combine-jquery-hogan-algoliasearch-autocomplete.jsm',
|
||||||
|
'bundle': ''
|
||||||
|
};
|
||||||
|
} else if (channelHost.includes('cdn.jsdelivr.net') && channelPath.includes('algoliasearch@3(algoliasearchLite.min.js),algoliasearch.helper@2')) {
|
||||||
|
// https://gitlab.com/nobody42/localcdn/-/issues/55
|
||||||
|
return {
|
||||||
|
'source': channelHost,
|
||||||
|
'version': 'beta',
|
||||||
|
'path': 'resources/algoliasearch3.33.0_algoliasearchLite_algoliasearchHelper.jsm',
|
||||||
|
'bundle': ''
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@@ -345,6 +345,8 @@ helpers.determineResourceName = function (filename) {
|
|||||||
return 'WOW';
|
return 'WOW';
|
||||||
case 'jsdelivr-combine-jquery-hogan-algoliasearch-autocomplete.jsm':
|
case 'jsdelivr-combine-jquery-hogan-algoliasearch-autocomplete.jsm':
|
||||||
return 'jsDelivr combined';
|
return 'jsDelivr combined';
|
||||||
|
case 'algoliasearch3.33.0_algoliasearchLite_algoliasearchHelper.jsm':
|
||||||
|
return 'jsDelivr combined';
|
||||||
default:
|
default:
|
||||||
return 'Unknown';
|
return 'Unknown';
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
New in LocalCDN:
|
New in LocalCDN:
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
<li></li>
|
<li>Fixed <a href="https://gitlab.com/nobody42/localcdn/-/issues/55">#55</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="topic-label">
|
<div class="topic-label">
|
||||||
Please update your uBlock/uMatrix rules
|
Please update your uBlock/uMatrix rules
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user