From b75235f3062b3cb0db19162036df495bbe32dc62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20R=C3=B6bert?= Date: Sun, 4 Aug 2019 19:48:26 +0200 Subject: [PATCH] Version 1.7.1 #217 #218 #220 #221 --- CHANGELOG.md | 15 + clearurls.js | 976 +++++++++++++++++++++++---------------------- data/data.min.json | 202 +++++++--- manifest.json | 2 +- 4 files changed, 656 insertions(+), 539 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b408fd..6a9f689 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.7.1] - 2019-08-04 + +### Compatibility note +- Require Firefox >= 55 +- Require Chrome >= 22 + +### Added +- Added new setting to data.min.json to set if redirects should be enforced via a "tabs.update" ([#221](https://gitlab.com/KevinRoebert/ClearUrls/issues/221)) +- Added [#220](https://gitlab.com/KevinRoebert/ClearUrls/issues/220) +- Added [#218](https://gitlab.com/KevinRoebert/ClearUrls/issues/218) + +### Fixed +- Fixed YouTube ad redirection bug ([#221](https://gitlab.com/KevinRoebert/ClearUrls/issues/221)) +- Fixed [#217](https://gitlab.com/KevinRoebert/ClearUrls/issues/217) + ## [1.7.0] - 2019-07-30 ### Compatibility note diff --git a/clearurls.js b/clearurls.js index bf11cb6..c44a831 100644 --- a/clearurls.js +++ b/clearurls.js @@ -228,524 +228,540 @@ function start() for(var p = 0; p < prvKeys.length; p++) { //Create new provider - providers.push(new Provider(prvKeys[p],data.providers[prvKeys[p]].completeProvider)); + providers.push(new Provider(prvKeys[p], data.providers[prvKeys[p]].completeProvider, + data.providers[prvKeys[p]].forceRedirection)); - //Add URL Pattern - providers[p].setURLPattern(data.providers[prvKeys[p]].urlPattern); + //Add URL Pattern + providers[p].setURLPattern(data.providers[prvKeys[p]].urlPattern); - //Add rules to provider - for(var r = 0; r < data.providers[prvKeys[p]].rules.length; r++) - { - providers[p].addRule(data.providers[prvKeys[p]].rules[r]); - } + //Add rules to provider + for(var r = 0; r < data.providers[prvKeys[p]].rules.length; r++) + { + providers[p].addRule(data.providers[prvKeys[p]].rules[r]); + } - //Add raw rules to provider - for(var raw = 0; raw < data.providers[prvKeys[p]].rawRules.length; raw++) - { - providers[p].addRawRule(data.providers[prvKeys[p]].rawRules[raw]); - } + //Add raw rules to provider + for(var raw = 0; raw < data.providers[prvKeys[p]].rawRules.length; raw++) + { + providers[p].addRawRule(data.providers[prvKeys[p]].rawRules[raw]); + } - //Add exceptions to provider - for(var e = 0; e < data.providers[prvKeys[p]].exceptions.length; e++) - { - providers[p].addException(data.providers[prvKeys[p]].exceptions[e]); - } + //Add exceptions to provider + for(var e = 0; e < data.providers[prvKeys[p]].exceptions.length; e++) + { + providers[p].addException(data.providers[prvKeys[p]].exceptions[e]); + } - //Add redirections to provider - for(var re = 0; re < data.providers[prvKeys[p]].redirections.length; re++) - { - providers[p].addRedirection(data.providers[prvKeys[p]].redirections[re]); + //Add redirections to provider + for(var re = 0; re < data.providers[prvKeys[p]].redirections.length; re++) + { + providers[p].addRedirection(data.providers[prvKeys[p]].redirections[re]); + } } } - } - /** - * Convert the external data to Objects and - * call the create provider function. - * - * @param {String} retrievedText - pure data form github - */ - function toObject(retrievedText) { - getKeys(storage.ClearURLsData.providers); - createProviders(); - } + /** + * Convert the external data to Objects and + * call the create provider function. + * + * @param {String} retrievedText - pure data form github + */ + function toObject(retrievedText) { + getKeys(storage.ClearURLsData.providers); + createProviders(); + } - /** - * Get the hash for the rule file on github. - * Check the hash with the hash form the local file. - * If the hash has changed, then download the new rule file. - * Else do nothing. - */ - function getHash() - { - //Get the target hash from github - fetch(storage.hashURL) - .then(function(response){ - var responseTextHash = response.clone().text().then(function(responseTextHash){ - if(response.ok && $.trim(responseTextHash)) - { - dataHash = responseTextHash; - - if($.trim(dataHash) !== $.trim(localDataHash)) + /** + * Get the hash for the rule file on github. + * Check the hash with the hash form the local file. + * If the hash has changed, then download the new rule file. + * Else do nothing. + */ + function getHash() + { + //Get the target hash from github + fetch(storage.hashURL) + .then(function(response){ + var responseTextHash = response.clone().text().then(function(responseTextHash){ + if(response.ok && $.trim(responseTextHash)) { - fetchFromURL(); + dataHash = responseTextHash; + + if($.trim(dataHash) !== $.trim(localDataHash)) + { + fetchFromURL(); + } + else { + toObject(storage.ClearURLsData); + storeHashStatus(1); + } } else { + dataHash = false; + } + }); + }); + } + + /* + * ################################################################## + * # Fetch Rules & Exception from URL # + * ################################################################## + */ + function fetchFromURL() + { + fetch(storage.ruleURL) + .then(checkResponse); + + function checkResponse(response) + { + var responseText = response.clone().text().then(function(responseText){ + if(response.ok && $.trim(responseText)) + { + var downloadedFileHash = $.sha256(responseText); + + if($.trim(downloadedFileHash) === $.trim(dataHash)) + { + storage.ClearURLsData = responseText; + storage.dataHash = downloadedFileHash; + storeHashStatus(2); + } + else { + storeHashStatus(3); + } + storage.ClearURLsData = JSON.parse(storage.ClearURLsData); toObject(storage.ClearURLsData); - storeHashStatus(1); + } + }); + } + } + + // ################################################################## + + /* + * ################################################################## + * # Supertyp Provider # + * ################################################################## + */ + /** + * Declare constructor + * + * @param {String} _name Provider name + * @param {boolean} _completeProvider Set URL Pattern as rule + * @param {boolean} _forceRedirection Whether redirects should be enforced via a "tabs.update" + * @param {boolean} _isActive Is the provider active? + */ + function Provider(_name, _completeProvider = false, _forceRedirection = false, _isActive = true){ + var name = _name; + var urlPattern; + var enabled_rules = {}; + var disabled_rules = {}; + var enabled_exceptions = {}; + var disabled_exceptions = {}; + var canceling = _completeProvider; + var enabled_redirections = {}; + var disabled_redirections = {}; + var active = _isActive; + var enabled_rawRules = {}; + var disabled_rawRules = {}; + + if(_completeProvider){ + enabled_rules[".*"] = true; + } + + /** + * Returns whether redirects should be enforced via a "tabs.update" + * @return {boolean} whether redirects should be enforced + */ + this.shouldForceRedirect = function() { + return _forceRedirection; + }; + + /** + * Returns the provider name. + * @return {String} + */ + this.getName = function() { + return name; + }; + + /** + * Add URL pattern. + * + * @require urlPatterns as RegExp + */ + this.setURLPattern = function(urlPatterns) { + urlPattern = new RegExp(urlPatterns, "i"); + }; + + /** + * Return if the Provider Request is canceled + * @return {Boolean} isCanceled + */ + this.isCaneling = function() { + return canceling; + }; + + /** + * Check the url is matching the ProviderURL. + * + * @return {boolean} ProviderURL as RegExp + */ + this.matchURL = function(url) { + return urlPattern.test(url) && !(this.matchException(url)); + }; + + /** + * Add a rule to the rule array + * and replace old rule with new rule. + * + * @param {String} rule RegExp as string + * @param {boolean} isActive Is this rule active? + */ + this.addRule = function(rule, isActive = true) { + rule = "([\\/|\\?|#]|(&|&))+("+rule+"=[^\\/|\\?|&]*)"; + + if(isActive) + { + enabled_rules[rule] = true; + + if(disabled_rules[rule] !== undefined) + { + delete disabled_rules[rule]; } } else { - dataHash = false; - } - }); - }); - } + disabled_rules[rule] = true; - /* - * ################################################################## - * # Fetch Rules & Exception from URL # - * ################################################################## - */ - function fetchFromURL() - { - fetch(storage.ruleURL) - .then(checkResponse); - - function checkResponse(response) - { - var responseText = response.clone().text().then(function(responseText){ - if(response.ok && $.trim(responseText)) - { - var downloadedFileHash = $.sha256(responseText); - - if($.trim(downloadedFileHash) === $.trim(dataHash)) + if(enabled_rules[rule] !== undefined) { - storage.ClearURLsData = responseText; - storage.dataHash = downloadedFileHash; - storeHashStatus(2); + delete enabled_rules[rule]; } - else { - storeHashStatus(3); - } - storage.ClearURLsData = JSON.parse(storage.ClearURLsData); - toObject(storage.ClearURLsData); } - }); - } - } - - // ################################################################## - - /* - * ################################################################## - * # Supertyp Provider # - * ################################################################## - */ - /** - * Declare constructor - * - * @param {String} _name Provider name - * @param {boolean} _completeProvider Set URL Pattern as rule - * @param {boolean} _isActive Is the provider active? - */ - function Provider(_name, _completeProvider = false, _isActive = true){ - var name = _name; - var urlPattern; - var enabled_rules = {}; - var disabled_rules = {}; - var enabled_exceptions = {}; - var disabled_exceptions = {}; - var canceling = _completeProvider; - var enabled_redirections = {}; - var disabled_redirections = {}; - var active = _isActive; - var enabled_rawRules = {}; - var disabled_rawRules = {}; - - if(_completeProvider){ - enabled_rules[".*"] = true; - } - - /** - * Returns the provider name. - * @return {String} - */ - this.getName = function() { - return name; - }; - - /** - * Add URL pattern. - * - * @require urlPatterns as RegExp - */ - this.setURLPattern = function(urlPatterns) { - urlPattern = new RegExp(urlPatterns, "i"); - }; - - /** - * Return if the Provider Request is canceled - * @return {Boolean} isCanceled - */ - this.isCaneling = function() { - return canceling; - }; - - /** - * Check the url is matching the ProviderURL. - * - * @return {boolean} ProviderURL as RegExp - */ - this.matchURL = function(url) { - return urlPattern.test(url) && !(this.matchException(url)); - }; - - /** - * Add a rule to the rule array - * and replace old rule with new rule. - * - * @param {String} rule RegExp as string - * @param {boolean} isActive Is this rule active? - */ - this.addRule = function(rule, isActive = true) { - rule = "([\\/|\\?|#]|(&|&))+("+rule+"=[^\\/|\\?|&]*)"; - - if(isActive) - { - enabled_rules[rule] = true; - - if(disabled_rules[rule] !== undefined) - { - delete disabled_rules[rule]; - } - } - else { - disabled_rules[rule] = true; - - if(enabled_rules[rule] !== undefined) - { - delete enabled_rules[rule]; - } - } - }; - - /** - * Return all active rules as an array. - * - * @return Array RegExp strings - */ - this.getRules = function() { - return Object.keys(enabled_rules); - }; - - /** - * Add a raw rule to the raw rule array - * and replace old raw rule with new raw rule. - * - * @param {String} rule RegExp as string - * @param {boolean} isActive Is this rule active? - */ - this.addRawRule = function(rule, isActive = true) { - if(isActive) - { - enabled_rawRules[rule] = true; - - if(disabled_rawRules[rule] !== undefined) - { - delete disabled_rawRules[rule]; - } - } - else { - disabled_rawRules[rule] = true; - - if(enabled_rawRules[rule] !== undefined) - { - delete enabled_rawRules[rule]; - } - } - }; - - /** - * Return all active raw rules as an array. - * - * @return Array RegExp strings - */ - this.getRawRules = function() { - return Object.keys(enabled_rawRules); - }; - - /** - * Add a exception to the exceptions array - * and replace old with new exception. - * - * @param {String} exception RegExp as string - * @param {Boolean} isActive Is this exception acitve? - */ - this.addException = function(exception, isActive = true) { - if(isActive) - { - enabled_exceptions[exception] = true; - - if(disabled_exceptions[exception] !== undefined) - { - delete disabled_exceptions[exception]; - } - } - else { - disabled_exceptions[exception] = true; - - if(enabled_exceptions[exception] !== undefined) - { - delete enabled_exceptions[exception]; - } - } - }; - - /** - * Private helper method to check if the url - * an exception. - * - * @param {String} url RegExp as string - * @return {boolean} if matching? true: false - */ - this.matchException = function(url) { - var result = false; - - //Add the site blocked alert to every exception - if(url == siteBlockedAlert) return true; - - for(var exception in enabled_exceptions) { - if(result) break; - - exception_regex = new RegExp(exception, "i"); - result = exception_regex.test(url); - } - - return result; - }; - - /** - * Add a redirection to the redirections array - * and replace old with new redirection. - * - * @param {String} redirection RegExp as string - * @param {Boolean} isActive Is this redirection active? - */ - this.addRedirection = function(redirection, isActive = true) { - if(isActive) - { - enabled_redirections[redirection] = true; - - if(disabled_redirections[redirection] !== undefined) - { - delete disabled_redirections[redirection]; - } - } - else { - disabled_redirections[redirection] = true; - - if(enabled_redirections[redirection] !== undefined) - { - delete enabled_redirections[redirection]; - } - } - }; - - /** - * Return all redirection. - * - * @return url - */ - this.getRedirection = function(url) { - var re = null; - - for(var redirection in enabled_redirections) { - result = (url.match(new RegExp(redirection, "i"))); - - if (result && result.length > 0 && redirection) - { - re = (new RegExp(redirection, "i")).exec(url)[1]; - - break; - } - } - - return re; - }; - } - // ################################################################## - - /** - * Function which called from the webRequest to - * remove the tracking fields from the url. - * - * @param {webRequest} request webRequest-Object - * @return {Array} redirectUrl or none - */ - function clearUrl(request) - { - var URLbeforeReplaceCount = countFields(request.url); - - //Add Fields form Request to global url counter - increaseGlobalURLCounter(URLbeforeReplaceCount); - - if(storage.globalStatus){ - var result = { - "changes": false, - "url": "", - "redirect": false, - "cancel": false }; - /* - * Call for every provider the removeFieldsFormURL method. + /** + * Return all active rules as an array. + * + * @return Array RegExp strings */ - for (var i = 0; i < providers.length; i++) { + this.getRules = function() { + return Object.keys(enabled_rules); + }; - if(providers[i].matchURL(request.url)) + /** + * Add a raw rule to the raw rule array + * and replace old raw rule with new raw rule. + * + * @param {String} rule RegExp as string + * @param {boolean} isActive Is this rule active? + */ + this.addRawRule = function(rule, isActive = true) { + if(isActive) { - result = removeFieldsFormURL(providers[i], request.url); - } + enabled_rawRules[rule] = true; - /* - * Expand urls and bypass tracking. - * Cancel the active request. - */ - if(result.redirect) + if(disabled_rawRules[rule] !== undefined) + { + delete disabled_rawRules[rule]; + } + } + else { + disabled_rawRules[rule] = true; + + if(enabled_rawRules[rule] !== undefined) + { + delete enabled_rawRules[rule]; + } + } + }; + + /** + * Return all active raw rules as an array. + * + * @return Array RegExp strings + */ + this.getRawRules = function() { + return Object.keys(enabled_rawRules); + }; + + /** + * Add a exception to the exceptions array + * and replace old with new exception. + * + * @param {String} exception RegExp as string + * @param {Boolean} isActive Is this exception acitve? + */ + this.addException = function(exception, isActive = true) { + if(isActive) { - browser.tabs.update(request.tabId, {url: result.url}); - return {cancel: true}; + enabled_exceptions[exception] = true; + + if(disabled_exceptions[exception] !== undefined) + { + delete disabled_exceptions[exception]; + } + } + else { + disabled_exceptions[exception] = true; + + if(enabled_exceptions[exception] !== undefined) + { + delete enabled_exceptions[exception]; + } + } + }; + + /** + * Private helper method to check if the url + * an exception. + * + * @param {String} url RegExp as string + * @return {boolean} if matching? true: false + */ + this.matchException = function(url) { + var result = false; + + //Add the site blocked alert to every exception + if(url == siteBlockedAlert) return true; + + for(var exception in enabled_exceptions) { + if(result) break; + + exception_regex = new RegExp(exception, "i"); + result = exception_regex.test(url); } - /* - * Cancel the Request and redirect to the site blocked alert page, - * to inform the user about the full url blocking. - */ - if(result.cancel){ - return { - redirectUrl: siteBlockedAlert - }; + return result; + }; + + /** + * Add a redirection to the redirections array + * and replace old with new redirection. + * + * @param {String} redirection RegExp as string + * @param {Boolean} isActive Is this redirection active? + */ + this.addRedirection = function(redirection, isActive = true) { + if(isActive) + { + enabled_redirections[redirection] = true; + + if(disabled_redirections[redirection] !== undefined) + { + delete disabled_redirections[redirection]; + } + } + else { + disabled_redirections[redirection] = true; + + if(enabled_redirections[redirection] !== undefined) + { + delete enabled_redirections[redirection]; + } + } + }; + + /** + * Return all redirection. + * + * @return url + */ + this.getRedirection = function(url) { + var re = null; + + for(var redirection in enabled_redirections) { + result = (url.match(new RegExp(redirection, "i"))); + + if (result && result.length > 0 && redirection) + { + re = (new RegExp(redirection, "i")).exec(url)[1]; + + break; + } } + return re; + }; + } + // ################################################################## + + /** + * Function which called from the webRequest to + * remove the tracking fields from the url. + * + * @param {webRequest} request webRequest-Object + * @return {Array} redirectUrl or none + */ + function clearUrl(request) + { + var URLbeforeReplaceCount = countFields(request.url); + + //Add Fields form Request to global url counter + increaseGlobalURLCounter(URLbeforeReplaceCount); + + if(storage.globalStatus){ + var result = { + "changes": false, + "url": "", + "redirect": false, + "cancel": false + }; + /* - * Ensure that the function go not into - * a loop. + * Call for every provider the removeFieldsFormURL method. */ - if(result.changes){ - return { - redirectUrl: result.url - }; + for (var i = 0; i < providers.length; i++) { + + if(providers[i].matchURL(request.url)) + { + result = removeFieldsFormURL(providers[i], request.url); + } + + /* + * Expand urls and bypass tracking. + * Cancel the active request. + */ + if(result.redirect) + { + if(providers[i].shouldForceRedirect()) { + browser.tabs.update(request.tabId, {url: result.url}); + return {cancel: true}; + } + + return { + redirectUrl: result.url + }; + } + + /* + * Cancel the Request and redirect to the site blocked alert page, + * to inform the user about the full url blocking. + */ + if(result.cancel){ + return { + redirectUrl: siteBlockedAlert + }; + } + + /* + * Ensure that the function go not into + * a loop. + */ + if(result.changes){ + return { + redirectUrl: result.url + }; + } } } + + // Default case + return {}; + } + + /** + * Call loadOldDataFromStore, getHash, counter, status and log functions + */ + + loadOldDataFromStore(); + getHash(); + setBadgedStatus(); + + /** + * Call by each tab is updated. + * And if url has changed. + */ + function handleUpdated(tabId, changeInfo, tabInfo) { + if(changeInfo.url) + { + delete badges[tabId]; + } + currentURL = tabInfo.url; + } + + /** + * Call by each tab is updated. + */ + browser.tabs.onUpdated.addListener(handleUpdated); + + /** + * Call by each tab change to set the actual tab id + */ + function handleActivated(activeInfo) { + tabid = activeInfo.tabId; + browser.tabs.get(tabid).then(function (tab) { + currentURL = tab.url; + }); + } + + /** + * Call by each tab change. + */ + browser.tabs.onActivated.addListener(handleActivated); + + /** + * Check the request. + */ + function promise(requestDetails) + { + if(isDataURL(requestDetails)) + { + return {}; + } + else { + var ret = clearUrl(requestDetails); + return ret; + } } - // Default case - return {}; - } + /** + * To prevent long loading on data urls + * we will check here for data urls. + * + * @type {requestDetails} + * @return {boolean} + */ + function isDataURL(requestDetails) { + var s = requestDetails.url; - /** - * Call loadOldDataFromStore, getHash, counter, status and log functions - */ - - loadOldDataFromStore(); - getHash(); - setBadgedStatus(); - - /** - * Call by each tab is updated. - * And if url has changed. - */ - function handleUpdated(tabId, changeInfo, tabInfo) { - if(changeInfo.url) - { - delete badges[tabId]; + return s.substring(0,4) == "data"; } - currentURL = tabInfo.url; - } - /** - * Call by each tab is updated. - */ - browser.tabs.onUpdated.addListener(handleUpdated); - - /** - * Call by each tab change to set the actual tab id - */ - function handleActivated(activeInfo) { - tabid = activeInfo.tabId; - browser.tabs.get(tabid).then(function (tab) { - currentURL = tab.url; - }); - } - - /** - * Call by each tab change. - */ - browser.tabs.onActivated.addListener(handleActivated); - - /** - * Check the request. - */ - function promise(requestDetails) - { - if(isDataURL(requestDetails)) - { - return {}; - } - else { - var ret = clearUrl(requestDetails); - return ret; - } - } - - /** - * To prevent long loading on data urls - * we will check here for data urls. - * - * @type {requestDetails} - * @return {boolean} - */ - function isDataURL(requestDetails) { - var s = requestDetails.url; - - return s.substring(0,4) == "data"; - } - - /** - * Call by each Request and checking the url. - * - * @type {Array} - */ - browser.webRequest.onBeforeRequest.addListener( - promise, - {urls: [""], types: getData("types")}, - ["blocking"] - ); - }); -} - -/** -* Function to log all activities from ClearUrls. -* Only logging when activated. -* The log is only temporary saved in the cache and will -* permanently saved with the saveLogOnClose function. -* -* @param beforeProcessing the url before the clear process -* @param afterProcessing the url after the clear process -* @param rule the rule that triggered the process -*/ -function pushToLog(beforeProcessing, afterProcessing, rule) -{ - if(storage.loggingStatus) - { - storage.log.log.push( - { - "before": beforeProcessing, - "after": afterProcessing, - "rule": rule, - "timestamp": Date.now() - } - ); + /** + * Call by each Request and checking the url. + * + * @type {Array} + */ + browser.webRequest.onBeforeRequest.addListener( + promise, + {urls: [""], types: getData("types")}, + ["blocking"] + ); + }); + } + + /** + * Function to log all activities from ClearUrls. + * Only logging when activated. + * The log is only temporary saved in the cache and will + * permanently saved with the saveLogOnClose function. + * + * @param beforeProcessing the url before the clear process + * @param afterProcessing the url after the clear process + * @param rule the rule that triggered the process + */ + function pushToLog(beforeProcessing, afterProcessing, rule) + { + if(storage.loggingStatus) + { + storage.log.log.push( + { + "before": beforeProcessing, + "after": afterProcessing, + "rule": rule, + "timestamp": Date.now() + } + ); + } } -} diff --git a/data/data.min.json b/data/data.min.json index 4fcb30e..89d3672 100644 --- a/data/data.min.json +++ b/data/data.min.json @@ -29,7 +29,8 @@ "rawRules": [ "\\/ref=[^\\/|\\?]*" ], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "fls-na.amazon": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(fls-na\\.amazon)(\\.[a-zA-Z]{2,}).*", @@ -37,7 +38,8 @@ "rules": [], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "google": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(google)(\\.[a-zA-Z]{2,}).*", @@ -92,7 +94,8 @@ ".*google\\..*\\/.*url\\?.*url=((https|http)[^&]*)", ".*google\\..*\\/.*url\\?.*q=((https|http)[^&]*)", ".*google\\..*\\/.*adurl=([^&]*)" - ] + ], + "forceRedirection": true }, "googlesyndication": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(googlesyndication)(\\.[a-zA-Z]{2,}).*", @@ -100,7 +103,8 @@ "rules": [], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "doubleclick": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(doubleclick)(\\.[a-zA-Z]{2,}).*", @@ -110,17 +114,19 @@ "exceptions": [], "redirections": [ ".*doubleclick\\..*\\/.*tag_for_child_directed_treatment=;%3F(.*)" - ] + ], + "forceRedirection": false }, "googleadservices": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(googleadservices)(\\.[a-zA-Z]{2,}).*", - "completeProvider": true, + "completeProvider": false, "rules": [], "rawRules": [], "exceptions": [], "redirections": [ ".*googleadservices\\..*\\/.*adurl=([^&]*)" - ] + ], + "forceRedirection": false }, "globalRules": { "urlPattern": ".*", @@ -148,7 +154,8 @@ "(%3F)?hmb_campaign", "(%3F)?hmb_medium", "(%3F)?hmb_source", - "(%3F)?[\\?|&]ref[\\_]?" + "(%3F)?[\\?|&]ref[\\_]?", + "(%3F)?gclid" ], "rawRules": [], "exceptions": [ @@ -160,7 +167,8 @@ ".*(myaccount.google\\.[a-zA-Z]{2,}).*", ".*([\\.]?tangerine\\.ca).*" ], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "adtech": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(adtech)(\\.[a-zA-Z]{2,}).*", @@ -168,7 +176,8 @@ "rules": [], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "contentpass.net": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(contentpass\\.net).*", @@ -176,7 +185,8 @@ "rules": [], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "bf-ad": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(bf-ad)(\\.[a-zA-Z]{2,}).*", @@ -184,7 +194,8 @@ "rules": [], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "amazon-adsystem": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(amazon-adsystem)(\\.[a-zA-Z]{2,}).*", @@ -192,7 +203,8 @@ "rules": [], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "adsensecustomsearchads": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(adsensecustomsearchads)(\\.[a-zA-Z]{2,}).*", @@ -200,7 +212,8 @@ "rules": [], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "youtube": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(youtube)(\\.[a-zA-Z]{2,}).*", @@ -214,7 +227,26 @@ "exceptions": [], "redirections": [ ".*youtube\\..*\\/redirect?.*q=([^&]*)" - ] + ], + "forceRedirection": false + }, + "youtube_pagead": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(youtube)(\\.[a-zA-Z]{2,})\\/pagead", + "completeProvider": true, + "rules": [], + "rawRules": [], + "exceptions": [], + "redirections": [], + "forceRedirection": false + }, + "youtube_apiads": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(youtube)(\\.[a-zA-Z]{2,})\\/api\\/stats\\/ads", + "completeProvider": true, + "rules": [], + "rawRules": [], + "exceptions": [], + "redirections": [], + "forceRedirection": false }, "facebook": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(facebook)(\\.[a-zA-Z]{2,}).*", @@ -234,7 +266,6 @@ "pageid", "padding", "ls_ref", - "acontext", "action_history" ], "rawRules": [], @@ -244,18 +275,21 @@ ], "redirections": [ ".*l[a-zA-Z]?\\.facebook\\..*\\/.*l\\.php\\?.*u=((https%3A%2F%2F|http%3A%2F%2F)[^&]*)" - ] + ], + "forceRedirection": false }, "twitter": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(twitter)(\\.[a-zA-Z]{2,}).*", "completeProvider": false, "rules": [ - "(ref_)?src", - "s" + "(ref_?)?src", + "s", + "cn" ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "reddit": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(reddit)(\\.[a-zA-Z]{2,}).*", @@ -265,7 +299,8 @@ "exceptions": [], "redirections": [ ".*out\\.reddit\\.\\w{2,}\\/.*url=([^&]*)" - ] + ], + "forceRedirection": false } , "netflix": { @@ -278,7 +313,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "techcrunch": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?([\\.]?techcrunch\\.com).*", @@ -290,7 +326,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "bing": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(bing)(\\.[a-zA-Z]{2,}).*", @@ -306,7 +343,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "tweakers": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(tweakers\\.net).*", @@ -317,7 +355,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "twitch": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(twitch)(\\.[a-zA-Z]{2,}).*", @@ -328,7 +367,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "vivaldi": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(vivaldi\\.com).*", @@ -339,7 +379,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "indeed": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(indeed\\.com).*", @@ -351,7 +392,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "hhdotru": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(hh\\.ru).*", @@ -368,7 +410,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "ebay": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(ebay)(\\.[a-zA-Z]{2,}).*", @@ -380,7 +423,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "cnet": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(cnet\\.com).*", @@ -390,7 +434,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "imdb.com": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(imdb\\.com).*", @@ -401,7 +446,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "govdelivery.com": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(govdelivery\\.com).*", @@ -412,7 +458,8 @@ "redirections": [ ".*links\\.govdelivery\\.com.*\\/track\\?.*(http:\\/\\/.*)", ".*links\\.govdelivery\\.com.*\\/track\\?.*(https:\\/\\/.*)" - ] + ], + "forceRedirection": false }, "walmart.com": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(walmart\\.com).*", @@ -423,7 +470,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "net-parade.it": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(net\\-parade\\.it).*", @@ -433,7 +481,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "prvnizpravy.cz": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(prvnizpravy\\.cz).*", @@ -443,7 +492,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "youku.com": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(youku\\.com).*", @@ -454,7 +504,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "nytimes.com": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(nytimes\\.com).*", @@ -464,7 +515,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "tchibo.de": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(tchibo\\.de).*", @@ -474,7 +526,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "steampowered": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(steampowered\\.com).*", @@ -484,7 +537,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "steamcommunity": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(steamcommunity\\.com).*", @@ -494,7 +548,8 @@ "exceptions": [], "redirections": [ ".*steamcommunity\\.com.*\\/linkfilter\\/\\?url=(.*)" - ] + ], + "forceRedirection": false }, "disq.us": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-]*\\.)?(disq\\.us).*", @@ -504,7 +559,8 @@ "exceptions": [], "redirections": [ ".*disq\\.us.*\\/.*url\\?.*url=((https%3A%2F%2F|http%3A%2F%2F).*)%3A" - ] + ], + "forceRedirection": false }, "mozaws.net": { "urlPattern": "https?:\\/\\/outgoing\\.prod\\.mozaws\\.net/.*", @@ -514,7 +570,8 @@ "exceptions": [], "redirections": [ "https?:\\/\\/[^/]+/v1/[0-9a-f]{64}/(.*)" - ] + ], + "forceRedirection": false }, "shutterstock.com": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(shutterstock\\.com).*", @@ -524,7 +581,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "mozilla.org": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(mozilla\\.org).*", @@ -535,7 +593,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "readdc.com": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(readdc\\.com).*", @@ -545,7 +604,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "dailycodingproblem.com": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(dailycodingproblem\\.com).*", @@ -555,7 +615,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "github.com": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(github\\.com).*", @@ -566,7 +627,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "deviantart.com": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(deviantart\\.com).*", @@ -576,7 +638,8 @@ "exceptions": [], "redirections": [ ".*deviantart\\.com.*outgoing\\?(.*)" - ] + ], + "forceRedirection": false }, "site2.com": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(site2\\.com).*", @@ -586,7 +649,8 @@ "exceptions": [], "redirections": [ ".*site2\\.com.*\\?.*=(.*)" - ] + ], + "forceRedirection": false }, "site.com": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(site\\.com).*", @@ -596,7 +660,8 @@ "exceptions": [], "redirections": [ ".*site\\.com.*\\?to=([^&]*)" - ] + ], + "forceRedirection": false }, "site3.com": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(site3\\.com).*", @@ -606,7 +671,8 @@ "exceptions": [], "redirections": [ ".*site3\\.com.*\\?r=([^&]*)" - ] + ], + "forceRedirection": false }, "aliexpress.com": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(aliexpress\\.com).*", @@ -615,11 +681,16 @@ "ws_ab_test", "btsid", "algo_expid", - "algo_pvid" + "algo_pvid", + "spm", + "gps-id", + "scm[_a-zA-Z\\-]*", + "pvid" ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "mozillazine.org": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(mozillazine\\.org).*", @@ -629,7 +700,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "9gag.com": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(9gag\\.com).*", @@ -639,7 +711,8 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false }, "linksynergy.com": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(linksynergy\\.com).*", @@ -649,7 +722,8 @@ "exceptions": [], "redirections": [ ".*linksynergy\\.com.*\\/.*murl=([^&]*)" - ] + ], + "forceRedirection": false }, "giphy.com": { "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(giphy\\.com).*", @@ -659,7 +733,19 @@ ], "rawRules": [], "exceptions": [], - "redirections": [] + "redirections": [], + "forceRedirection": false + }, + "gate.sc": { + "urlPattern": "https?:\\/\\/([a-zA-Z0-9-]*\\.)?(gate\\.sc).*", + "completeProvider": false, + "rules": [], + "rawRules": [], + "exceptions": [], + "redirections": [ + ".*gate\\.sc.*\\/.*url=([^&]*)" + ], + "forceRedirection": false } } } diff --git a/manifest.json b/manifest.json index f313d18..5ef6e5f 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "ClearURLs", - "version": "1.7.0", + "version": "1.7.1", "author": "Kevin R.", "description": "Remove tracking elements from URLs.", "homepage_url": "https://gitlab.com/KevinRoebert/ClearUrls",