diff --git a/core/files.js b/core/files.js index 47aebb9b..493c90d9 100644 --- a/core/files.js +++ b/core/files.js @@ -98,6 +98,10 @@ var files = { // jQuery BlockUI 'resources/jquery.blockUI/2.70/jquery.blockUI.min.jsm': true, + // jQuery Migrate + 'resources/jquery-migrate/1.4.1/jquery-migrate.min.jsm': true, + 'resources/jquery-migrate/3.1.0/jquery-migrate.min.jsm': true, + // jQuery UI 'resources/jqueryui/1.11.4/jquery-ui.min.jsm': true, @@ -129,7 +133,9 @@ var files = { 'resources/p2p-media-loader-core/0.6.2/p2p-media-loader-core.min.jsm': true, // plyr CSS - 'resources/plyr/3.5.10/plyr.min.cssm': true, + // CSS cannot be loaded with the file extension .cssm (as shown on www.bitchute.com) + // Please do not change it. + 'resources/plyr/3.5.10/plyr.min.css': true, // Prototype 'resources/prototype/1.7.3.0/prototype.jsm': true, @@ -147,6 +153,10 @@ var files = { // Scriptaculous 'resources/scriptaculous/1.9.0/scriptaculous.jsm': true, + // Select2 + 'resources/select2/4.0.12/select2.full.min.jsm': true, + 'resources/select2/4.0.12/select2.min.cssm': true, + // spin.js 'resources/spin.js/2.3.2/spin.min.jsm': true, diff --git a/core/mappings.js b/core/mappings.js index f2ca4b67..df4de74b 100644 --- a/core/mappings.js +++ b/core/mappings.js @@ -84,6 +84,7 @@ var mappings = { 'jquery/{version}/jquery.': resources.jQuery, 'jquery/{version}/jquery.min.': resources.jQuery, 'jquery.blockUI/{version}/jquery.blockUI.min.js': resources.jQueryBlockUI, + 'jquery-migrate/{version}/jquery-migrate.min.js': resources.jQueryMigrate, 'jqueryui/{version}/jquery-ui.js': resources.jQueryUI, 'jqueryui/{version}/jquery-ui.min.js': resources.jQueryUI, 'jquery-validate/{version}/jquery.validate.min.js': resources.jqueryValidationPlugin, @@ -98,6 +99,8 @@ var mappings = { 'rickshaw/{version}/rickshaw.min.css': resources.rickshawCSS, 'rickshaw/{version}/rickshaw.min.js': resources.rickshawJS, 'scriptaculous/{version}/scriptaculous.': resources.scriptaculous, + 'select2/{version}/js/select2.min.js': resources.select2js, + 'select2/{version}/css/select2.min.css': resources.select2css, 'spin.js/{version}/spin.min.js': resources.spinJS, 'swfobject/{version}/swfobject.': resources.swfobject, 'toastr.js/{version}/toastr.min.css': resources.toastrCSS, @@ -480,7 +483,7 @@ var mappings = { 'netdna.bootstrapcdn.com': { '/bootstrap/': { '{version}/js/bootstrap.min.': resources.bootstrapJS, - '{version}/css/bootstrap.min.': resources.bootstrapCSS, + '{version}/css/bootstrap.min.': resources.bootstrapCSS }, '/font-awesome/': { '{version}/css/font-awesome.css': resources.fontawesome diff --git a/core/request-analyzer.js b/core/request-analyzer.js index e33051a7..682506ca 100644 --- a/core/request-analyzer.js +++ b/core/request-analyzer.js @@ -99,6 +99,26 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel versionNumber = resourcePath.match(Resource.VERSION_EXPRESSION); resourcePattern = resourcePath.replace(versionNumber, Resource.VERSION_PLACEHOLDER); + /* + 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': '' + }; + } + + + for (let resourceMold of Object.keys(resourceMappings)) { if (resourcePattern.startsWith(resourceMold)) { diff --git a/core/resources.js b/core/resources.js index 7f860499..4bc0f5a9 100644 --- a/core/resources.js +++ b/core/resources.js @@ -135,6 +135,11 @@ var resources = { 'path': 'resources/jquery.blockUI/{version}/jquery.blockUI.min.jsm', 'type': 'application/javascript' }, + // jQuery Migrate + 'jQueryMigrate': { + 'path': 'resources/jquery-migrate/{version}/jquery-migrate.min.jsm', + 'type': 'application/javascript' + }, // jQuery UI 'jQueryUI': { 'path': 'resources/jqueryui/{version}/jquery-ui.min.jsm', @@ -187,7 +192,7 @@ var resources = { }, // plyr CSS 'plyrCSS': { - 'path': 'resources/plyr/{version}/plyr.min.cssm', + 'path': 'resources/plyr/{version}/plyr.min.css', 'type': 'text/css' }, // Prototype @@ -214,6 +219,15 @@ var resources = { 'path': 'resources/scriptaculous/{version}/scriptaculous.jsm', 'type': 'application/javascript' }, + // Select2 + 'select2css': { + 'path': 'resources/select2/{version}/select2.min.cssm', + 'type': 'text/css' + }, + 'select2js': { + 'path': 'resources/select2/{version}/select2.full.min.jsm', + 'type': 'application/javascript' + }, // spin.js 'spinJS': { 'path': 'resources/spin.js/{version}/spin.min.jsm', diff --git a/manifest.json b/manifest.json index dcf281c0..231e8245 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "LocalCDN (fork from Decentraleyes)", - "version": "2.1.9", + "version": "2.1.10", "browser_specific_settings": { "gecko": { "id": "{b86e4813-687a-43e6-ab65-0bde4ab75758}", diff --git a/modules/internal/helpers.js b/modules/internal/helpers.js index 5da35936..6c31f53c 100644 --- a/modules/internal/helpers.js +++ b/modules/internal/helpers.js @@ -194,6 +194,8 @@ helpers.determineCdnName = function (domainName) { return 'Cloudflare CDN'; case 'akamai-webcdn.kgstatic.net': return 'Akamai WebCDN'; + case 'netdna.bootstrapcdn.com': + return 'NetDNA'; default: return 'Unknown'; } @@ -251,6 +253,8 @@ helpers.determineResourceName = function (filename) { return 'jQuery UI'; case 'jquery.blockUI.min.jsm': return 'jQuery Block UI'; + case 'jquery-migrate.min.jsm': + return 'jQuery Migrate'; case 'jquery.validate.min.jsm': return 'jQuery jeditable'; case 'jquery.jeditable.min.jsm': @@ -283,6 +287,10 @@ helpers.determineResourceName = function (filename) { return 'rickshaw CSS'; case 'scriptaculous.jsm': return 'Scriptaculous'; + case 'select2.min.cssm': + return 'Select2 CSS'; + case 'select2.full.min.jsm': + return 'Select2 JS'; case 'spin.min.jsm': return 'spin.js'; case 'store.legacy.min.jsm': @@ -303,6 +311,8 @@ helpers.determineResourceName = function (filename) { return 'Vue.js'; case 'wow.min.jsm': return 'WOW'; + case 'jsdelivr-combine-jquery-hogan-algoliasearch-autocomplete.jsm': + return 'jsDelivr combined'; default: return 'Unknown'; } @@ -353,8 +363,6 @@ helpers.setLastVersion = function (type, version) { if(version !== null && version !== undefined) { requestVersion = version.toString(); - } else if (version === null) { - return 'latest'; } if (type.includes('/angularjs/1.')) { version = '1.7.9'; @@ -410,6 +418,10 @@ helpers.setLastVersion = function (type, version) { version = '1.11.4'; } else if (type.includes('/jquery.blockUI/2.')) { version = '2.70'; + } else if (type.includes('/jquery-migrate/1.')) { + version = '1.4.1'; + } else if (type.includes('/jquery-migrate/3.')) { + version = '3.1.0'; } else if (type.includes('/jquery-validate/1.')) { version = '1.19.1'; } else if (type.includes('/jquery-jeditable/1.')) { @@ -438,6 +450,8 @@ helpers.setLastVersion = function (type, version) { version = '1.6.6'; } else if (type.includes('/scriptaculous/1.')) { version = '1.9.0'; + } else if (type.includes('/select2/4.')) { + version = '4.0.12'; } else if (type.includes('/spin.js/2.')) { version = '2.3.2'; } else if (type.includes('/store.js/2.')) { @@ -460,6 +474,8 @@ helpers.setLastVersion = function (type, version) { version = '6.4.8'; } else if (type.includes('/wow/1.')) { version = '1.1.2'; + } else if (version === null) { + version = 'latest'; } return version; diff --git a/pages/popup/popup.js b/pages/popup/popup.js index 7fe2daff..071887b2 100644 --- a/pages/popup/popup.js +++ b/pages/popup/popup.js @@ -292,7 +292,8 @@ popup._createInjectionElement = function (injection) { if (injection.version !== null) { noteElement = document.createElement('span'); noteElement.setAttribute('class', 'side-note'); - noteTextNode = document.createTextNode(` v${injection.version}`); + let versionNode = (injection.version === 'beta') ? ` ${injection.version}` : ` v${injection.version}`; + noteTextNode = document.createTextNode(versionNode); noteElement.appendChild(noteTextNode); injectionElement.appendChild(noteElement); } diff --git a/pages/test/favicon.ico b/pages/test/favicon.ico deleted file mode 100644 index 7511c74e..00000000 Binary files a/pages/test/favicon.ico and /dev/null differ diff --git a/pages/test/logo-protected.svg b/pages/test/logo-protected.svg deleted file mode 100644 index caaab8d1..00000000 --- a/pages/test/logo-protected.svg +++ /dev/null @@ -1,105 +0,0 @@ - - - -image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pages/test/logo-unprotected.svg b/pages/test/logo-unprotected.svg deleted file mode 100644 index 3b9bc0ca..00000000 --- a/pages/test/logo-unprotected.svg +++ /dev/null @@ -1,105 +0,0 @@ - - - -image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pages/test/noto-sans/noto-sans-bold.woff2 b/pages/test/noto-sans/noto-sans-bold.woff2 deleted file mode 100644 index c996b690..00000000 Binary files a/pages/test/noto-sans/noto-sans-bold.woff2 and /dev/null differ diff --git a/pages/test/noto-sans/noto-sans-italic.woff2 b/pages/test/noto-sans/noto-sans-italic.woff2 deleted file mode 100644 index 0434423c..00000000 Binary files a/pages/test/noto-sans/noto-sans-italic.woff2 and /dev/null differ diff --git a/pages/test/noto-sans/noto-sans.woff2 b/pages/test/noto-sans/noto-sans.woff2 deleted file mode 100644 index 110e80e8..00000000 Binary files a/pages/test/noto-sans/noto-sans.woff2 and /dev/null differ diff --git a/pages/test/style.css b/pages/test/style.css deleted file mode 100644 index d97637cd..00000000 --- a/pages/test/style.css +++ /dev/null @@ -1,226 +0,0 @@ -/** -* Sections -*/ - -html { - background-color: #f8fcee; - box-sizing: border-box; - height: 100%; -} - -body { - background-color: #eff4e2; - box-sizing: border-box; - color: #777; - font-size: 14px; - margin: 0 auto; - max-width: 982px; - min-height: 100%; - min-width: 256px; - padding: 33px 18px; -} - -h1,h2 { - font-family: 'Noto Sans', Arial, sans-serif; - font-size: 24px; - font-weight: 400; - margin: 20px auto; - max-width: 750px; -} - -h2 { - font-size: 20px; -} - -a { - color: #777; -} - -.btn-panel { - cursor: default; - font-family: 'Noto Sans', Arial, sans-serif; - margin: 35px auto; - max-width: 750px; - display: flex; -} - -/** - * Fonts - */ - -@font-face { - font-family: 'Noto Sans'; - font-style: normal; - font-weight: 400; - src: url('./noto-sans/noto-sans.woff2') - format('woff2'); -} - -@font-face { - font-family: 'Noto Sans'; - font-style: normal; - font-weight: 600; - src: url('./noto-sans/noto-sans-bold.woff2') - format('woff2'); -} - -@font-face { - font-family: 'Noto Sans'; - font-style: italic; - font-weight: 400; - src: url('./noto-sans/noto-sans-italic.woff2') - format('woff2'); -} - -/** - * Buttons - */ - -.btn { - color: #fff; - font-weight: 600; - margin-right: 15px; - padding: 11px 17px; - text-decoration: none; - text-align: center; -} - -.btn-gitlab { - background-color: #24292e; -} - -.btn-gitlab:hover { - background-color: #42474c; -} - -.btn-website { - background-color: #007bbd; -} - -.btn-website:hover { - background-color: #00679e; -} - -.btn-donate { - background-color: #f7931a; -} - -.btn-donate:hover { - background-color: #f58700; -} - -.btn-author { - background-color: #00bd7f; -} - -.btn-author:hover { - background-color: #009e69; -} - -/** - * Miscellaneous - */ - -.notice { - align-items: center; - font-family: 'Noto Sans', Arial, sans-serif; - margin-left: auto; - margin-right: auto; - max-width: 750px; - text-align: left; -} - -.logo { - display: block; - height: 145px; - margin: 15px auto 50px; -} - -.subtle-hint { - background-color: #fcfcfc; - border-radius: 4px; - border: 1px solid #e6e6e6; - color: #777; - font-size: 14px; - margin-bottom: 20px; - padding: 8px 11px; -} - -.message { - background-color: #fff; - border-bottom: 1px solid #f5f5f5; - color: #575757; - overflow: hidden; - padding: 15px 15px 12px; - font-weight: bold; -} -.message-information { - background-color: #fff; - border: 1px solid #e3e3e3; - -webkit-box-shadow: none; - box-shadow: none; - color: #fff; - margin-top: 25px; - padding: 0; -} -.message-header { - background-color: #f3f3f3; - border-right: 1px solid #e9e9e9; - font-size: 20px; - margin-right: 8px; - padding: 16px 14.4px; - padding: 1rem .9rem; - vertical-align: middle; -} -.message-body, .message-header { - -webkit-box-sizing: border-box; - box-sizing: border-box; - display: table-cell; -} -.message-body { - background-color: #fff; - color: #5f5f5f; - font-weight: 400; - padding: 16px; - padding: 1rem; -} -.message-warning { - color: #c57400; -} -.message-success { - color: #339a6f; -} -.message-success a { - color: #268f5c; -} -.message-error { - color: #9a3333; -} - -/** - * Media Queries - */ - -@media screen and (max-width: 982px) { - - body { - box-shadow: none; - } -} - -@media screen and (max-width: 733px) { - - .btn-panel { - flex-wrap: wrap; - - } - .btn { - padding: 13px 18px 12px; - width: 100%; - margin-bottom: 10px; - } - - .btn-text { - width: 100%; - } -} diff --git a/pages/test/test.html b/pages/test/test.html deleted file mode 100644 index 31667cb7..00000000 --- a/pages/test/test.html +++ /dev/null @@ -1,39 +0,0 @@ - - - - LocalCDN | Testing Utility - - - - - - - - - - -
-

LocalCDN | Testing Utility

-
-
-
-
Determining status...
-
- - -
-
- -

Learn more, or contribute

-
- Website of Decentraleyes - LocalCDN @GitLab - Decentraleyes @GitLab - Donate to Decentraleyes - Author of Decentraleyes -
-
- - diff --git a/pages/test/test.js b/pages/test/test.js deleted file mode 100644 index dcc4cbb4..00000000 --- a/pages/test/test.js +++ /dev/null @@ -1,83 +0,0 @@ -function _logMessage(message) { - - var messageLog = document.getElementById('message-log'); - var contents = messageLog.innerHTML; - - contents = contents + message; - messageLog.innerHTML = contents; -} - -function _logWarningMessage(warningMessage) { - _logMessage('
' + warningMessage + '
'); -} - -function _logSuccessMessage(successMessage) { - _logMessage('
' + successMessage + '
'); -} - -function _logErrorMessage(errorMessage) { - _logMessage('
' + errorMessage + '
'); -} - -function _logoUnprotected() { - document.getElementById('logo').src = "logo-unprotected.svg"; -} - -function _logoProtected() { - document.getElementById('logo').src = "logo-protected.svg"; -} - -function updateProgress() { - - var progressIndicatorElement = document.getElementById('progress-indicator'); - progressIndicatorElement.innerHTML = ' All tests completed.'; -} - -function logOperationalNotice() { - _logSuccessMessage('LocalCDN is fully operational.'); - _logoProtected(); -} - -function logUnprotectedNotice() { - - _logWarningMessage('Your browser was able to connect to a blacklisted CDN.'); - _logErrorMessage('LocalCDN is not working as intended.'); - _logoUnprotected(); -} - -function logUnavailableNotice() { - - _logWarningMessage('The test resource could not be fetched locally or remotely.'); - _logErrorMessage('LocalCDN is not working as intended.'); -} - -window.onload = function () { - - if (window.jQuery) { - - jQuery.globalEval = function () {}; - - $.get('https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js', function (data, status, response) { - - updateProgress('completed'); - - if (response.getResponseHeader('cache-control') === 'no-cache') { - logOperationalNotice(); - } else if (response.getResponseHeader('content-type') === 'application/javascript;charset=UTF-8') { - logOperationalNotice(); - } else { - logUnprotectedNotice(); - } - - }).fail(function() { - - updateProgress('completed'); - logOperationalNotice(); - }); - - } else { - - updateProgress('completed'); - logUnavailableNotice(); - } -}; diff --git a/pages/updates/updates.html b/pages/updates/updates.html index e540838c..770dc21a 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -22,6 +22,29 @@
New in LocalCDN:
+ +
+ Please update your uBlock/uMatrix rules +
+
+ + +
+
+ + +
+ + +
+

History

+

2020-03-29 (v2.1.9)


-
- Please update your uBlock/uMatrix rules -
-
- - -
-
- - -
- - -
-

History

2020-03-25 (v2.1.7)