diff --git a/CHANGELOG.md b/CHANGELOG.md index 28930e6..5b914de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ 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.11.0] - 2020-01-06 + +### Added +- Added hyperlink auditing blocking [#184](https://gitlab.com/KevinRoebert/ClearUrls/issues/184) + +### Compatibility note +- Require Firefox >= 55 +- Require Chrome >= 22 + ## [1.10.0] - 2020-01-03 ### Compatibility note diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 0d18ec0..57cfb89 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -27,6 +27,10 @@ "message": "Diese Domain wurde blockiert", "description": "Diese Zeichenfolge wird für blockierte Domäns im ClearURL-Protokoll verwendet." }, + "log_ping_blocked": { + "message": "Diese Hyperlink Auditing Anfrage wurde blockiert", + "description": "Diese Zeichenfolge wird für blockierte Hyperlink Auditing Anfragen im ClearURL-Protokoll verwendet." + }, "check_os_log": { "message": "[ClearURLs]: Protokoll-Listener wurde hinzugefügt.", "description": "Diese Zeichenfolge wird beim Start des ClearURL-Protokolls verwendet." @@ -312,5 +316,13 @@ "domain_blocking_enabled_title": { "message": "Erlaube Domain-Blocking (Kann zu Problemen auf Seiten führen, die AdBlocker nicht erlauben)", "description": "Diese Zeichenkette wird als Titel für das Domain-Blocking verwendet." + }, + "ping_blocking_enabled": { + "message": "Blockiere Hyperlink Auditing Anfragen (Siehe auch diese Spezifikation)", + "description": "Diese Zeichenkette wird als Beschreibung für das Hyperlink Auditing-Blocking verwendet." + }, + "ping_blocking_enabled_title": { + "message": "Blockiere Hyperlink Auditing Anfragen", + "description": "Diese Zeichenkette wird als Titel für das Hyperlink Auditing-Blocking verwendet." } } diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 96accb2..0fe03c0 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -27,6 +27,10 @@ "message": "This domain is blocked", "description": "This string is used on blocked domains in the ClearURLs log." }, + "log_ping_blocked": { + "message": "This hyperlink auditing was blocked", + "description": "This string is used on hyperlink auditing in the ClearURLs log." + }, "check_os_log": { "message": "[ClearURLs]: Log listener is added.", "description": "This string is used on ClearURLs log startup." @@ -312,5 +316,13 @@ "domain_blocking_enabled_title": { "message": "Allow domain blocking (Can lead to problems on pages that do not allow AdBlockers)", "description": "This string is used as title for the domain blocking switch" + }, + "ping_blocking_enabled": { + "message": "Block hyperlink auditing (See also this article)", + "description": "This string is used as label for the hyperlink auditing blocking switch" + }, + "ping_blocking_enabled_title": { + "message": "Block hyperlink auditing", + "description": "This string is used as title for the hyperlink auditing blocking switch" } } diff --git a/clearurls.js b/clearurls.js index cfe2e29..e398f1c 100644 --- a/clearurls.js +++ b/clearurls.js @@ -70,20 +70,7 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false) { pushToLog(beforeReplace, url, rawRule); } - if (badges[tabid] == null) badges[tabid] = 0; - - if (!quiet) increaseURLCounter(); - - checkOSAndroid().then((res) => { - if (!res) { - if (storage.badgedStatus && !quiet) { - browser.browserAction.setBadgeText({text: (++badges[tabid]).toString(), tabId: tabid}); - } else { - browser.browserAction.setBadgeText({text: "", tabId: tabid}); - } - } - }); - + increaseBadged(quiet); changes = true; } }); @@ -144,20 +131,7 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false) { if (!quiet) pushToLog(tempBeforeURL, tempURL, rule); } - if (badges[tabid] == null) badges[tabid] = 0; - - if (!quiet) increaseURLCounter(); - - checkOSAndroid().then((res) => { - if (!res) { - if (storage.badgedStatus && !quiet) { - browser.browserAction.setBadgeText({text: (++badges[tabid]).toString(), tabId: tabid}); - } else { - browser.browserAction.setBadgeText({text: "", tabId: tabid}); - } - } - }); - + increaseBadged(quiet); changes = true; } }); @@ -172,22 +146,7 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false) { if (provider.isCaneling() && storage.domainBlocking) { if (!quiet) pushToLog(pureUrl, pureUrl, translate('log_domain_blocked')); - if (badges[tabid] == null) { - badges[tabid] = 0; - } - - if (!quiet) increaseURLCounter(); - - checkOSAndroid().then((res) => { - if (!res) { - if (storage.badgedStatus && !quiet) { - browser.browserAction.setBadgeText({text: (++badges[tabid]).toString(), tabId: tabid}); - } else { - browser.browserAction.setBadgeText({text: "", tabId: tabid}); - } - } - }); - + increaseBadged(quiet); cancel = true; } @@ -598,6 +557,12 @@ function start() { "cancel": false }; + if(storage.pingBlocking && storage.pingRequestTypes.includes(request.type)) { + pushToLog(request.url, request.url, translate('log_ping_blocked')); + increaseBadged(); + return {cancel: true}; + } + /* * Call for every provider the removeFieldsFormURL method. */ @@ -726,7 +691,7 @@ function start() { */ browser.webRequest.onBeforeRequest.addListener( promise, - {urls: [""], types: getData("types")}, + {urls: [""], types: getData("types").concat(getData("pingRequestTypes"))}, ["blocking"] ); } @@ -761,3 +726,22 @@ function pushToLog(beforeProcessing, afterProcessing, rule) { deferSaveOnDisk('log'); } } + +/** + * Increases the badged by one. + */ +function increaseBadged(quiet = false) { + if (badges[tabid] == null) badges[tabid] = 0; + + if (!quiet) increaseURLCounter(); + + checkOSAndroid().then((res) => { + if (!res) { + if (storage.badgedStatus && !quiet) { + browser.browserAction.setBadgeText({text: (++badges[tabid]).toString(), tabId: tabid}); + } else { + browser.browserAction.setBadgeText({text: "", tabId: tabid}); + } + } + }); +} diff --git a/core_js/settings.js b/core_js/settings.js index ed08818..3189883 100644 --- a/core_js/settings.js +++ b/core_js/settings.js @@ -114,12 +114,14 @@ function getData() .then(() => loadData("localHostsSkipping")) .then(() => loadData("referralMarketing")) .then(() => loadData("domainBlocking")) + .then(() => loadData("pingBlocking")) .then(() => { changeSwitchButton("localHostsSkipping", "localHostsSkipping"); changeSwitchButton("historyListenerEnabled", "historyListenerEnabled"); changeSwitchButton("contextMenuEnabled", "contextMenuEnabled"); changeSwitchButton("referralMarketing", "referralMarketing"); changeSwitchButton("domainBlocking", "domainBlocking"); + changeSwitchButton("pingBlocking", "pingBlocking"); }); } @@ -185,6 +187,8 @@ function setText() $('#importSettings').prop('title', translate('setting_html_import_button_title')); injectText("referral_marketing_enabled", "referral_marketing_enabled"); injectText("domain_blocking_enabled", "domain_blocking_enabled"); + $('#ping_blocking_enabled').html(translate('ping_blocking_enabled')) + .prop('title', translate('ping_blocking_enabled_title')); } /** diff --git a/core_js/storage.js b/core_js/storage.js index 7556a28..21bcd1b 100644 --- a/core_js/storage.js +++ b/core_js/storage.js @@ -209,11 +209,14 @@ function initSettings() { storage.referralMarketing = false; storage.logLimit = -1; storage.domainBlocking = true; + storage.pingBlocking = true; if (getBrowser() === "Firefox") { storage.types = ["font", "image", "imageset", "main_frame", "media", "object", "object_subrequest", "other", "script", "stylesheet", "sub_frame", "websocket", "xbl", "xml_dtd", "xmlhttprequest", "xslt"]; + storage.pingRequestTypes = ["ping", "beacon"]; } else if (getBrowser() === "Chrome") { storage.types = ["main_frame", "sub_frame", "stylesheet", "script", "image", "font", "object", "xmlhttprequest", "ping", "csp_report", "media", "websocket", "other"]; + storage.pingRequestTypes = ["ping"]; } } diff --git a/core_js/tools.js b/core_js/tools.js index 5e7af9d..6e53e92 100644 --- a/core_js/tools.js +++ b/core_js/tools.js @@ -293,7 +293,7 @@ function decodeURL(url) { return rtn; } -/* +/** * Gets the value of at `key` an object. If the resolved value is `undefined`, the `defaultValue` is returned in its place. * * @param {string} key the key of the object diff --git a/data/data.min.json b/data/data.min.json index df4aa15..3baddac 100644 --- a/data/data.min.json +++ b/data/data.min.json @@ -95,7 +95,8 @@ "uact", "aqs", "sourceid", - "sxsrf" + "sxsrf", + "rlz" ], "referralMarketing": [ "referrer" @@ -184,7 +185,8 @@ "(%3F)?cmpid", "(%3F)?os_ehash", "(%3F)?_ga", - "(%3F)?__twitter_impression" + "(%3F)?__twitter_impression", + "(%3F)?wt_mc" ], "referralMarketing": [], "rawRules": [], @@ -1105,6 +1107,44 @@ "exceptions": [], "redirections": [], "forceRedirection": false + }, + "disq.us": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-.]*\\.)?(disq)(\\.us).*", + "completeProvider": false, + "rules": [ + "cuid" + ], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [ + ".*url=([^&]*)" + ], + "forceRedirection": false + }, + "liberation.fr": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-.]*\\.)?(liberation)(\\.fr).*", + "completeProvider": false, + "rules": [ + "Echobox" + ], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [], + "forceRedirection": false + }, + "anonym.to": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-.]*\\.)?(anonym)(\\.to).*", + "completeProvider": false, + "rules": [], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [ + ".*\\?([^&]*)" + ], + "forceRedirection": false } } } diff --git a/html/settings.html b/html/settings.html index 967c551..1bd4c35 100644 --- a/html/settings.html +++ b/html/settings.html @@ -98,6 +98,7 @@ along with this program. If not, see .
+


@@ -125,7 +126,6 @@ along with this program. If not, see .

-


-


-


-


+

+
+ +