This commit is contained in:
nobody 2020-03-20 08:14:31 +01:00
parent 02ce651295
commit 422557ca55
No known key found for this signature in database
GPG Key ID: AB5145CF05BFE119
6 changed files with 33 additions and 8 deletions

View File

@ -60,6 +60,7 @@ var files = {
'resources/fontawesome/5.7.2/css/all.css': true, 'resources/fontawesome/5.7.2/css/all.css': true,
// jQuery // jQuery
'resources/jquery/1.8.3/jquery.min.jsm': true,
'resources/jquery/1.12.4/jquery.min.jsm': true, 'resources/jquery/1.12.4/jquery.min.jsm': true,
'resources/jquery/2.2.4/jquery.min.jsm': true, 'resources/jquery/2.2.4/jquery.min.jsm': true,
'resources/jquery/3.4.1/jquery.min.jsm': true, 'resources/jquery/3.4.1/jquery.min.jsm': true,

View File

@ -105,9 +105,8 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
targetPath = resourceMappings[resourceMold].path; targetPath = resourceMappings[resourceMold].path;
targetPath = targetPath.replace(Resource.VERSION_PLACEHOLDER, versionNumber); targetPath = targetPath.replace(Resource.VERSION_PLACEHOLDER, versionNumber);
// Replace // Replace the requested version with the latest depending on major version
version = helpers.setLastVersion(targetPath, versionNumber);
version = helpers.setLastVersion(targetPath);
targetPath = targetPath.replace(versionNumber, version); targetPath = targetPath.replace(versionNumber, version);
hostShorthands = shorthands[channelHost]; hostShorthands = shorthands[channelHost];

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "LocalCDN (fork from Decentraleyes)", "name": "LocalCDN (fork from Decentraleyes)",
"version": "2.1.5.1", "version": "2.1.5.2",
"browser_specific_settings": { "browser_specific_settings": {
"gecko": { "gecko": {
"id": "{b86e4813-687a-43e6-ab65-0bde4ab75758}", "id": "{b86e4813-687a-43e6-ab65-0bde4ab75758}",

View File

@ -1,8 +1,9 @@
/** /**
* Internal Helper Module * Internal Helper Module
* Belongs to Decentraleyes. * Belongs to Decentraleyes/LocalCDN.
* *
* @author Thomas Rientjes * @author Thomas Rientjes
* @author nobody42
* @since 2017-10-26 * @since 2017-10-26
* @license MPL 2.0 * @license MPL 2.0
* *
@ -273,9 +274,11 @@ helpers.formatVersion = function (version) {
} }
}; };
helpers.setLastVersion = function (type) { helpers.setLastVersion = function (type, versionNumber) {
let version; let version, requestVersion;
requestVersion = versionNumber.toString();
if (type.includes('/angularjs/1.')) { if (type.includes('/angularjs/1.')) {
version = '1.7.9'; version = '1.7.9';
@ -308,7 +311,7 @@ helpers.setLastVersion = function (type) {
} else if (type.includes('/fontawesome/5.')) { } else if (type.includes('/fontawesome/5.')) {
version = '5.7.2'; version = '5.7.2';
} else if (type.includes('/jquery/1.')) { } else if (type.includes('/jquery/1.')) {
version = '1.12.4'; version = ( helpers.compareVersion('1.8.3', requestVersion )) ? '1.8.3' : '1.12.4';
} else if (type.includes('/jquery/2.')) { } else if (type.includes('/jquery/2.')) {
version = '2.2.4'; version = '2.2.4';
} else if (type.includes('/jquery/3.')) { } else if (type.includes('/jquery/3.')) {
@ -335,3 +338,22 @@ helpers.setLastVersion = function (type) {
return version; return version;
}; };
helpers.compareVersion = function (v1, v2) {
/**
* compareVersion( '1.5.7' , '1.5.8' ) is TRUE
* compareVersion( '1.5.8' , '1.5.7' ) is FALSE
* compareVersion( '1.5.7' , '1.5.7' ) is TRUE
*/
v1 = v1.split('.');
v2 = v2.split('.');
const k = Math.min(v1.length, v2.length);
for (let i = 0; i < k; ++ i) {
v1[i] = parseInt(v1[i], 10);
v2[i] = parseInt(v2[i], 10);
if (v1[i] > v2[i]) return true;
if (v1[i] < v2[i]) return false;
}
return v1.length == v2.length ? true: (v1.length < v2.length ? false : true);
}

View File

@ -24,6 +24,7 @@
</div> </div>
<ul> <ul>
<li>URL of testing utility updated</li> <li>URL of testing utility updated</li>
<li>Fixed: <a href="https://gitlab.com/nobody42/localcdn/-/issues/21">"Search on serienjunkies.org not working"</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