From f0bfe4c8ddcdf1918fab42bb7f99674ba603ee9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20R=C3=B6bert?= Date: Mon, 9 Mar 2020 22:13:59 +0100 Subject: [PATCH 1/9] Added rules and exception #409 #411 #414 #418 #419 #420 #421 #424 --- data/data.min.json | 72 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/data/data.min.json b/data/data.min.json index f31e68b..ecbb8c3 100644 --- a/data/data.min.json +++ b/data/data.min.json @@ -33,7 +33,11 @@ "aaxitk", "hsa_cr_id", "sb-ci-[a-zA-Z]+", - "rnid" + "rnid", + "dchild", + "SubscriptionId", + "camp", + "creative" ], "referralMarketing": [ "tag" @@ -229,7 +233,9 @@ "(https:\\/\\/|http:\\/\\/)(login\\.)(meijer\\.com)\\/.*\\?ref=.*", ".*(facebook\\.)\\w{2,}.*(\\/login_alerts\\/).*", ".*(facebook\\.)\\w{2,}.*(\\/should_add_browser\\/).*", - ".*(facebook\\.)\\w{2,}.*(\\/ajax\\/).*" + ".*(facebook\\.)\\w{2,}.*(\\/ajax\\/).*", + ".*(api\\.taiga\\.io).*", + ".*(\\.gog\\.com\\/click\\.html).*" ], "redirections": [], "forceRedirection": false @@ -1369,6 +1375,68 @@ "exceptions": [], "redirections": [], "forceRedirection": false + },"meetup.com": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-.]*\\.)?(meetup)(\\.com).*", + "completeProvider": false, + "rules": [ + "rv", + "_xtd" + ], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [], + "forceRedirection": false + },"apple.com": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-.]*\\.)?(apple)(\\.com).*", + "completeProvider": false, + "rules": [ + "app", + "ign-itsc[a-zA-Z]+" + ], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [], + "forceRedirection": false + },"alabout.com": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-.]*\\.)?(alabout)(\\.com).*", + "completeProvider": false, + "rules": [], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [ + ".*url=([^&]*)" + ], + "forceRedirection": false + },"newyorker.com": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-.]*\\.)?(newyorker)(\\.com).*", + "completeProvider": false, + "rules": [ + "source", + "bxid", + "cndid", + "esrc", + "mbid" + ], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [], + "forceRedirection": false + }, "gog.com": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-.]*\\.)?(gog)(\\.com).*", + "completeProvider": false, + "rules": [ + "track_click", + "link_id" + ], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [], + "forceRedirection": false } } } From 59707d791855b18c728bec4d8af40e5e0c6ae3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20R=C3=B6bert?= Date: Tue, 10 Mar 2020 20:33:42 +0100 Subject: [PATCH 2/9] Added exception #427 --- data/data.min.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/data.min.json b/data/data.min.json index ecbb8c3..48e1127 100644 --- a/data/data.min.json +++ b/data/data.min.json @@ -235,7 +235,8 @@ ".*(facebook\\.)\\w{2,}.*(\\/should_add_browser\\/).*", ".*(facebook\\.)\\w{2,}.*(\\/ajax\\/).*", ".*(api\\.taiga\\.io).*", - ".*(\\.gog\\.com\\/click\\.html).*" + ".*(\\.gog\\.com\\/click\\.html).*", + ".*(login\\.progressive\\.com).*" ], "redirections": [], "forceRedirection": false From 31d63fa77734a312e411df7b0ebcec729efa885f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20R=C3=B6bert?= Date: Wed, 18 Mar 2020 14:52:49 +0100 Subject: [PATCH 3/9] Added rules and exception #433 #434 #432 #437 #438 --- data/data.min.json | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/data/data.min.json b/data/data.min.json index 48e1127..aca6f2f 100644 --- a/data/data.min.json +++ b/data/data.min.json @@ -35,7 +35,6 @@ "sb-ci-[a-zA-Z]+", "rnid", "dchild", - "SubscriptionId", "camp", "creative" ], @@ -236,7 +235,9 @@ ".*(facebook\\.)\\w{2,}.*(\\/ajax\\/).*", ".*(api\\.taiga\\.io).*", ".*(\\.gog\\.com\\/click\\.html).*", - ".*(login\\.progressive\\.com).*" + ".*(login\\.progressive\\.com).*", + ".*(sephora\\.com\\/api\\/).*", + ".*(contestgirl\\.com).*" ], "redirections": [], "forceRedirection": false @@ -1438,6 +1439,31 @@ "exceptions": [], "redirections": [], "forceRedirection": false + }, + "tradedoubler.com": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-.]*\\.)?(tradedoubler)(\\.com).*", + "completeProvider": false, + "rules": [], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [ + ".*url=([^&]*)", + ".*_td_deeplink=([^&]*)" + ], + "forceRedirection": false + }, + "theguardian.com": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-.]*\\.)?(theguardian)(\\.com).*", + "completeProvider": false, + "rules": [ + "CMP" + ], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [], + "forceRedirection": false } } } From afdf17271679bf125dd4cfa38debc8518b7e3535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20R=C3=B6bert?= Date: Wed, 18 Mar 2020 16:12:32 +0100 Subject: [PATCH 4/9] Added rule #434 #404 --- data/data.min.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/data/data.min.json b/data/data.min.json index aca6f2f..6137537 100644 --- a/data/data.min.json +++ b/data/data.min.json @@ -129,6 +129,18 @@ ], "forceRedirection": true }, + "googleSearch": { + "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-.]*\\.)?(google)(\\.[a-zA-Z]{2,})\\/search\\?.*", + "completeProvider": false, + "rules": [ + "client" + ], + "referralMarketing": [], + "rawRules": [], + "exceptions": [], + "redirections": [], + "forceRedirection": false + }, "googlesyndication": { "urlPattern": "(https:\\/\\/|http:\\/\\/)([a-zA-Z0-9-.]*\\.)?(googlesyndication)(\\.[a-zA-Z]{2,}).*", "completeProvider": true, From 6ae8dd7d22122d3fb7c75af13bb15119f4d394ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20R=C3=B6bert?= Date: Thu, 19 Mar 2020 12:31:00 +0100 Subject: [PATCH 5/9] Add button for MEA --- promotion/MEA-button.png | Bin 0 -> 6141 bytes promotion/MEA-button.svg | 290 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 290 insertions(+) create mode 100644 promotion/MEA-button.png create mode 100644 promotion/MEA-button.svg diff --git a/promotion/MEA-button.png b/promotion/MEA-button.png new file mode 100644 index 0000000000000000000000000000000000000000..f8e668809db27d52ab0c59f4dffc17b16528ffae GIT binary patch literal 6141 zcmV?()zhf}p#+bdO4n{vfgtXiZ#`= zxPGJ@{rOX0{M?!Rh61o%Uwi6UY_A3otf#2KTGP8$(xSEVH2~!|uwK5h6{@MG3riWb+eY}z zmZpNZYBpJm#tbgT_w`;X&Wzeb?MF#2w}%pVaJ=$ z(Ku)Y7z65pb;z|T8)TCDUA+mbT~+`#Q~GSNhHaf&*Ell=>8h3(+1)zS)vZbiM3yc z9c%Kfs2~W+#}<_TxL2U^))oW>C=?12?=yu$0NZv5wuXtfX)==;rUwjeZY677(^aAd zd&P=Unn>GrBF&pXDIZb~Mf}Hq9$dkA_=@uUSRYpLCxrq5QDA9<(i*K4%2LGI6!BKW z)PRr}vR176HC-KA5nwGlLS4sB>}WFuK*hJNDi1Dmp8+1E1`*HD`ZgEAo`YRLk@H|x zU@6c_uq;E{rX2OFgtJGYn3}cywUNHq0<1tC^<8@iMB7kk6c%9l%NivbB?|m?@3Ehs z=dGzfFHBw;TKRTY3EF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A%darW~iFj9JHFBAsR=HOpW!$%}n`ym+Q>*@-Xz+ouJ%jcR=P)z^6Dp$7`N7nP1Yu2vQ0!!A@d8)Inrdb|{W ze@tm1FV_2GO`Iig=AbuF(F%bTnBPt213s_o%j86{)_A_G z7{qw*B3Q1(0h2PAltIcwS;V+RZmF-qx(vC-a6Xlye|q{|4=Y^6>o)6RBQ!J<AmR z0+3tNjTnc*(C$kiaS88;5M28%3N_Sp$#hXKG;V6_qdq<~*F_6O(3-|}+{X68|KVD3 zXhjHb3liRPc|s~RU3p#fE90A+PtnwLW>HI9)6Hw$jI`i7Vig6lN#-4U$j+P^&db<~PBt1T->TiXfJ z>2o9!oy^X98B|JvQ8u}aH(^Hm2n?Sl)A|`+UZtHqXa|ias0M^(bI+a+Ef|$>y0TqVeYDIWM z2rFI#wI(KQ6obgh0-IMbI74%DFU?K8WU}>SG7V&NQ5+|V+tx|0wF^tKSWW^fGleCy z*gAzB&Jt`AtoRj9E~x3E{UPj5q4}w}s3PPa-p-?q>pEX!(DwZf-(n`5cU+Id} zR8u9gkblsp9)J9&z>hAtcTF{2Sv}wT*kgM&fO7QbfyLkEP*Y7;R_83&ejNNb?5Qt) z?hHyEL@51dPBqnZWpz$#9_abq&-TN-j)T*WJ+@!D`u)HUuUOS;s%gH2f7VKN_J02J zg<&6Mo8lY4_S7!4d|F@+& + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + GET THE + ADD-ON + + + From b1a5b5fcb0be79812e00798d6afc3542800b1f51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20R=C3=B6bert?= Date: Thu, 19 Mar 2020 11:34:27 +0000 Subject: [PATCH 6/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b1744de..dbf36c6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Buy Me A Coffee -[for Firefox](https://addons.mozilla.org/en-US/firefox/addon/clearurls/) [for Chrome](https://chrome.google.com/webstore/detail/clearurls/lckanjgmijmafbedllaakclkaicjfmnk) +[for Firefox](https://addons.mozilla.org/en-US/firefox/addon/clearurls/) [for Edge](https://microsoftedge.microsoft.com/addons/detail/mdkdmaickkfdekbjdoojfalpbkgaddei) [for Chrome](https://chrome.google.com/webstore/detail/clearurls/lckanjgmijmafbedllaakclkaicjfmnk) # ClearURLs From 0298792aa1a905ad5030ac07dbb636455d07b38e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20R=C3=B6bert?= Date: Fri, 20 Mar 2020 01:50:22 +0100 Subject: [PATCH 7/9] Version 1.16.0 #362 #440 #429 #428 #431 --- CHANGELOG.md | 24 +++++++ _locales/de/messages.json | 22 +++++- _locales/en/messages.json | 22 +++++- _locales/es/messages.json | 4 -- _locales/fr/messages.json | 4 -- _locales/it/messages.json | 4 -- _locales/ru/messages.json | 4 -- _locales/sv_SE/messages.json | 4 -- _locales/tr/messages.json | 4 -- clearurls.js | 130 +++++++++-------------------------- core_js/badgedHandler.js | 77 +++++++++++++++++++++ core_js/eTagFilter.js | 45 ++++++++++++ core_js/settings.js | 4 ++ core_js/storage.js | 6 ++ core_js/tools.js | 75 ++++++++++++-------- core_js/watchdog.js | 20 ++++-- html/settings.html | 7 ++ manifest.json | 6 +- 18 files changed, 299 insertions(+), 163 deletions(-) create mode 100644 core_js/badgedHandler.js create mode 100644 core_js/eTagFilter.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 7146fb3..9998af8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,30 @@ 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.16.0] - 2020-03-20 + +### Compatibility note +- Require Firefox >= 55 +- Require Chrome >= 22 + +### Added +- Added ETag header filtering [#362](https://gitlab.com/KevinRoebert/ClearUrls/issues/362), [#440](https://gitlab.com/KevinRoebert/ClearUrls/issues/440). Hint: Cache must be cleared before first use, to delete the already existing ETags. + +### Fixed +- Fixed spontaneous disappearance of the badged +- Fixed wrong counting of blocked elements corrected (too little was ;D) + +### Changed +- Updated all translation +- Changed badged font color to #FFFFFF +- Changed watchdog behavior as follows [#428](https://gitlab.com/KevinRoebert/ClearUrls/issues/428), [#431](https://gitlab.com/KevinRoebert/ClearUrls/issues/431), [#429](https://gitlab.com/KevinRoebert/ClearUrls/issues/429): + - Increased watchdog interval to 60 seconds + - Executed watchdog only if ClearURLs is also active + - Watchdog restarts ClearURLs at most 3 times and only if ClearURLs has rules +- Changed behavior of downloading rules [#428](https://gitlab.com/KevinRoebert/ClearUrls/issues/428), [#431](https://gitlab.com/KevinRoebert/ClearUrls/issues/431), [#429](https://gitlab.com/KevinRoebert/ClearUrls/issues/429): + - If download of hash file fails and no local rules are available, then ClearURLs displays `hash_status_code_5` and deactivates itself + - If download of rules file fails and no local rules are available, then ClearURLs displays `hash_status_code_5` and deactivates itself + ## [1.15.0] - 2020-02-16 ### Compatibility note diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 7941911..801a4c9 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -306,8 +306,14 @@ "description": "Diese Zeichenkette wird als Titel für das Referral-Marketing verwendet." }, "watchdog": { - "message": "[ClearURLs]: Der Watchdog hat ein Problem festgestellt. ClearURLs wird neugestartet.", - "description": "Diese Zeichenkette wird als Text für den Watchdog verwendet." + "message": "[ClearURLs]: Der Watchdog hat ein Problem festgestellt und ist bereits das $TIMES$-te mal gescheitert.", + "description": "Diese Zeichenkette wird als Text für den Watchdog verwendet.", + "placeholders": { + "times": { + "content": "$1", + "example": "3" + } + } }, "domain_blocking_enabled": { "message": "Erlaube Domain-Blocking (Kann zu Problemen auf Seiten führen, die AdBlocker nicht erlauben)", @@ -328,5 +334,17 @@ "ping_blocking_enabled_title": { "message": "Blockiere Hyperlink Auditing Anfragen", "description": "Diese Zeichenkette wird als Titel für das Hyperlink Auditing-Blocking verwendet." + }, + "eTag_filtering_log": { + "message": "ETag-Header wurde aus dieser Anfrage entfernt", + "description": "Diese Zeichenkette wird für das Filtern von ETag-Headern im ClearURL-Protokoll verwendet." + }, + "eTag_filtering_enabled": { + "message": "Filtert die ETag-Header aus den Anfragen (Siehe auch diesen Artikel)", + "description": "Diese Zeichenkette wird als Beschreibung für das Filtern von ETag-Headern verwendet." + }, + "eTag_filtering_enabled_title": { + "message": "Filtert ETag-Header. Info: Cache muss vor der ersten Benutzung geleert werden.", + "description": "Diese Zeichenkette wird als Titel für das Filtern von ETag-Headern verwendet." } } \ No newline at end of file diff --git a/_locales/en/messages.json b/_locales/en/messages.json index f26df0f..2891008 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -306,8 +306,14 @@ "description": "This string is used as title for the referral marketing switch" }, "watchdog": { - "message": "[ClearURLs]: The watchdog has detected a problem. ClearURLs is restarting.", - "description": "This string is used as text for the watchdog" + "message": "[ClearURLs]: The watchdog has detected a problem and has already failed $TIMES$ times.", + "description": "This string is used as text for the watchdog", + "placeholders": { + "times": { + "content": "$1", + "example": "3" + } + } }, "domain_blocking_enabled": { "message": "Allow domain blocking (Can lead to problems on pages that do not allow AdBlockers)", @@ -328,5 +334,17 @@ "ping_blocking_enabled_title": { "message": "Block hyperlink auditing", "description": "This string is used as title for the hyperlink auditing blocking switch" + }, + "eTag_filtering_log": { + "message": "ETag header was removed from this request", + "description": "This string is used on ETag header filtering in the ClearURLs log." + }, + "eTag_filtering_enabled": { + "message": "Filters ETag headers from requests (See also this article)", + "description": "This string is used as label for the ETag header filtering switch" + }, + "eTag_filtering_enabled_title": { + "message": "Filters ETag headers. Hint: Cache must be cleared before first use.", + "description": "This string is used as title for the ETag header filtering switch" } } \ No newline at end of file diff --git a/_locales/es/messages.json b/_locales/es/messages.json index 9ebaca8..f39e0f5 100644 --- a/_locales/es/messages.json +++ b/_locales/es/messages.json @@ -301,10 +301,6 @@ "message": "Permitir márketing de referidos", "description": "This string is used as title for the referral marketing switch" }, - "watchdog": { - "message": "[ClearURLs]: El watchdog detectado un problema. ClearURLs será reiniciado.", - "description": "This string is used as text for the watchdog" - }, "domain_blocking_enabled": { "message": "Permitir bloqueo de dominios (Puede provocar problemas con sitios que no permitan bloqueadores de anuncios)", "description": "This string is used as label for the domain blocking switch" diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json index 8ae135d..08ddf54 100644 --- a/_locales/fr/messages.json +++ b/_locales/fr/messages.json @@ -301,10 +301,6 @@ "message": "Permettre certaines actions commerciales", "description": "Sert à afficher la signification de la fonction sur la page qui affiche les options." }, - "watchdog": { - "message": "[ClearURLs]: Temps ou délais d’exécution imparti dépassé. ClearURLs doit redémarrer.", - "description": "Sert à afficher la signification de la fonction sur la page qui affiche les options." - }, "domain_blocking_enabled": { "message": "Bloquer les atteintes à la vie privée. Cependant, des sites décèlent la technique de protection et dysfonctionnent délibérément ou affichent des avertissements", "description": "Sert à afficher la signification de la fonction sur la page qui affiche les options." diff --git a/_locales/it/messages.json b/_locales/it/messages.json index c6b8335..cd1756a 100644 --- a/_locales/it/messages.json +++ b/_locales/it/messages.json @@ -301,10 +301,6 @@ "message": "Permette l'utilizzo del referral marketing (esempio: Amazon)", "description": "This string is used as title for the referral marketing switch" }, - "watchdog": { - "message": "[ClearURLs]: Il sistema di controllo ha identificato un problema. ClearURLs verrà riavviato.", - "description": "This string is used as text for the watchdog" - }, "domain_blocking_enabled": { "message": "Permetti il blocco dei domini (può portare a problemi su pagine che non consentono AdBlocker)", "description": "This string is used as label for the domain blocking switch" diff --git a/_locales/ru/messages.json b/_locales/ru/messages.json index 84997c2..520a004 100644 --- a/_locales/ru/messages.json +++ b/_locales/ru/messages.json @@ -301,10 +301,6 @@ "message": "Разрешить рефералы маркетинга", "description": "This string is used as title for the referral marketing switch" }, - "watchdog": { - "message": "[ClearURLs]: сторожевой таймер обнаружил проблему. ClearURLs будет перезапущен.", - "description": "This string is used as text for the watchdog" - }, "domain_blocking_enabled": { "message": "Разрешить блокировку домена (может вызвать проблемы на сайтах, которые запрещают AdBlocker)", "description": "This string is used as label for the domain blocking switch" diff --git a/_locales/sv_SE/messages.json b/_locales/sv_SE/messages.json index ba919e2..551a160 100644 --- a/_locales/sv_SE/messages.json +++ b/_locales/sv_SE/messages.json @@ -301,10 +301,6 @@ "message": "Tillåt referral marketing", "description": "This string is used as title for the referral marketing switch" }, - "watchdog": { - "message": "[ClearURLs]: Ett problem har upptäckts. ClearURLs startar om.", - "description": "This string is used as text for the watchdog" - }, "domain_blocking_enabled": { "message": "Tillåt domänblockering (Kan leda till problem på sidor som inte tillåter AdBlockers)", "description": "This string is used as label for the domain blocking switch" diff --git a/_locales/tr/messages.json b/_locales/tr/messages.json index 2874ffb..61ba6c0 100644 --- a/_locales/tr/messages.json +++ b/_locales/tr/messages.json @@ -301,10 +301,6 @@ "message": "Tavsiye pazarlamasına izin verir", "description": "Bu dize tavsiye pazarlama anahtarı için başlık olarak kullanılır" }, - "watchdog": { - "message": "[ClearURL'ler]: Güvenlik Zamanlayıcısı bir sorun tespit etti. ClearURL'ler yeniden başlatıldı.", - "description": "Bu dize güvenlik zamanlayıcısı için metin olarak kullanılır." - }, "domain_blocking_enabled": { "message": "Alan adı engellemeye izin ver (Reklam Engelleyicilere izin vermeyen sayfalarda sorunlara neden olabilir)", "description": "Bu dize, alan adı engelleme anahtarı için etiket olarak kullanılır" diff --git a/clearurls.js b/clearurls.js index c5eec5d..bf4d388 100644 --- a/clearurls.js +++ b/clearurls.js @@ -22,13 +22,10 @@ */ var providers = []; var prvKeys = []; -var badges = []; -var tabid = 0; var siteBlockedAlert = 'javascript:void(0)'; var dataHash; var localDataHash; var os; -var currentURL; /** * Helper function which remove the tracking fields @@ -36,10 +33,11 @@ var currentURL; * * @param {Provider} provider Provider-Object * @param pureUrl URL as String - * @param {boolean} quiet if the action should be displayed in log and statistics + * @param {boolean} quiet if the action should be displayed in log and statistics + * @param {requestDetails} request the request details * @return {Array} Array with changes and url fields */ -function removeFieldsFormURL(provider, pureUrl, quiet = false) { +function removeFieldsFormURL(provider, pureUrl, quiet = false, request = null) { let url = pureUrl; let domain = ""; let fragments = ""; @@ -70,7 +68,7 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false) { pushToLog(beforeReplace, url, rawRule); } - increaseBadged(quiet); + increaseBadged(quiet, request); changes = true; } }); @@ -91,7 +89,11 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false) { url = decodeURL(re); //Log the action - if (!quiet) pushToLog(pureUrl, url, translate('log_redirect')); + if (!quiet) { + pushToLog(pureUrl, url, translate('log_redirect')); + increaseGlobalURLCounter(1); + increaseBadged(false, request) + }; return { "redirect": true, @@ -131,7 +133,7 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false) { if (!quiet) pushToLog(tempBeforeURL, tempURL, rule); } - increaseBadged(quiet); + increaseBadged(quiet, request); changes = true; } }); @@ -146,7 +148,8 @@ function removeFieldsFormURL(provider, pureUrl, quiet = false) { if (provider.isCaneling() && storage.domainBlocking) { if (!quiet) pushToLog(pureUrl, pureUrl, translate('log_domain_blocked')); - increaseBadged(quiet); + increaseGlobalURLCounter(1); + increaseBadged(quiet, request); cancel = true; } @@ -228,13 +231,26 @@ function start() { } /** - * Get the hash for the rule file on github. + * Deactivates ClearURLs, if no rules can be downloaded and also no old rules in storage + */ + function deactivateOnFailure() { + if(storage.ClearURLsData.length === 0) { + storage.globalStatus = false; + storage.dataHash = ""; + changeIcon(); + storeHashStatus(5); + saveOnExit(); + } + } + + /** + * Get the hash for the rule file on GitLab. * 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 + //Get the target hash from GitLab fetch(storage.hashURL) .then(function (response) { const responseTextHash = response.clone().text().then(function (responseTextHash) { @@ -250,6 +266,7 @@ function start() { } } else { dataHash = false; + deactivateOnFailure(); } }); }); @@ -279,6 +296,8 @@ function start() { storage.ClearURLsData = JSON.parse(storage.ClearURLsData); toObject(storage.ClearURLsData); saveOnDisk(['ClearURLsData', 'dataHash', 'hashStatus']); + } else { + deactivateOnFailure(); } }); } @@ -559,7 +578,8 @@ function start() { if (storage.pingBlocking && storage.pingRequestTypes.includes(request.type)) { pushToLog(request.url, request.url, translate('log_ping_blocked')); - increaseBadged(); + increaseBadged(false, request); + increaseGlobalURLCounter(1); return {cancel: true}; } @@ -567,9 +587,8 @@ function start() { * Call for every provider the removeFieldsFormURL method. */ for (let i = 0; i < providers.length; i++) { - if (providers[i].matchURL(request.url)) { - result = removeFieldsFormURL(providers[i], request.url); + result = removeFieldsFormURL(providers[i], request.url, false, request); } /* @@ -629,39 +648,6 @@ function start() { 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) { - if (!browser.runtime.lastError) { // https://gitlab.com/KevinRoebert/ClearUrls/issues/346 - currentURL = tab.url; - } - }).catch(handleError); - } - - /** - * Call by each tab change. - */ - browser.tabs.onActivated.addListener(handleActivated); - /** * Check the request. */ @@ -697,53 +683,3 @@ function start() { ["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) { - const limit = storage.logLimit; - if (storage.loggingStatus && limit !== 0) { - if (limit > 0 && !isNaN(limit)) { - while (storage.log.log.length >= limit) { - storage.log.log.shift(); - } - } - - storage.log.log.push( - { - "before": beforeProcessing, - "after": afterProcessing, - "rule": rule, - "timestamp": Date.now() - } - ); - 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}).catch(handleError); - } else { - browser.browserAction.setBadgeText({text: "", tabId: tabid}).catch(handleError); - } - } - }); -} diff --git a/core_js/badgedHandler.js b/core_js/badgedHandler.js new file mode 100644 index 0000000..df3817f --- /dev/null +++ b/core_js/badgedHandler.js @@ -0,0 +1,77 @@ +/* +* ClearURLs +* Copyright (c) 2017-2020 Kevin Röbert +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, see . +*/ + +/*jshint esversion: 6 */ +/* +* This script is responsible for setting the badged. +*/ + +let badges = {}; + +/** + * Increases the badged by one. + */ +function increaseBadged(quiet = false, request) { + if (!quiet) increaseURLCounter(); + + if(request === null) return; + + const tabId = request.tabId; + const url = request.url; + + if(tabId === -1) return; + + if (badges[tabId] == null) { + badges[tabId] = { + counter: 1, + lastURL: url + }; + } else { + badges[tabId].counter += 1; + } + + checkOSAndroid().then((res) => { + if (!res) { + if (storage.badgedStatus && !quiet) { + browser.browserAction.setBadgeText({text: (badges[tabId]).counter.toString(), tabId: tabId}).catch(handleError); + } else { + browser.browserAction.setBadgeText({text: "", tabId: tabId}).catch(handleError); + } + } + }); +} + +/** + * Call by each tab is updated. + * And if url has changed. + */ +function handleUpdated(tabId, changeInfo, tabInfo) { + if(!badges[tabId] || !changeInfo.url) return; + + if (badges[tabId].lastURL !== changeInfo.url) { + badges[tabId] = { + counter: 0, + lastURL: tabInfo.url + }; + } +} + +/** + * Call by each tab is updated. + */ +browser.tabs.onUpdated.addListener(handleUpdated); \ No newline at end of file diff --git a/core_js/eTagFilter.js b/core_js/eTagFilter.js new file mode 100644 index 0000000..6a92a39 --- /dev/null +++ b/core_js/eTagFilter.js @@ -0,0 +1,45 @@ +/* +* ClearURLs +* Copyright (c) 2017-2020 Kevin Röbert +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program. If not, see . +*/ + +/*jshint esversion: 6 */ + +/** + * Filters eTag headers from web requests. + */ +function eTagFilter(requestDetails) { + if(!requestDetails.responseHeaders || !storage.eTagFiltering) return {}; + const responseHeaders = requestDetails.responseHeaders; + + const filteredHeaders = responseHeaders.filter(header => { + return header.name.toLowerCase() !== "etag"; + }); + + if(filteredHeaders.length < responseHeaders.length) { + pushToLog(requestDetails.url, requestDetails.url, translate("eTag_filtering_log")); + increaseBadged(false, requestDetails); + increaseGlobalURLCounter(1); + + return {responseHeaders: filteredHeaders}; + } +} + +browser.webRequest.onHeadersReceived.addListener( + eTagFilter, + {urls: [""]}, + ["blocking", "responseHeaders"] +); \ No newline at end of file diff --git a/core_js/settings.js b/core_js/settings.js index afb6c6d..8cf6f11 100644 --- a/core_js/settings.js +++ b/core_js/settings.js @@ -115,6 +115,7 @@ function getData() .then(() => loadData("referralMarketing")) .then(() => loadData("domainBlocking")) .then(() => loadData("pingBlocking")) + .then(() => loadData("eTagFiltering")) .then(() => { changeSwitchButton("localHostsSkipping", "localHostsSkipping"); changeSwitchButton("historyListenerEnabled", "historyListenerEnabled"); @@ -122,6 +123,7 @@ function getData() changeSwitchButton("referralMarketing", "referralMarketing"); changeSwitchButton("domainBlocking", "domainBlocking"); changeSwitchButton("pingBlocking", "pingBlocking"); + changeSwitchButton("eTagFiltering", "eTagFiltering"); }).catch(handleError); } @@ -189,6 +191,8 @@ function setText() injectText("domain_blocking_enabled", "domain_blocking_enabled"); $('#ping_blocking_enabled').html(translate('ping_blocking_enabled')) .prop('title', translate('ping_blocking_enabled_title')); + $('#eTag_filtering_enabled').html(translate('eTag_filtering_enabled')) + .prop('title', translate('eTag_filtering_enabled_title')) } /** diff --git a/core_js/storage.js b/core_js/storage.js index 65ad0bd..65f73ec 100644 --- a/core_js/storage.js +++ b/core_js/storage.js @@ -202,6 +202,8 @@ function initSettings() { storage.logLimit = -1; storage.domainBlocking = true; storage.pingBlocking = true; + storage.eTagFiltering = true; + storage.watchDogErrorCount = 0; 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"]; @@ -268,6 +270,10 @@ function storeHashStatus(status_code) { case 3: status_code = "hash_status_code_3"; break; + case 5: + status_code = "hash_status_code_5"; + break; + case 4: default: status_code = "hash_status_code_4"; } diff --git a/core_js/tools.js b/core_js/tools.js index 8f845a3..4d3d983 100644 --- a/core_js/tools.js +++ b/core_js/tools.js @@ -47,10 +47,12 @@ function isEmpty(obj) { /** * Translate a string with the i18n API. * - * @param {string} string Name of the attribute used for localization + * @param {string} string Name of the attribute used for localization + * @param {string[]} placeholders Array of placeholders */ -function translate(string) { - return browser.i18n.getMessage(string); +function translate(string, ...placeholders) +{ + return browser.i18n.getMessage(string, placeholders); } /** @@ -181,32 +183,6 @@ function loadOldDataFromStore() { localDataHash = storage.dataHash; } -/** - * Save the hash status to the local storage (RAM). - * The status can have the following values: - * 1 "up to date" - * 2 "updated" - * 3 "update available" - * @param status_code the number for the status - */ -function storeHashStatus(status_code) { - switch (status_code) { - case 1: - status_code = "hash_status_code_1"; - break; - case 2: - status_code = "hash_status_code_2"; - break; - case 3: - status_code = "hash_status_code_3"; - break; - default: - status_code = "hash_status_code_4"; - } - - storage.hashStatus = status_code; -} - /** * Increase by {number} the GlobalURLCounter * @param {int} number @@ -257,6 +233,9 @@ function setBadgedStatus() { browser.browserAction.setBadgeBackgroundColor({ 'color': color }).catch(handleError); + browser.browserAction.setBadgeTextColor({ + color: "#FFFFFF" + }).catch(handleError); } }); } @@ -305,4 +284,42 @@ Object.prototype.getOrDefault = function (key, defaultValue) { function handleError(error) { console.log(translate('core_error') + ":" + error); +} + +/** + * 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) { + const limit = storage.logLimit; + if (storage.loggingStatus && limit !== 0) { + if (limit > 0 && !isNaN(limit)) { + while (storage.log.log.length >= limit) { + storage.log.log.shift(); + } + } + + storage.log.log.push( + { + "before": beforeProcessing, + "after": afterProcessing, + "rule": rule, + "timestamp": Date.now() + } + ); + deferSaveOnDisk('log'); + } +} + +/** + * Checks if the storage is available. + */ +function isStorageAvailable() { + return storage.ClearURLsData.length !== 0; } \ No newline at end of file diff --git a/core_js/watchdog.js b/core_js/watchdog.js index f3105fa..bfd37e4 100644 --- a/core_js/watchdog.js +++ b/core_js/watchdog.js @@ -24,15 +24,21 @@ * * This watchdog restarts the whole Add-on, when the check fails. */ -const CHECK_INTERVAL = 15000; +const CHECK_INTERVAL = 60000; setInterval(function() { - const dirtyURL = "https://clearurls.roebert.eu?utm_source=addon"; - const cleanURL = "https://clearurls.roebert.eu"; + if(isStorageAvailable() && storage.globalStatus) { + const dirtyURL = "https://clearurls.roebert.eu?utm_source=addon"; + const cleanURL = "https://clearurls.roebert.eu"; - if(pureCleaning(dirtyURL, true) !== cleanURL) { - console.log(translate('watchdog')); - saveOnExit(); - reload(); + if(pureCleaning(dirtyURL, true) !== cleanURL) { + storage.watchDogErrorCount += 1; + console.log(translate('watchdog', storage.watchDogErrorCount)); + saveOnExit(); + if(storage.watchDogErrorCount < 3) reload(); + } else if(storage.watchDogErrorCount > 0){ + storage.watchDogErrorCount = 0; + saveOnExit(); + } } }, CHECK_INTERVAL); \ No newline at end of file diff --git a/html/settings.html b/html/settings.html index a57dbff..481c4bf 100644 --- a/html/settings.html +++ b/html/settings.html @@ -161,6 +161,13 @@ along with this program. If not, see .

+

+
+ +