From c51155ed36754975d2b8673e37e58df6201702b8 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Thu, 27 Apr 2023 13:01:46 -0700 Subject: [PATCH] Replace `Blocklists` with `Filter Lists`. https://redmine.stoutner.com/issues/705 --- app/src/main/assets/de/about_licenses.html | 4 +- app/src/main/assets/de/guide_requests.html | 74 +- app/src/main/assets/en/about_licenses.html | 4 +- app/src/main/assets/en/guide_requests.html | 60 +- app/src/main/assets/es/about_licenses.html | 4 +- app/src/main/assets/es/guide_requests.html | 73 +- .../{blocklists => filterlists}/easylist.txt | 0 .../easyprivacy.txt | 0 .../fanboy-annoyance.txt | 0 .../fanboy-social.txt | 0 .../{blocklists => filterlists}/ultralist.txt | 4 +- .../ultraprivacy.txt | 6 +- app/src/main/assets/fr/about_licenses.html | 4 +- app/src/main/assets/fr/guide_requests.html | 74 +- app/src/main/assets/it/about_licenses.html | 4 +- app/src/main/assets/it/guide_requests.html | 74 +- .../main/assets/pt-rBR/about_licenses.html | 4 +- .../main/assets/pt-rBR/guide_requests.html | 73 +- app/src/main/assets/ru/about_licenses.html | 4 +- app/src/main/assets/ru/guide_requests.html | 70 +- app/src/main/assets/tr/about_licenses.html | 4 +- app/src/main/assets/tr/guide_requests.html | 72 +- .../main/assets/zh-rCN/about_licenses.html | 4 +- .../main/assets/zh-rCN/guide_requests.html | 69 +- .../activities/AboutActivity.kt | 18 +- .../activities/ImportExportActivity.kt | 2 +- .../activities/MainWebViewActivity.kt | 156 +- .../activities/RequestsActivity.kt | 2 +- .../adapters/AboutPagerAdapter.kt | 4 +- ...ine.kt => PopulateFilterListsCoroutine.kt} | 78 +- .../dialogs/ViewRequestDialog.kt | 118 +- .../fragments/AboutVersionFragment.kt | 108 +- .../helpers/CheckBlocklistHelper.kt | 484 ------ .../helpers/CheckFilterListHelper.kt | 487 ++++++ ...listHelper.kt => ParseFilterListHelper.kt} | 1338 +++++++++-------- .../views/NestedScrollWebView.kt | 12 +- .../res/layout/about_version_scrollview.xml | 8 +- .../layout/main_framelayout_bottom_appbar.xml | 8 +- .../layout/main_framelayout_top_appbar.xml | 8 +- .../main/res/layout/view_request_dialog.xml | 26 +- .../main/res/menu/webview_options_menu.xml | 6 +- app/src/main/res/values-de/strings.xml | 34 +- app/src/main/res/values-es/strings.xml | 34 +- app/src/main/res/values-fr/strings.xml | 34 +- app/src/main/res/values-it/strings.xml | 34 +- app/src/main/res/values-pt-rBR/strings.xml | 34 +- app/src/main/res/values-ru/strings.xml | 34 +- app/src/main/res/values-tr/strings.xml | 34 +- app/src/main/res/values-zh-rCN/strings.xml | 34 +- app/src/main/res/values/strings.xml | 66 +- app/src/main/res/xml/preferences.xml | 6 +- 51 files changed, 1849 insertions(+), 2043 deletions(-) rename app/src/main/assets/{blocklists => filterlists}/easylist.txt (100%) rename app/src/main/assets/{blocklists => filterlists}/easyprivacy.txt (100%) rename app/src/main/assets/{blocklists => filterlists}/fanboy-annoyance.txt (100%) rename app/src/main/assets/{blocklists => filterlists}/fanboy-social.txt (100%) rename app/src/main/assets/{blocklists => filterlists}/ultralist.txt (66%) rename app/src/main/assets/{blocklists => filterlists}/ultraprivacy.txt (76%) rename app/src/main/java/com/stoutner/privacybrowser/coroutines/{PopulateBlocklistsCoroutine.kt => PopulateFilterListsCoroutine.kt} (51%) delete mode 100644 app/src/main/java/com/stoutner/privacybrowser/helpers/CheckBlocklistHelper.kt create mode 100644 app/src/main/java/com/stoutner/privacybrowser/helpers/CheckFilterListHelper.kt rename app/src/main/java/com/stoutner/privacybrowser/helpers/{ParseBlocklistHelper.kt => ParseFilterListHelper.kt} (53%) diff --git a/app/src/main/assets/de/about_licenses.html b/app/src/main/assets/de/about_licenses.html index 2e8dc438..6d5892f0 100644 --- a/app/src/main/assets/de/about_licenses.html +++ b/app/src/main/assets/de/about_licenses.html @@ -37,7 +37,7 @@

Privacy Browser ist veröffentlicht unter der GPLv3+ Lizenz. The full text of the license is below. The source code is available from gitweb.stoutner.com.

-

Blocklists:

+

Filter Lists

EasyList and EasyPrivacy are dual licensed under the GPLv3+ and the Creative Commons Attribution-ShareAlike 3.0+ Unported licenses. @@ -47,7 +47,7 @@ are released under the Creative Commons Attribution 3.0 Unported license, which is compatible with the GPLv3+. The lists are included unchanged in Privacy Browser.

-

More information about the blocklists can be found on the EasyList website.

+

More information about the filter lists can be found on the EasyList website.

Bibliotheken:

Privacy Browser baut auf den AndroidX-Bibliotheken, diff --git a/app/src/main/assets/de/guide_requests.html b/app/src/main/assets/de/guide_requests.html index 43688773..34a0c391 100644 --- a/app/src/main/assets/de/guide_requests.html +++ b/app/src/main/assets/de/guide_requests.html @@ -38,33 +38,33 @@ -

Privacy Browser enthält vier gebräuchliche Filterlisten, die auf der Adblock-Syntax basieren: - EasyList, EasyPrivacy, Fanboy’s Annoyance Filterliste und Fanboy’s Social Blocking Filterliste. - Diese werden in 22 Unter-Listen aufgeteilt, welche die Ressourcen-Zugriffe in der folgenden Reihenfolge überprüfen:

+

Privacy Browser includes four common filter lists based on the Adblock syntax: + EasyList, EasyPrivacy, Fanboy’s Annoyance List, and Fanboy’s Social Blocking List. + These filter lists are processed by Privacy Browser into the following 22 sublists, which check resource requests in the order listed.

    -
  1. Haupt-Positivliste
  2. -
  3. Positivliste (URL-Ende)
  4. -
  5. Domänen-Positivliste
  6. -
  7. Domänen-Positivliste (URL-Anfang)
  8. -
  9. Domänen-Positivliste (URL-Ende)
  10. -
  11. Drittanbieter-Positivliste
  12. -
  13. Drittanbieter-Domänen-Positivliste
  14. -
  15. Drittanbieter-Domänen-Positivliste (URL-Anfang)
  16. -
  17. Haupt-Negativliste
  18. -
  19. Negativliste (URL-Anfang)
  20. -
  21. Negativliste (URL-Ende)
  22. -
  23. Domänen-Negativliste
  24. -
  25. Domänen-Negativliste (URL-Anfang)
  26. -
  27. Domänen-Negativliste (URL-Ende)
  28. -
  29. Domänen-Negativliste mit regulären Ausdrücken
  30. -
  31. Drittanbieter-Negativliste
  32. -
  33. Drittanbieter-Negativliste (URL-Anfang)
  34. -
  35. Drittanbieter-Domänen-Negativliste
  36. -
  37. Drittanbieter-Domänen-Negativliste (URL-Anfang)
  38. -
  39. Drittanbieter-Negativliste mit regulären Ausdrücken
  40. -
  41. Drittanbieter-Domänen-Negativliste mit regulären Ausdrücken
  42. -
  43. Negativliste mit regulären Ausdrücken
  44. +
  45. Main Allow List
  46. +
  47. Final Allow List
  48. +
  49. Domain Allow List
  50. +
  51. Domain Initial Allow List
  52. +
  53. Domain Final Allow List
  54. +
  55. Third-Party Allow List
  56. +
  57. Third-Party Domain Allow List
  58. +
  59. Third-Party Domain Initial Allow List
  60. +
  61. Main Block List
  62. +
  63. Initial Block List
  64. +
  65. Final Block List
  66. +
  67. Domain Block List
  68. +
  69. Domain Initial Block List
  70. +
  71. Domain Final Block List
  72. +
  73. Domain Regular Expression Block List
  74. +
  75. Third-Party Block List
  76. +
  77. Third-Party Initial Block List
  78. +
  79. Third-Party Domain Block List
  80. +
  81. Third-Party Domain Initial Block List
  82. +
  83. Third-Party Regular Expression Block List
  84. +
  85. Third-Party Domain Regular Expression Block List
  86. +
  87. Regular Expression Block List

Listen mit "(URL-Anfang)" prüfen gegen den Anfang einer URL, solche mit "(URL-Ende)" gegen das Ende der URL. Domänen-Listen prüfen gegen bestimmte Domains. @@ -72,17 +72,17 @@ Listen mit regulären Ausdrücken folgen der Syntax für reguläre Ausdrücke. Jede Unter-Liste hat dabei einen oder mehrere Einträge. Bei Domänen-Unterlisten werden die Ressourcen-Zugriffe nur dann überprüft, wenn der erste Eintrag der Domain der aufgerufenen URL entspricht.

-

Aufgrund von Einschränkungen in Android’s WebView und um die Geschwindigkeit von Anfragen zu steigern, verwendet Privacy Browser eine vereinfachte Auswertung der Adblock-Syntax. - Dies kann manchmal zu "false positives" führen, bei denen Ressourcen erlaubt oder blockiert werden, die in den originalen Einträgen anders intendiert wären. - Eine detailiertere Beschreibung, wie die Listen-Einträge abgearbeitet werden, ist unter stoutner.com verfügbar.

- -

Privacy Browser verfügt über drei zusätzliche Filterlisten: - UltraList und - UltraPrivacy - blockieren Werbung und Tracker, die EasyList und EasyPrivacy durchlassen. Die dritte Filterliste blockiert alle Drittanbieter-Anfragen. - Eine Anfrage wird dabei nur als Drittanbieter-Anfrage gewertet, wenn die Basis-Domain der Anfrage eine andere ist als die Basis-Domain der angefragten URL. - Lädt zum Beispiel die Seite www.website.com ein Bild von images.website.com, wird diese Anfrage nicht als Drittanbieter-Anfrage gewertet, - da die beiden Anfragen dieselbe Basis-Domain website.com haben. - Alle Drittanbieter-Anfragen zu blockieren verbessert zwar die Privatsphäre, diese Einstellung ist jedoch standardmäßig deaktiviert, da dadurch viele Webseiten verunstaltet werden können.

+

Because of limitations in Android’s WebView, and to speed up processing of requests, Privacy Browser implements a simplified interpretation of the Adblock syntax. + This can sometimes lead to false positives, where resources are allowed or blocked in ways that weren’t intended by the original entry. + A more detailed description of how the filter list entries are processed is available at stoutner.com.

+ +

Privacy Browser has three additional filter lists. + UltraList and + UltraPrivacy + filters ads and trackers that EasyList and EasyPrivacy do not. The third blocks all third-party requests. + A request is only considered third-party if the base domain of the request is different than the base domain of the URL. + For example, if www.website.com loads a picture from images.website.com, + this is not blocked as a third-party request because they both share the same base domain of website.com. + Blocking all third-party requests increases privacy, but this filter list is disabled by default because it breaks a large number of websites.

diff --git a/app/src/main/assets/en/about_licenses.html b/app/src/main/assets/en/about_licenses.html index 0e785ea1..ab8fe9c3 100644 --- a/app/src/main/assets/en/about_licenses.html +++ b/app/src/main/assets/en/about_licenses.html @@ -34,7 +34,7 @@

Privacy Browser is released under the GPLv3+ license. The full text of the license is below. The source code is available from gitweb.stoutner.com.

-

Blocklists

+

Filter Lists

EasyList and EasyPrivacy are dual licensed under the GPLv3+ and the Creative Commons Attribution-ShareAlike 3.0+ Unported licenses. @@ -44,7 +44,7 @@ are released under the Creative Commons Attribution 3.0 Unported license, which is compatible with the GPLv3+. The lists are included unchanged in Privacy Browser.

-

More information about the blocklists can be found on the EasyList website.

+

More information about the filter lists can be found on the EasyList website.

Libraries

Privacy Browser is built with the AndroidX Libraries, diff --git a/app/src/main/assets/en/guide_requests.html b/app/src/main/assets/en/guide_requests.html index 5f4d1d56..53550f95 100644 --- a/app/src/main/assets/en/guide_requests.html +++ b/app/src/main/assets/en/guide_requests.html @@ -34,33 +34,33 @@ -

Privacy Browser includes four common blocklists based on the Adblock syntax: +

Privacy Browser includes four common filter lists based on the Adblock syntax: EasyList, EasyPrivacy, Fanboy’s Annoyance List, and Fanboy’s Social Blocking List. - These blocklists are processed by Privacy Browser into the following 22 sublists, which check resource requests in the order listed.

+ These filter lists are processed by Privacy Browser into the following 22 sublists, which check resource requests in the order listed.

    -
  1. Main Whitelist
  2. -
  3. Final Whitelist
  4. -
  5. Domain Whitelist
  6. -
  7. Domain Initial Whitelist
  8. -
  9. Domain Final Whitelist
  10. -
  11. Third-Party Whitelist
  12. -
  13. Third-Party Domain Whitelist
  14. -
  15. Third-Party Domain Initial Whitelist
  16. -
  17. Main Blacklist
  18. -
  19. Initial Blacklist
  20. -
  21. Final Blacklist
  22. -
  23. Domain Blacklist
  24. -
  25. Domain Initial Blacklist
  26. -
  27. Domain Final Blacklist
  28. -
  29. Domain Regular Expression Blacklist
  30. -
  31. Third-Party Blacklist
  32. -
  33. Third-Party Initial Blacklist
  34. -
  35. Third-Party Domain Blacklist
  36. -
  37. Third-Party Domain Initial Blacklist
  38. -
  39. Third-Party Regular Expression Blacklist
  40. -
  41. Third-Party Domain Regular Expression Blacklist
  42. -
  43. Regular Expression Blacklist
  44. +
  45. Main Allow List
  46. +
  47. Final Allow List
  48. +
  49. Domain Allow List
  50. +
  51. Domain Initial Allow List
  52. +
  53. Domain Final Allow List
  54. +
  55. Third-Party Allow List
  56. +
  57. Third-Party Domain Allow List
  58. +
  59. Third-Party Domain Initial Allow List
  60. +
  61. Main Block List
  62. +
  63. Initial Block List
  64. +
  65. Final Block List
  66. +
  67. Domain Block List
  68. +
  69. Domain Initial Block List
  70. +
  71. Domain Final Block List
  72. +
  73. Domain Regular Expression Block List
  74. +
  75. Third-Party Block List
  76. +
  77. Third-Party Initial Block List
  78. +
  79. Third-Party Domain Block List
  80. +
  81. Third-Party Domain Initial Block List
  82. +
  83. Third-Party Regular Expression Block List
  84. +
  85. Third-Party Domain Regular Expression Block List
  86. +
  87. Regular Expression Block List

Initial lists check against the beginning of the URL. Final lists check against the end of the URL. Domain lists only check against certain domains. @@ -70,15 +70,15 @@

Because of limitations in Android’s WebView, and to speed up processing of requests, Privacy Browser implements a simplified interpretation of the Adblock syntax. This can sometimes lead to false positives, where resources are allowed or blocked in ways that weren’t intended by the original entry. - A more detailed description of how the blocklist entries are processed is available at stoutner.com.

+ A more detailed description of how the filter list entries are processed is available at stoutner.com.

-

Privacy Browser has three additional blocklists. - UltraList and - UltraPrivacy - block ads and trackers that EasyList and EasyPrivacy do not. The third blocks all third-party requests. +

Privacy Browser has three additional filter lists. + UltraList and + UltraPrivacy + filters ads and trackers that EasyList and EasyPrivacy do not. The third blocks all third-party requests. A request is only considered third-party if the base domain of the request is different than the base domain of the URL. For example, if www.website.com loads a picture from images.website.com, this is not blocked as a third-party request because they both share the same base domain of website.com. - Blocking all third-party requests increases privacy, but this blocklist is disabled by default because it breaks a large number of websites.

+ Blocking all third-party requests increases privacy, but this filter list is disabled by default because it breaks a large number of websites.

diff --git a/app/src/main/assets/es/about_licenses.html b/app/src/main/assets/es/about_licenses.html index 637c9d3a..75767103 100644 --- a/app/src/main/assets/es/about_licenses.html +++ b/app/src/main/assets/es/about_licenses.html @@ -37,7 +37,7 @@ El texto completo de la licencia se encuentra en la parte inferior de este documento (se deja en el idioma original). El código fuente está disponible en gitweb.stoutner.com.

-

Listas de bloqueo

+

Filter Lists

EasyList y EasyPrivacy tienen licencia dual bajo las licencias GPLv3+ y Creative Commons Attribution-ShareAlike 3.0+ Unported. Navegador Privado las incorpora usando la opción GPLv3+.

@@ -46,7 +46,7 @@ se liberan bajo la licencia Creative Commons Attribution 3.0 Unported, la cual es compatible con la GPLv3+. Las listas se incluyen sin cambios en Navegador Privado.

-

Más información sobre las listas de bloqueo puede encontrarse en la página web de EasyList.

+

More information about the filter lists can be found on the EasyList website.

Librerías

Navegador Privado está construido con las librerías de AndroidX, diff --git a/app/src/main/assets/es/guide_requests.html b/app/src/main/assets/es/guide_requests.html index cbfa7abd..f6335cac 100644 --- a/app/src/main/assets/es/guide_requests.html +++ b/app/src/main/assets/es/guide_requests.html @@ -37,33 +37,33 @@ -

Navegador Privado incluye cuatro listas de bloqueo comunes basadas en la sintaxis de Adblock: - EasyList, EasyPrivacy, Lista molesta de Fanboy y Lista de bloqueo social de Fanboy. - Estas listas de bloqueo son procesadas por Navegador Privado en las siguientes 22 sublistas, que verifican las solicitudes de recursos en el orden listado.

+

Privacy Browser includes four common filter lists based on the Adblock syntax: + EasyList, EasyPrivacy, Fanboy’s Annoyance List, and Fanboy’s Social Blocking List. + These filter lists are processed by Privacy Browser into the following 22 sublists, which check resource requests in the order listed.

    -
  1. Lista blanca principal
  2. -
  3. Lista blanca final
  4. -
  5. Lista blanca de dominios
  6. -
  7. Lista blanca inicial de dominios
  8. -
  9. Lista blanca final de dominios
  10. -
  11. Lista blanca de terceros
  12. -
  13. Lista blanca de dominios de terceros
  14. -
  15. Lista blanca inicial de dominios de terceros
  16. -
  17. Lista negra principal
  18. -
  19. Lista negra inicial
  20. -
  21. Lista negra final
  22. -
  23. Lista negra de dominios
  24. -
  25. Lista negra inicial de dominios
  26. -
  27. Lista negra final de dominios
  28. -
  29. Lista negra de expresiones regulares de dominios
  30. -
  31. Lista negra de terceros
  32. -
  33. Lista negra inicial de terceros
  34. -
  35. Lista negra de dominios de terceros
  36. -
  37. Lista negra inicial de dominios de terceros
  38. -
  39. Lista negra de expresiones regulares de terceros
  40. -
  41. Lista negra de expresiones regulares de dominios de terceros
  42. -
  43. Lista negra de expresiones regulares
  44. +
  45. Main Allow List
  46. +
  47. Final Allow List
  48. +
  49. Domain Allow List
  50. +
  51. Domain Initial Allow List
  52. +
  53. Domain Final Allow List
  54. +
  55. Third-Party Allow List
  56. +
  57. Third-Party Domain Allow List
  58. +
  59. Third-Party Domain Initial Allow List
  60. +
  61. Main Block List
  62. +
  63. Initial Block List
  64. +
  65. Final Block List
  66. +
  67. Domain Block List
  68. +
  69. Domain Initial Block List
  70. +
  71. Domain Final Block List
  72. +
  73. Domain Regular Expression Block List
  74. +
  75. Third-Party Block List
  76. +
  77. Third-Party Initial Block List
  78. +
  79. Third-Party Domain Block List
  80. +
  81. Third-Party Domain Initial Block List
  82. +
  83. Third-Party Regular Expression Block List
  84. +
  85. Third-Party Domain Regular Expression Block List
  86. +
  87. Regular Expression Block List

Las listas iniciales se comparan con el principio de la URL. Las listas finales se comparan con el final de la URL. Las listas de dominios sólo se comparan con ciertos dominios. @@ -72,16 +72,17 @@ Cada elemento de la sublista tiene una o más entradas. En el caso de sublistas de dominio, la solicitud de recurso sólo se compara con el artículo si la primera entrada coincide con el dominio de la URL principal.

-

Debido a las limitaciones del WebView de Android, y para acelerar el procesamiento de las solicitudes, Navegador Privado implementa una interpretación simplificada de la sintaxis de Adblock. - Esto puede conducir a veces a falsos positivos, en los que los recursos se permiten o bloquean de formas que no estaban previstas en la entrada original. - Una descripción más detallada de cómo se procesan las entradas de la lista de bloqueo está disponible en stoutner.com.

- -

Navegador Privado tiene tres listas de bloqueo adicionales. - UltraList y UltraPrivacy - bloquean los anuncios y rastreadores que EasyList y EasyPrivacy no bloquea. La tercera bloquea todas las peticiones de terceras partes. - Una solicitud sólo se considera de terceras partes si el dominio base de la solicitud es diferente del dominio base de la URL. - Por ejemplo, si www.website.com carga una imagen de images.website.com, - esto no se bloquea como petición de una tercera parte porque ambos comparten el mismo dominio base de website.com. - El bloqueo de todas las solicitudes de terceras partes aumenta la privacidad, pero esta lista de bloqueo está desactivada por defecto porque rompe un gran número de páginas web.

+

Because of limitations in Android’s WebView, and to speed up processing of requests, Privacy Browser implements a simplified interpretation of the Adblock syntax. + This can sometimes lead to false positives, where resources are allowed or blocked in ways that weren’t intended by the original entry. + A more detailed description of how the filter list entries are processed is available at stoutner.com.

+ +

Privacy Browser has three additional filter lists. + UltraList and + UltraPrivacy + filters ads and trackers that EasyList and EasyPrivacy do not. The third blocks all third-party requests. + A request is only considered third-party if the base domain of the request is different than the base domain of the URL. + For example, if www.website.com loads a picture from images.website.com, + this is not blocked as a third-party request because they both share the same base domain of website.com. + Blocking all third-party requests increases privacy, but this filter list is disabled by default because it breaks a large number of websites.

diff --git a/app/src/main/assets/blocklists/easylist.txt b/app/src/main/assets/filterlists/easylist.txt similarity index 100% rename from app/src/main/assets/blocklists/easylist.txt rename to app/src/main/assets/filterlists/easylist.txt diff --git a/app/src/main/assets/blocklists/easyprivacy.txt b/app/src/main/assets/filterlists/easyprivacy.txt similarity index 100% rename from app/src/main/assets/blocklists/easyprivacy.txt rename to app/src/main/assets/filterlists/easyprivacy.txt diff --git a/app/src/main/assets/blocklists/fanboy-annoyance.txt b/app/src/main/assets/filterlists/fanboy-annoyance.txt similarity index 100% rename from app/src/main/assets/blocklists/fanboy-annoyance.txt rename to app/src/main/assets/filterlists/fanboy-annoyance.txt diff --git a/app/src/main/assets/blocklists/fanboy-social.txt b/app/src/main/assets/filterlists/fanboy-social.txt similarity index 100% rename from app/src/main/assets/blocklists/fanboy-social.txt rename to app/src/main/assets/filterlists/fanboy-social.txt diff --git a/app/src/main/assets/blocklists/ultralist.txt b/app/src/main/assets/filterlists/ultralist.txt similarity index 66% rename from app/src/main/assets/blocklists/ultralist.txt rename to app/src/main/assets/filterlists/ultralist.txt index bde76216..5445a93a 100644 --- a/app/src/main/assets/blocklists/ultralist.txt +++ b/app/src/main/assets/filterlists/ultralist.txt @@ -1,9 +1,9 @@ [Adblock Plus 2.0] ! Version: 1 ! Title: UltraList -! Last modified: 9 July 2019 18:11 UTC +! Last modified: 27 Apr 2023 18:57 UTC ! Expires: 90 days (update frequency) -! Homepage: https://www.stoutner.com/privacy-browser/blocklists/ultralist/ +! Homepage: https://www.stoutner.com/privacy-browser-android/filter-lists/ultralist/ ! Licence: GPLv3+ http://www.gnu.org/licenses/gpl-3.0.html ! ! There should be no `adservice` on my system. diff --git a/app/src/main/assets/blocklists/ultraprivacy.txt b/app/src/main/assets/filterlists/ultraprivacy.txt similarity index 76% rename from app/src/main/assets/blocklists/ultraprivacy.txt rename to app/src/main/assets/filterlists/ultraprivacy.txt index 30b88c5d..bbb5cd4b 100644 --- a/app/src/main/assets/blocklists/ultraprivacy.txt +++ b/app/src/main/assets/filterlists/ultraprivacy.txt @@ -1,9 +1,9 @@ [Adblock Plus 2.0] ! Version: 3 ! Title: UltraPrivacy -! Last modified: 30 July 2022 02:06 UTC +! Last modified: 27 Apr 2023 19:27 UTC ! Expires: 90 days (update frequency) -! Homepage: https://www.stoutner.com/privacy-browser-android/blocklists/ultraprivacy/ +! Homepage: https://www.stoutner.com/privacy-browser-android/filter-lists/ultraprivacy/ ! Licence: GPLv3+ http://www.gnu.org/licenses/gpl-3.0.html ! ! I can't imagine that anything that includes `analytics` is good for your privacy. @@ -11,4 +11,4 @@ analytics ! Block Google Tag Services. googletagservices ! There shall be no connecting to Facebook on the backend. -connect.facebook \ No newline at end of file +connect.facebook diff --git a/app/src/main/assets/fr/about_licenses.html b/app/src/main/assets/fr/about_licenses.html index 7e73b29e..e76edb63 100644 --- a/app/src/main/assets/fr/about_licenses.html +++ b/app/src/main/assets/fr/about_licenses.html @@ -36,7 +36,7 @@

rivacy Browser est publié sous la licence GPLv3+. Le texte complet de la licence est ci-dessous. Le code source est disponible à partir de gitweb.stoutner.com.

-

Listes de blocage

+

Filter Lists

EasyList et EasyPrivacy sont licences doubles GPLv3+ et Creative Commons Attribution-ShareAlike 3.0+ Unported. @@ -46,7 +46,7 @@ sont publiés sous la licence Creative Commons Attribution 3.0 Unported license, qui est compatible avec la GPLv3+. Les listes ne sont pas modifiées dans Privacy Browser.

-

Pour plus d'informations sur les listes de blocage, consultez le site web EasyList.

+

More information about the filter lists can be found on the EasyList website.

Librairies

Privacy Browser est construit avec les librairies AndroidX, diff --git a/app/src/main/assets/fr/guide_requests.html b/app/src/main/assets/fr/guide_requests.html index 067f0a99..56485c22 100644 --- a/app/src/main/assets/fr/guide_requests.html +++ b/app/src/main/assets/fr/guide_requests.html @@ -38,33 +38,33 @@ -

Privacy Browser inclus quatre listes noires communes basées sur la syntaxe d'Adblock: - EasyList, EasyPrivacy, Fanboy’s Annoyance List, et Fanboy’s Social Blocking List. - Ces listes noires sont executées par Privacy Browser dans les 22 sous-listes suivantes, qui vérifient les demandes de ressources dans l'ordre indiqué.

+

Privacy Browser includes four common filter lists based on the Adblock syntax: + EasyList, EasyPrivacy, Fanboy’s Annoyance List, and Fanboy’s Social Blocking List. + These filter lists are processed by Privacy Browser into the following 22 sublists, which check resource requests in the order listed.

    -
  1. Main Whitelist
  2. -
  3. Final Whitelist
  4. -
  5. Domain Whitelist
  6. -
  7. Domain Initial Whitelist
  8. -
  9. Domain Final Whitelist
  10. -
  11. Third-Party Whitelist
  12. -
  13. Third-Party Domain Whitelist
  14. -
  15. Third-Party Domain Initial Whitelist
  16. -
  17. Main Blacklist
  18. -
  19. Initial Blacklist
  20. -
  21. Final Blacklist
  22. -
  23. Domain Blacklist
  24. -
  25. Domain Initial Blacklist
  26. -
  27. Domain Final Blacklist
  28. -
  29. Domain Regular Expression Blacklist
  30. -
  31. Third-Party Blacklist
  32. -
  33. Third-Party Initial Blacklist
  34. -
  35. Third-Party Domain Blacklist
  36. -
  37. Third-Party Domain Initial Blacklist
  38. -
  39. Third-Party Regular Expression Blacklist
  40. -
  41. Third-Party Domain Regular Expression Blacklist
  42. -
  43. Regular Expression Blacklist
  44. +
  45. Main Allow List
  46. +
  47. Final Allow List
  48. +
  49. Domain Allow List
  50. +
  51. Domain Initial Allow List
  52. +
  53. Domain Final Allow List
  54. +
  55. Third-Party Allow List
  56. +
  57. Third-Party Domain Allow List
  58. +
  59. Third-Party Domain Initial Allow List
  60. +
  61. Main Block List
  62. +
  63. Initial Block List
  64. +
  65. Final Block List
  66. +
  67. Domain Block List
  68. +
  69. Domain Initial Block List
  70. +
  71. Domain Final Block List
  72. +
  73. Domain Regular Expression Block List
  74. +
  75. Third-Party Block List
  76. +
  77. Third-Party Initial Block List
  78. +
  79. Third-Party Domain Block List
  80. +
  81. Third-Party Domain Initial Block List
  82. +
  83. Third-Party Regular Expression Block List
  84. +
  85. Third-Party Domain Regular Expression Block List
  86. +
  87. Regular Expression Block List

Les listes initiales sont comparées au début de l'URL. Les listes finales sont comparées à la fin de l'URL. Les listes de domaines ne vérifient que certains domaines. @@ -73,17 +73,17 @@ Chaque élément de sous-liste comporte une ou plusieurs entrées. Dans le cas de sous-listes de domaines, la demande de ressource n'est vérifiée par rapport à l'élément que si la première entrée correspond au domaine de l'URL principale.

-

En raison des limitations de d'Android WebView et de l'accélération du traitement des demandes, Privacy Browser implémente une interprétation simplifiée de la syntaxe d'Adblock. - Cela peut parfois conduire à des faux positifs, dans lesquels les ressources sont autorisées ou bloquées d'une manière qui n'était pas prévue par l'entrée originale. - Une description plus détaillée du traitement des entrées de liste de blocage est disponible à l'adresse stoutner.com.

- -

Privacy Browser a trois listes de blocage supplémentaires. - UltraList et - UltraPrivacy - bloquent les annonces et les trackers que EasyList et EasyPrivacy ne font pas. Le troisième bloque toutes les demandes de tiers. - Une demande n'est considérée comme tierce que si le domaine de base de la demande est différent du domaine de base de l'URL. - Par exemple, si www.website.com charge une image à partir de images.website.com, - cette demande n'est pas bloquée en tant que demande tierce car elle partage le même domaine de base que website.com. - Le blocage de toutes les demandes de tiers augmente la confidentialité, mais cette liste de blocage est désactivée par défaut car elle perturbe un grand nombre de sites Web.

+

Because of limitations in Android’s WebView, and to speed up processing of requests, Privacy Browser implements a simplified interpretation of the Adblock syntax. + This can sometimes lead to false positives, where resources are allowed or blocked in ways that weren’t intended by the original entry. + A more detailed description of how the filter list entries are processed is available at stoutner.com.

+ +

Privacy Browser has three additional filter lists. + UltraList and + UltraPrivacy + filters ads and trackers that EasyList and EasyPrivacy do not. The third blocks all third-party requests. + A request is only considered third-party if the base domain of the request is different than the base domain of the URL. + For example, if www.website.com loads a picture from images.website.com, + this is not blocked as a third-party request because they both share the same base domain of website.com. + Blocking all third-party requests increases privacy, but this filter list is disabled by default because it breaks a large number of websites.

diff --git a/app/src/main/assets/it/about_licenses.html b/app/src/main/assets/it/about_licenses.html index e0f739f7..17339e6c 100644 --- a/app/src/main/assets/it/about_licenses.html +++ b/app/src/main/assets/it/about_licenses.html @@ -42,7 +42,7 @@ E' inoltre ammessa la modifica e la pubblicazione di questa traduzione, ma solamente in accordo ai termini qui riportati. Il codice sorgente è disponibile su gitweb.stoutner.com.

-

Blocklist

+

Filter Lists

EasyList e EasyPrivacy sono sotto doppia licenza con le licenze GPLv3+ e Creative Commons Attribution-ShareAlike 3.0+ Unported. Privacy Browser le incorpora utilizzando l'opzione GPLv3+.

@@ -51,7 +51,7 @@ sono rilasciate sotto la licenza Creative Commons Attribution 3.0 Unported, che è compatibile con la licenza GPLv3+. Le liste sono incluse senza modifiche in Privacy Browser.

-

E' possibile reperire maggiori informazioni sulle block list sul sito web EasyList.

+

More information about the filter lists can be found on the EasyList website.

Librerie

Privacy Browser è compilato utilizzando le Librerie AndroidX, diff --git a/app/src/main/assets/it/guide_requests.html b/app/src/main/assets/it/guide_requests.html index 0f5937c4..ee239f68 100644 --- a/app/src/main/assets/it/guide_requests.html +++ b/app/src/main/assets/it/guide_requests.html @@ -38,33 +38,33 @@ -

Privacy Browser include quattro liste di blocco comuni basate sulla Sintassi di Adblock: - EasyList, EasyPrivacy, Fanboy’s Annoyance List, e Fanboy’s Social Blocking List. - Queste blocklist sono processate da Privacy Browser nelle seguenti 22 liste secondarie, che verificano le richieste di risorse nell'ordine elencato.

+

Privacy Browser includes four common filter lists based on the Adblock syntax: + EasyList, EasyPrivacy, Fanboy’s Annoyance List, and Fanboy’s Social Blocking List. + These filter lists are processed by Privacy Browser into the following 22 sublists, which check resource requests in the order listed.

    -
  1. Whitelist principale
  2. -
  3. Whitelist finale
  4. -
  5. Whitelist per i domini
  6. -
  7. Whitelist iniziale
  8. -
  9. Whitelist finale
  10. -
  11. Whitelist di terze parti
  12. -
  13. Whitelist di terze parti per i domini
  14. -
  15. Whitelist di terze parti iniziale per i domini
  16. -
  17. Blacklist principale
  18. -
  19. Blacklist iniziale
  20. -
  21. Blacklist finale
  22. -
  23. Blacklist per i domini
  24. -
  25. Blacklist iniziale
  26. -
  27. Blacklist finale
  28. -
  29. Blacklist per le espressioni regolari
  30. -
  31. Blacklist di terze parti
  32. -
  33. Blacklist di terze parti iniziale
  34. -
  35. Blacklist di terze parti per i domini
  36. -
  37. Blacklist di terze parti iniziale per i domini
  38. -
  39. Blacklist di terze parti per le espressioni regolari
  40. -
  41. Blacklist di terze parti per le espressioni regolari per i domini
  42. -
  43. Blacklist per le espressioni regolari
  44. +
  45. Main Allow List
  46. +
  47. Final Allow List
  48. +
  49. Domain Allow List
  50. +
  51. Domain Initial Allow List
  52. +
  53. Domain Final Allow List
  54. +
  55. Third-Party Allow List
  56. +
  57. Third-Party Domain Allow List
  58. +
  59. Third-Party Domain Initial Allow List
  60. +
  61. Main Block List
  62. +
  63. Initial Block List
  64. +
  65. Final Block List
  66. +
  67. Domain Block List
  68. +
  69. Domain Initial Block List
  70. +
  71. Domain Final Block List
  72. +
  73. Domain Regular Expression Block List
  74. +
  75. Third-Party Block List
  76. +
  77. Third-Party Initial Block List
  78. +
  79. Third-Party Domain Block List
  80. +
  81. Third-Party Domain Initial Block List
  82. +
  83. Third-Party Regular Expression Block List
  84. +
  85. Third-Party Domain Regular Expression Block List
  86. +
  87. Regular Expression Block List

Le liste iniziali servono per la verifica della parte iniziale delle URL. Le liste iniziali servono per la verifica della parte finale delle URL. @@ -73,17 +73,17 @@ Ogni oggetto delle liste secondarie ha uno o più elementi. Nel caso delle liste secondarie dei domini, la richiesta di risorse è verificata solo se il primo elemento combacia con il dominio della URL principale.

-

A causa delle limitazioni della WebView di Android, e per velocizzare il processo delle richiesta, Privacy Browser implementa una versione semplificata della sintassi di Adblock. - Questo approccio potrebbe a volte portare ad avere falsi positivi, nel caso in cui le risorse siano bloccate o permesse in modi che non erano previsti dall'elemento originale. - Una descrizione più dettagliata su come sono processati gli elementi delle liste di blocco è disponibile su - stoutner.com.

- -

Privacy Browser ha tre liste di blocco aggiuntive. - UltraList e UltraPrivacy - bloccano gli annunci e i sistemi di tracciamento che EasyList e EasyPrivacy non bloccano. La terza blocca tutte le richieste di terze parti. - Una richiesta è considerata di terze parti solo se il dominio di base della richiesta è diverso dal dominio di base della URL. - Ad esempio se www.website.com carica un'immagine da images.website.com, - questa non è bloccata come richiesta di terze parti, perchè il dominio di base è lo stesso: website.com. - Il blocco di tutte le richieste di terze parti aumenta la privacy, ma questa lista di blocco è disabilitata di default perchè impedisce la corretta visualizzazione di un gran numero di siti web.

+

Because of limitations in Android’s WebView, and to speed up processing of requests, Privacy Browser implements a simplified interpretation of the Adblock syntax. + This can sometimes lead to false positives, where resources are allowed or blocked in ways that weren’t intended by the original entry. + A more detailed description of how the filter list entries are processed is available at stoutner.com.

+ +

Privacy Browser has three additional filter lists. + UltraList and + UltraPrivacy + filters ads and trackers that EasyList and EasyPrivacy do not. The third blocks all third-party requests. + A request is only considered third-party if the base domain of the request is different than the base domain of the URL. + For example, if www.website.com loads a picture from images.website.com, + this is not blocked as a third-party request because they both share the same base domain of website.com. + Blocking all third-party requests increases privacy, but this filter list is disabled by default because it breaks a large number of websites.

diff --git a/app/src/main/assets/pt-rBR/about_licenses.html b/app/src/main/assets/pt-rBR/about_licenses.html index 3e5681e5..3c09b501 100644 --- a/app/src/main/assets/pt-rBR/about_licenses.html +++ b/app/src/main/assets/pt-rBR/about_licenses.html @@ -36,7 +36,7 @@

Privacy Browser is released under the GPLv3+ license. The full text of the license is below. The source code is available from gitweb.stoutner.com.

-

Blocklists

+

Filter Lists

EasyList and EasyPrivacy are dual licensed under the GPLv3+ and the Creative Commons Attribution-ShareAlike 3.0+ Unported licenses. @@ -46,7 +46,7 @@ are released under the Creative Commons Attribution 3.0 Unported license, which is compatible with the GPLv3+. The lists are included unchanged in Privacy Browser.

-

More information about the blocklists can be found on the EasyList website.

+

More information about the filter lists can be found on the EasyList website.

Libraries

Privacy Browser is built with the AndroidX Libraries, diff --git a/app/src/main/assets/pt-rBR/guide_requests.html b/app/src/main/assets/pt-rBR/guide_requests.html index 26e7307b..510c2697 100644 --- a/app/src/main/assets/pt-rBR/guide_requests.html +++ b/app/src/main/assets/pt-rBR/guide_requests.html @@ -38,33 +38,33 @@ -

O Privacy Browser inclui quatro listas de bloqueio comuns com base na sintaxe do Adblock: - EasyList, EasyPrivacy, Fanboy’s Annoyance List e Fanboy’s Social Blocking List. - Essas listas de bloqueio são processadas pelo Privacy Browser nas seguintes 22 sublistas, que verificam as solicitações de recursos na ordem listada.

+

Privacy Browser includes four common filter lists based on the Adblock syntax: + EasyList, EasyPrivacy, Fanboy’s Annoyance List, and Fanboy’s Social Blocking List. + These filter lists are processed by Privacy Browser into the following 22 sublists, which check resource requests in the order listed.

    -
  1. Lista de permissão principal
  2. -
  3. Lista de permissões final
  4. -
  5. Lista de permissões de domínio
  6. -
  7. Lista de permissões inicial do domínio
  8. -
  9. Lista de permissões final de domínio
  10. -
  11. Lista de permissões de terceiros
  12. -
  13. Lista de permissões de domínios de terceiros
  14. -
  15. Lista de permissões iniciais de domínios de terceiros
  16. -
  17. Lista de restrições principal
  18. -
  19. Lista de restrições inicial
  20. -
  21. Lista de restrições final
  22. -
  23. Lista de restrições de domínios
  24. -
  25. Lista de restrições inicial do domínio
  26. -
  27. Lista de restrições final do domínio
  28. -
  29. Lista de restrições de expressões regulares de domínio
  30. -
  31. Lista de restrições de terceiros
  32. -
  33. Lista de restrições inicial de terceiros
  34. -
  35. Lista de restrições de domínios de terceiros
  36. -
  37. Lista de restrições inicial de domínios de terceiros
  38. -
  39. Lista de restrições de expressões regulares de terceiros
  40. -
  41. Lista de restrições de expressões regulares de domínios de terceiros
  42. -
  43. Lista de restrições de expressões regulares
  44. +
  45. Main Allow List
  46. +
  47. Final Allow List
  48. +
  49. Domain Allow List
  50. +
  51. Domain Initial Allow List
  52. +
  53. Domain Final Allow List
  54. +
  55. Third-Party Allow List
  56. +
  57. Third-Party Domain Allow List
  58. +
  59. Third-Party Domain Initial Allow List
  60. +
  61. Main Block List
  62. +
  63. Initial Block List
  64. +
  65. Final Block List
  66. +
  67. Domain Block List
  68. +
  69. Domain Initial Block List
  70. +
  71. Domain Final Block List
  72. +
  73. Domain Regular Expression Block List
  74. +
  75. Third-Party Block List
  76. +
  77. Third-Party Initial Block List
  78. +
  79. Third-Party Domain Block List
  80. +
  81. Third-Party Domain Initial Block List
  82. +
  83. Third-Party Regular Expression Block List
  84. +
  85. Third-Party Domain Regular Expression Block List
  86. +
  87. Regular Expression Block List

As listas iniciais são comparadas ao início do URL. As listas finais são comparadas ao final do URL. As listas de domínio verificam apenas em alguns domínios. @@ -72,16 +72,17 @@ Listas de expressões regulares seguem a sintaxe de expressão regular. Cada item da sublista possui uma ou mais entradas. No caso de sublistas de domínio, a solicitação de recurso só é verificada em relação ao item se a primeira entrada corresponder ao domínio do URL principal.

-

Por causa das limitações no WebView do Android e para acelerar o processamento de solicitações, o Privacy Browser implementa uma interpretação simplificada da sintaxe Adblock. - Isso às vezes pode levar a falsos positivos, em que os recursos são permitidos ou bloqueados de maneiras que não eram pretendidas pela entrada original. - Uma descrição mais detalhada de como as entradas da lista de bloqueio são processadas está disponível em stoutner.com.

- -

O Privacy Browser tem três listas de bloqueio adicionais. - UltraList e UltraPrivacy - bloqueiam anúncios e rastreadores que EasyList e EasyPrivacy não bloqueiam. O terceiro bloqueia todas as solicitações de terceiros. - Uma solicitação só é considerada de terceiros se o domínio base da solicitação for diferente do domínio base da URL. - Por exemplo, se www.website.com carregar uma imagem de images.website.com, - isso não é bloqueado como uma solicitação de terceiros porque ambos compartilham o mesmo domínio base de website.com. - Bloquear todas as solicitações de terceiros aumenta a privacidade, mas essa lista de bloqueio é desabilitada por padrão porque quebra um grande número de sites.

+

Because of limitations in Android’s WebView, and to speed up processing of requests, Privacy Browser implements a simplified interpretation of the Adblock syntax. + This can sometimes lead to false positives, where resources are allowed or blocked in ways that weren’t intended by the original entry. + A more detailed description of how the filter list entries are processed is available at stoutner.com.

+ +

Privacy Browser has three additional filter lists. + UltraList and + UltraPrivacy + filters ads and trackers that EasyList and EasyPrivacy do not. The third blocks all third-party requests. + A request is only considered third-party if the base domain of the request is different than the base domain of the URL. + For example, if www.website.com loads a picture from images.website.com, + this is not blocked as a third-party request because they both share the same base domain of website.com. + Blocking all third-party requests increases privacy, but this filter list is disabled by default because it breaks a large number of websites.

diff --git a/app/src/main/assets/ru/about_licenses.html b/app/src/main/assets/ru/about_licenses.html index f097ec0f..aed493c4 100644 --- a/app/src/main/assets/ru/about_licenses.html +++ b/app/src/main/assets/ru/about_licenses.html @@ -34,7 +34,7 @@

Privacy Browser выпущен под лицензией GPLv3+. Полный текст лицензии приведен ниже. Исходный код доступен на gitweb.stoutner.com.

-

Списки блокировки

+

Filter Lists

EasyList и EasyPrivacy лицензированы под лицензиями GPLv3+ и Creative Commons Attribution-ShareAlike 3.0+ Unported. @@ -44,7 +44,7 @@ выпущены под лицензией Creative Commons Attribution 3.0 Unported, которая совместима с GPLv3+. Списки включены без изменений в Privacy Browser.

-

Более подробную информацию о списках блокировки можно найти на веб-сайте EasyList.

+

More information about the filter lists can be found on the EasyList website.

Библиотеки

Privacy Browser создан на базе библиотек AndroidX, diff --git a/app/src/main/assets/ru/guide_requests.html b/app/src/main/assets/ru/guide_requests.html index 99b3c9fe..7533709d 100644 --- a/app/src/main/assets/ru/guide_requests.html +++ b/app/src/main/assets/ru/guide_requests.html @@ -35,33 +35,33 @@ -

Privacy Browser включает в себя четыре распространенных списка блокировки, основанных на синтаксисе Adblock: - EasyList, EasyPrivacy, Fanboy’s Annoyance List, и Fanboy’s Social Blocking List. - Эти списки блокировки обрабатываются Privacy Browser в следующих 22 подсписках, которые проверяют запросы ресурсов в указанном порядке.

+

Privacy Browser includes four common filter lists based on the Adblock syntax: + EasyList, EasyPrivacy, Fanboy’s Annoyance List, and Fanboy’s Social Blocking List. + These filter lists are processed by Privacy Browser into the following 22 sublists, which check resource requests in the order listed.

    -
  1. Основной белый список
  2. -
  3. Конец белого списка
  4. -
  5. Белый список доменов
  6. -
  7. Начало белого списка доменов
  8. -
  9. Конец белого списка доменов
  10. -
  11. Сторонний белый список
  12. -
  13. Сторонний белый список доменов
  14. -
  15. Начало стороннего белого списка доменов
  16. -
  17. Основной черный список
  18. -
  19. Начало черного списка
  20. -
  21. Конец черного списка
  22. -
  23. Черный список доменов
  24. -
  25. Начало черного списка доменов
  26. -
  27. Конец черного списка доменов
  28. -
  29. Регулярные выражения черного списка доменов
  30. -
  31. Сторонний черный список
  32. -
  33. Начало стороннего черного списка доменов
  34. -
  35. Сторонний черный список доменов
  36. -
  37. Начало стороннего черного списка доменов
  38. -
  39. Регулярные выражения стороннего черного списка
  40. -
  41. Регулярные выражения стороннего черного списка доменов
  42. -
  43. Регулярные выражения черного списка
  44. +
  45. Main Allow List
  46. +
  47. Final Allow List
  48. +
  49. Domain Allow List
  50. +
  51. Domain Initial Allow List
  52. +
  53. Domain Final Allow List
  54. +
  55. Third-Party Allow List
  56. +
  57. Third-Party Domain Allow List
  58. +
  59. Third-Party Domain Initial Allow List
  60. +
  61. Main Block List
  62. +
  63. Initial Block List
  64. +
  65. Final Block List
  66. +
  67. Domain Block List
  68. +
  69. Domain Initial Block List
  70. +
  71. Domain Final Block List
  72. +
  73. Domain Regular Expression Block List
  74. +
  75. Third-Party Block List
  76. +
  77. Third-Party Initial Block List
  78. +
  79. Third-Party Domain Block List
  80. +
  81. Third-Party Domain Initial Block List
  82. +
  83. Third-Party Regular Expression Block List
  84. +
  85. Third-Party Domain Regular Expression Block List
  86. +
  87. Regular Expression Block List

Исходные списки проверяются на начало URL-адреса. Окончательные списки проверяются на конец URL-адреса. Списки доменов проверяют только определенные домены. @@ -70,15 +70,17 @@ Каждый элемент подсписка имеет одну или несколько записей. В случае подсписков домена, запрос ресурса проверяется только в отношении элемента, если первая запись соответствует домену основного URL-адреса.

-

Из-за ограничений в Android WebView, а также для ускорения обработки запросов, в Privacy Browser реализована упрощенная интерпретация синтаксиса Adblock. - Иногда это может привести к ложным срабатываниям, когда ресурсы разрешаются или блокируются способами, которые не были предназначены для исходной записи. - Более подробное описание способа обработки записей списка блокировки доступно на stoutner.com.

+

Because of limitations in Android’s WebView, and to speed up processing of requests, Privacy Browser implements a simplified interpretation of the Adblock syntax. + This can sometimes lead to false positives, where resources are allowed or blocked in ways that weren’t intended by the original entry. + A more detailed description of how the filter list entries are processed is available at stoutner.com.

-

В Privacy Browser встроено три дополнительных списка блокировки. - UltraList и UltraPrivacy - блокируют рекламу и трекеры, которых нет в EasyList и EasyPrivacy. Третий блокирует все сторонние запросы. - Например, если www.website.com загружает изображение с сайта images.website.com, - запрос не будет считаться сторонним и не будет заблокирован, так как они оба используют один и тот же базовый домен website.com. - Блокировка всех сторонних запросов увеличивает конфиденциальность, но этот список блокировки по умолчанию отключен, поскольку он ломает большое количество веб-сайтов.

+

Privacy Browser has three additional filter lists. + UltraList and + UltraPrivacy + filters ads and trackers that EasyList and EasyPrivacy do not. The third blocks all third-party requests. + A request is only considered third-party if the base domain of the request is different than the base domain of the URL. + For example, if www.website.com loads a picture from images.website.com, + this is not blocked as a third-party request because they both share the same base domain of website.com. + Blocking all third-party requests increases privacy, but this filter list is disabled by default because it breaks a large number of websites.

diff --git a/app/src/main/assets/tr/about_licenses.html b/app/src/main/assets/tr/about_licenses.html index 5a7a9298..eca7c401 100644 --- a/app/src/main/assets/tr/about_licenses.html +++ b/app/src/main/assets/tr/about_licenses.html @@ -34,7 +34,7 @@

Privacy Browser GPLv3+ lisansı altında yayınlandı. Lisansın tam metni aşağıdadır. Kaynak kodu gitweb.stoutner.com adresinden temin edilebilir.

-

Engel Listeleri

+

Filter Lists

EasyList ve EasyPrivacy listeleri GPLv3+ ve Creative Commons Attribution-ShareAlike 3.0+ Unported lisansları altında çift lisanslıdır. @@ -44,7 +44,7 @@ GPLv3+ ile uyumlu olan Creative Commons Attribution 3.0 Unported license lisansı altında yayınlandı. Listeler Privacy Browser'a değiştirilmeden eklenmiştir.

-

Engel listeleri hakkında daha fazla bilgiyi EasyList adresinde bulabilirsiniz.

+

More information about the filter lists can be found on the EasyList website.

Kütüphaneler

Privacy Browser is built with the AndroidX Libraries, diff --git a/app/src/main/assets/tr/guide_requests.html b/app/src/main/assets/tr/guide_requests.html index f7d85e60..bb1707ee 100644 --- a/app/src/main/assets/tr/guide_requests.html +++ b/app/src/main/assets/tr/guide_requests.html @@ -35,33 +35,33 @@ -

Privacy Browser, Adblock sözdizimini (Adblock syntax) temel alan 4 yaygın engel listesini içerir: - EasyList, EasyPrivacy, Fanboy’s Annoyance List ve Fanboy’s Social Blocking List. - Bu engel listeleri, Privacy Browser tarafından, aşağıda listelenmiş olan kaynak isteklerini kontrol eden 22 alt listeye göre işlenmiştir.

+

Privacy Browser includes four common filter lists based on the Adblock syntax: + EasyList, EasyPrivacy, Fanboy’s Annoyance List, and Fanboy’s Social Blocking List. + These filter lists are processed by Privacy Browser into the following 22 sublists, which check resource requests in the order listed.

    -
  1. Ana Beyaz Listesi
  2. -
  3. Final Beyaz Listesi
  4. -
  5. Domain Beyaz Listesi
  6. -
  7. Domain Başlangıç Beyaz Listesi
  8. -
  9. Domain Final Beyaz Listesi
  10. -
  11. Üçüncü Taraf Beyaz Listesi
  12. -
  13. Üçüncü Taraf Domain Beyaz Listesi
  14. -
  15. Üçüncü Taraf Domain Başlangıç Beyaz Listesi
  16. -
  17. Ana Kara Listesi
  18. -
  19. Başlangıç Kara Listesi
  20. -
  21. Final Kara Listesi
  22. -
  23. Domain Kara Listesi
  24. -
  25. Domain Başlangıç Kara Listesi
  26. -
  27. Domain Final Kara Listesi
  28. -
  29. Domain Düzenli İfade (Regular Expression) Kara Listesi
  30. -
  31. Üçüncü Taraf Kara Listesi
  32. -
  33. Üçüncü Taraf Başlangıç Kara Listesi
  34. -
  35. Üçüncü Taraf Domain Kara Listesi
  36. -
  37. Üçüncü Taraf Domain Başlangıç Kara Listesi
  38. -
  39. Üçüncü Taraf Düzenli İfade (Regular Expression) Kara Listesi
  40. -
  41. Üçüncü Taraf Domain Düzenli İfade (Regular Expression) Kara Listesi
  42. -
  43. Düzenli İfade (Regular Expression) Kara Listesi
  44. +
  45. Main Allow List
  46. +
  47. Final Allow List
  48. +
  49. Domain Allow List
  50. +
  51. Domain Initial Allow List
  52. +
  53. Domain Final Allow List
  54. +
  55. Third-Party Allow List
  56. +
  57. Third-Party Domain Allow List
  58. +
  59. Third-Party Domain Initial Allow List
  60. +
  61. Main Block List
  62. +
  63. Initial Block List
  64. +
  65. Final Block List
  66. +
  67. Domain Block List
  68. +
  69. Domain Initial Block List
  70. +
  71. Domain Final Block List
  72. +
  73. Domain Regular Expression Block List
  74. +
  75. Third-Party Block List
  76. +
  77. Third-Party Initial Block List
  78. +
  79. Third-Party Domain Block List
  80. +
  81. Third-Party Domain Initial Block List
  82. +
  83. Third-Party Regular Expression Block List
  84. +
  85. Third-Party Domain Regular Expression Block List
  86. +
  87. Regular Expression Block List

Başlangıç listeleri, URL'nin başlangıcına göre kontrol eder. Final listeleri, URL'nin sonuna göre kontrol eder. Domain listeleri, yalnızca belli domainlere göre kontrol eder. @@ -70,17 +70,17 @@ Her alt liste öğesinin bir veya daha fazla girdisi vardır. Domain alt listeleri işe karıştığında, ilk girdi ana URL'nin domaini ile eşleşirse, kaynak isteği yalnızca öğeye göre kontrol edilir.

-

Anroid’in WebView kısıtlamaları yüzünden ve isteklerin işlenmesini hızlandırmak için Privacy Browser, Adblock sözdiziminin basitleştirilmiş bir yorumunu uygular. - Bu durum, bazen, kaynakların orijinal girdi tarafından amaçlanmayan şekillerde izin verildiği veya engellendiği yanlış pozitif (false positive) durumuna yol açabilir. - Engel listesi girdilerinin nasıl işlendiğine dair daha ayrıntılı bir açıklama stoutner.com adresinde bulunabilir.

+

Because of limitations in Android’s WebView, and to speed up processing of requests, Privacy Browser implements a simplified interpretation of the Adblock syntax. + This can sometimes lead to false positives, where resources are allowed or blocked in ways that weren’t intended by the original entry. + A more detailed description of how the filter list entries are processed is available at stoutner.com.

-

Privacy Browser'a 3 yeni engel listesi eklendi. - UltraList ve - UltraPrivacy, - EasyList ve EasyPrivacy'nin engellemediği reklamları ve izleyicileri de engeller. Üçüncü liste ise tüm üçüncü taraf istekleri engeller. - Bir istek yalnızca, isteğin temel domaini bağlantının temel domaininden farklıysa üçüncü taraf olarak kabul edilir. - Örneğin, www.website.com adresi images.website.com adresinden bir resim yüklüyorsa, - her ikisi de aynı temel domaini (website.com) paylaştığı için bu üçüncü taraf isteği olarak engellenmez. - Tüm üçüncü taraf istekleri engellemek gizliliği arttırır, fakat çok sayıda web sitesini bozduğu için bu engel listesi varsayılan olarak devre dışıdır.

+

Privacy Browser has three additional filter lists. + UltraList and + UltraPrivacy + filters ads and trackers that EasyList and EasyPrivacy do not. The third blocks all third-party requests. + A request is only considered third-party if the base domain of the request is different than the base domain of the URL. + For example, if www.website.com loads a picture from images.website.com, + this is not blocked as a third-party request because they both share the same base domain of website.com. + Blocking all third-party requests increases privacy, but this filter list is disabled by default because it breaks a large number of websites.

diff --git a/app/src/main/assets/zh-rCN/about_licenses.html b/app/src/main/assets/zh-rCN/about_licenses.html index a01356c1..c67b106a 100644 --- a/app/src/main/assets/zh-rCN/about_licenses.html +++ b/app/src/main/assets/zh-rCN/about_licenses.html @@ -36,7 +36,7 @@

Privacy Browser基于GPLv3+ license发布。 证书的完整内容在下面,源代码可以从gitweb.stoutner.com获得。

-

黑名单

+

Filter Lists

EasyList和EasyPrivacy 是GPLv3+ 和Creative Commons Attribution-ShareAlike 3.0+ Unported双重许可。Privacy Browser通过GPLv3+选项打开他们.

@@ -45,7 +45,7 @@ 基于Creative Commons Attribution 3.0 Unported license, 可以和GPLv3+共存。这些没有更改的添加到Privacy Browser。

-

黑名单的更多信息可以在以下链接中找到EasyList website.

+

More information about the filter lists can be found on the EasyList website.

库

Privacy Browser基于AndroidX Libraries, diff --git a/app/src/main/assets/zh-rCN/guide_requests.html b/app/src/main/assets/zh-rCN/guide_requests.html index b86a7d9e..1f98cd96 100644 --- a/app/src/main/assets/zh-rCN/guide_requests.html +++ b/app/src/main/assets/zh-rCN/guide_requests.html @@ -35,44 +35,49 @@ -

隐私浏览器包括四个常见的黑名单, 基于 屏蔽广告的语法: - EasyList, EasyPrivacy, Fanboy’s Annoyance List, and Fanboy’s Social Blocking List.这些黑名单由隐私浏览器分为22种,他们按顺序检查资源。

+

Privacy Browser includes four common filter lists based on the Adblock syntax: + EasyList, EasyPrivacy, Fanboy’s Annoyance List, and Fanboy’s Social Blocking List. + These filter lists are processed by Privacy Browser into the following 22 sublists, which check resource requests in the order listed.

    -
  1. 主要白名单
  2. -
  3. 最终白名单
  4. -
  5. 域白名单
  6. -
  7. 域初始白名单
  8. -
  9. 域最终白名单
  10. -
  11. 第三方白名单
  12. -
  13. 第三方域白名单
  14. -
  15. 第三方域初始白名单
  16. -
  17. 主黑名单
  18. -
  19. 初始黑名单
  20. -
  21. 最终黑名单
  22. -
  23. 域黑名单
  24. -
  25. 域初始黑名单
  26. -
  27. 域最终黑名单
  28. -
  29. 域正则表达式黑名单
  30. -
  31. 第三方黑名单
  32. -
  33. 第三方初始黑名单
  34. -
  35. 第三方域黑名单
  36. -
  37. 第三方域初始黑名单
  38. -
  39. 第三方正则表达式黑名单
  40. -
  41. 第三方域正则表达式黑名单
  42. -
  43. 正则表达式黑名单
  44. +
  45. Main Allow List
  46. +
  47. Final Allow List
  48. +
  49. Domain Allow List
  50. +
  51. Domain Initial Allow List
  52. +
  53. Domain Final Allow List
  54. +
  55. Third-Party Allow List
  56. +
  57. Third-Party Domain Allow List
  58. +
  59. Third-Party Domain Initial Allow List
  60. +
  61. Main Block List
  62. +
  63. Initial Block List
  64. +
  65. Final Block List
  66. +
  67. Domain Block List
  68. +
  69. Domain Initial Block List
  70. +
  71. Domain Final Block List
  72. +
  73. Domain Regular Expression Block List
  74. +
  75. Third-Party Block List
  76. +
  77. Third-Party Initial Block List
  78. +
  79. Third-Party Domain Block List
  80. +
  81. Third-Party Domain Initial Block List
  82. +
  83. Third-Party Regular Expression Block List
  84. +
  85. Third-Party Domain Regular Expression Block List
  86. +
  87. Regular Expression Block List

初始列表检查 URL 的开头。最终列表检查 URL 的末尾。域列表仅检查某些域。第三方列表仅在请求的根域与主 URL 的根域不同时才适用。正则表达式列表遵循正则表达式语法。 每个子列表项都有一个或多个条目。在域子列表的情况下,如果第一个条目与主 URL 的域匹配,则仅根据项目检查资源请求。

-

由于Android的WebView的限制,并且为了加快请求的处理速度,Privacy Browser 实现了对Adblock语法的简化解释。这有时会导致误报,即通过原始条目不希望的方式允许或阻止资源。 - 有关如何处理黑名单条目的更详细说明,请访问stoutner.com。

- -

Privacy Browser 有三个额外的阻止列表。 - UltraList and - UltraPrivacy - 阻止 EasyList 和 EasyPrivacy 不阻止的广告和跟踪器。第三个阻止所有第三方请求。如果请求的基本域与 URL 的基本域不同,则请求只被视为第三方。 - 例如,如果www.website.com从加载图片images.website.com,这不会作为第三方请求被阻止,因为它们共享相同的基本域website.com。阻止所有第三方请求会增加隐私,但此阻止列表默认情况下处于禁用状态,因为它会使大量网站打不开。

+

Because of limitations in Android’s WebView, and to speed up processing of requests, Privacy Browser implements a simplified interpretation of the Adblock syntax. + This can sometimes lead to false positives, where resources are allowed or blocked in ways that weren’t intended by the original entry. + A more detailed description of how the filter list entries are processed is available at stoutner.com.

+ +

Privacy Browser has three additional filter lists. + UltraList and + UltraPrivacy + filters ads and trackers that EasyList and EasyPrivacy do not. The third blocks all third-party requests. + A request is only considered third-party if the base domain of the request is different than the base domain of the URL. + For example, if www.website.com loads a picture from images.website.com, + this is not blocked as a third-party request because they both share the same base domain of website.com. + Blocking all third-party requests increases privacy, but this filter list is disabled by default because it breaks a large number of websites.

diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.kt index 72e50c4c..bd5c34e0 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/AboutActivity.kt @@ -32,12 +32,9 @@ import com.google.android.material.tabs.TabLayout import com.stoutner.privacybrowser.R import com.stoutner.privacybrowser.adapters.AboutPagerAdapter -class AboutActivity : AppCompatActivity() { - companion object { - // Define the companion object constants. These can be move to being public constants once MainWebViewActivity has been converted to Kotlin. - const val BLOCKLIST_VERSIONS = "blocklist_versions" - } +const val FILTERLIST_VERSIONS = "filterlist_versions" +class AboutActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { // Get a handle for the shared preferences. val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this) @@ -57,15 +54,14 @@ class AboutActivity : AppCompatActivity() { // Get the intent that launched the activity. val launchingIntent = intent - // Store the blocklist versions. - val blocklistVersions = launchingIntent.getStringArrayExtra(BLOCKLIST_VERSIONS)!! + // Get the filter list versions. + val filterListVersions = launchingIntent.getStringArrayExtra(FILTERLIST_VERSIONS)!! // Set the content view. - if (bottomAppBar) { + if (bottomAppBar) setContentView(R.layout.about_bottom_appbar) - } else { + else setContentView(R.layout.about_top_appbar) - } // Get handles for the views. val toolbar = findViewById(R.id.about_toolbar) @@ -82,7 +78,7 @@ class AboutActivity : AppCompatActivity() { actionBar.setDisplayHomeAsUpEnabled(true) // Initialize the about pager adapter. - val aboutPagerAdapter = AboutPagerAdapter(supportFragmentManager, applicationContext, blocklistVersions) + val aboutPagerAdapter = AboutPagerAdapter(supportFragmentManager, applicationContext, filterListVersions) // Set the view pager adapter. aboutViewPager.adapter = aboutPagerAdapter diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/ImportExportActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/ImportExportActivity.kt index cdd1bf0d..245bd598 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/ImportExportActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/ImportExportActivity.kt @@ -117,7 +117,7 @@ class ImportExportActivity : AppCompatActivity() { } } - private val browseForExportActivityResultLauncher = registerForActivityResult(ActivityResultContracts.CreateDocument("text/plain")) { fileUri: Uri? -> + private val browseForExportActivityResultLauncher = registerForActivityResult(ActivityResultContracts.CreateDocument("*/*")) { fileUri: Uri? -> // Only do something if the user didn't press back from the file picker. if (fileUri != null) { // Get the file name string from the URI. diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt index e13e8567..23436fc1 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.kt @@ -118,7 +118,7 @@ import com.google.android.material.tabs.TabLayout import com.stoutner.privacybrowser.R import com.stoutner.privacybrowser.adapters.WebViewPagerAdapter import com.stoutner.privacybrowser.coroutines.GetHostIpAddressesCoroutine -import com.stoutner.privacybrowser.coroutines.PopulateBlocklistsCoroutine +import com.stoutner.privacybrowser.coroutines.PopulateFilterListsCoroutine import com.stoutner.privacybrowser.coroutines.PrepareSaveDialogCoroutine import com.stoutner.privacybrowser.coroutines.SaveUrlCoroutine import com.stoutner.privacybrowser.coroutines.SaveWebpageImageCoroutine @@ -142,7 +142,7 @@ import com.stoutner.privacybrowser.helpers.REQUEST_BLOCKED import com.stoutner.privacybrowser.helpers.REQUEST_DEFAULT import com.stoutner.privacybrowser.helpers.REQUEST_THIRD_PARTY import com.stoutner.privacybrowser.helpers.BookmarksDatabaseHelper -import com.stoutner.privacybrowser.helpers.CheckBlocklistHelper +import com.stoutner.privacybrowser.helpers.CheckFilterListHelper import com.stoutner.privacybrowser.helpers.DomainsDatabaseHelper import com.stoutner.privacybrowser.helpers.ProxyHelper import com.stoutner.privacybrowser.helpers.SanitizeUrlHelper @@ -200,7 +200,7 @@ private const val SAVED_TAB_POSITION = "saved_tab_position" private const val TEMPORARY_MHT_FILE = "temporary_mht_file" class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBookmarkListener, CreateBookmarkFolderDialog.CreateBookmarkFolderListener, FontSizeDialog.UpdateFontSizeListener, - NavigationView.OnNavigationItemSelectedListener, OpenDialog.OpenListener, PinnedMismatchDialog.PinnedMismatchListener, PopulateBlocklistsCoroutine.PopulateBlocklistsListener, SaveDialog.SaveListener, + NavigationView.OnNavigationItemSelectedListener, OpenDialog.OpenListener, PinnedMismatchDialog.PinnedMismatchListener, PopulateFilterListsCoroutine.PopulateFilterListsListener, SaveDialog.SaveListener, UrlHistoryDialog.NavigateHistoryListener, WebViewTabFragment.NewTabListener { companion object { @@ -219,7 +219,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Declare the class variables. private lateinit var appBar: ActionBar - private lateinit var checkBlocklistHelper: CheckBlocklistHelper + private lateinit var checkFilterListHelper: CheckFilterListHelper private lateinit var bookmarksCursorAdapter: CursorAdapter private lateinit var bookmarksListView: ListView private lateinit var bookmarksDrawerPinnedImageView: ImageView @@ -245,7 +245,6 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook private lateinit var navigationRequestsMenuItem: MenuItem private lateinit var optionsAddOrEditDomainMenuItem: MenuItem private lateinit var optionsBlockAllThirdPartyRequestsMenuItem: MenuItem - private lateinit var optionsBlocklistsMenuItem: MenuItem private lateinit var optionsClearCookiesMenuItem: MenuItem private lateinit var optionsClearDataMenuItem: MenuItem private lateinit var optionsClearDomStorageMenuItem: MenuItem @@ -258,6 +257,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook private lateinit var optionsEasyPrivacyMenuItem: MenuItem private lateinit var optionsFanboysAnnoyanceListMenuItem: MenuItem private lateinit var optionsFanboysSocialBlockingListMenuItem: MenuItem + private lateinit var optionsFilterListsMenuItem: MenuItem private lateinit var optionsFontSizeMenuItem: MenuItem private lateinit var optionsPrivacyMenuItem: MenuItem private lateinit var optionsProxyCustomMenuItem: MenuItem @@ -488,7 +488,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Do not continue if the app theme is different than the OS theme. The app always initially starts in the OS theme. // If the user has specified the opposite theme should be used, the app will restart in that mode after the above `setDefaultNightMode()` code processes. However, the restart is delayed. - // If the blacklist coroutine starts below it will continue to run during the restart, which leads to indeterminate behavior, with the system often not knowing how many tabs exist. + // If the filter list coroutine starts below it will continue to run during the restart, which leads to indeterminate behavior, with the system often not knowing how many tabs exist. // See https://redmine.stoutner.com/issues/952. if ((appTheme == appThemeEntryValuesStringArray[0]) || // The system default theme is used. ((appTheme == appThemeEntryValuesStringArray[1]) && (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO)) || // The app is running in day theme as desired. @@ -570,10 +570,10 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Create the hamburger icon at the start of the AppBar. actionBarDrawerToggle = ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open_navigation_drawer, R.string.close_navigation_drawer) - // Initially disable the sliding drawers. They will be enabled once the blocklists are loaded. + // Initially disable the sliding drawers. They will be enabled once the filter lists are loaded. drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED) - // Initially hide the user interface so that only the blocklist loading screen is shown (if reloading). + // Initially hide the user interface so that only the filter list loading screen is shown (if reloading). drawerLayout.visibility = View.GONE // Initialize the WebView pager adapter. @@ -638,11 +638,11 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Register the on back pressed callback. onBackPressedDispatcher.addCallback(this, onBackPressedCallback) - // Instantiate the populate blocklists coroutine. - val populateBlocklistsCoroutine = PopulateBlocklistsCoroutine(this) + // Instantiate the populate filter lists coroutine. + val populateFilterListsCoroutine = PopulateFilterListsCoroutine(this) - // Populate the blocklists. - populateBlocklistsCoroutine.populateBlocklists(this) + // Populate the filter lists. + populateFilterListsCoroutine.populateFilterLists(this) } } @@ -957,11 +957,11 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook optionsClearCookiesMenuItem = menu.findItem(R.id.clear_cookies) optionsClearDomStorageMenuItem = menu.findItem(R.id.clear_dom_storage) optionsClearFormDataMenuItem = menu.findItem(R.id.clear_form_data) // Form data can be removed once the minimum API >= 26. - optionsBlocklistsMenuItem = menu.findItem(R.id.blocklists) optionsEasyListMenuItem = menu.findItem(R.id.easylist) optionsEasyPrivacyMenuItem = menu.findItem(R.id.easyprivacy) optionsFanboysAnnoyanceListMenuItem = menu.findItem(R.id.fanboys_annoyance_list) optionsFanboysSocialBlockingListMenuItem = menu.findItem(R.id.fanboys_social_blocking_list) + optionsFilterListsMenuItem = menu.findItem(R.id.filterlists) optionsUltraListMenuItem = menu.findItem(R.id.ultralist) optionsUltraPrivacyMenuItem = menu.findItem(R.id.ultraprivacy) optionsBlockAllThirdPartyRequestsMenuItem = menu.findItem(R.id.block_all_third_party_requests) @@ -1066,8 +1066,8 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook optionsWideViewportMenuItem.isChecked = currentWebView!!.settings.useWideViewPort optionsDisplayImagesMenuItem.isChecked = currentWebView!!.settings.loadsImagesAutomatically - // Initialize the display names for the blocklists with the number of blocked requests. - optionsBlocklistsMenuItem.title = getString(R.string.blocklists) + " - " + currentWebView!!.getRequestsCount(BLOCKED_REQUESTS) + // Initialize the display names for the filter lists with the number of blocked requests. + optionsFilterListsMenuItem.title = getString(R.string.filterlists) + " - " + currentWebView!!.getRequestsCount(BLOCKED_REQUESTS) optionsEasyListMenuItem.title = currentWebView!!.getRequestsCount(EASYLIST).toString() + " - " + getString(R.string.easylist) optionsEasyPrivacyMenuItem.title = currentWebView!!.getRequestsCount(EASYPRIVACY).toString() + " - " + getString(R.string.easyprivacy) optionsFanboysAnnoyanceListMenuItem.title = currentWebView!!.getRequestsCount(FANBOYS_ANNOYANCE_LIST).toString() + " - " + getString(R.string.fanboys_annoyance_list) @@ -2327,11 +2327,11 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Create an intent to launch the about activity. val aboutIntent = Intent(this, AboutActivity::class.java) - // Create a string array for the blocklist versions. - val blocklistVersions = arrayOf(easyList[0][0][0], easyPrivacy[0][0][0], fanboysAnnoyanceList[0][0][0], fanboysSocialList[0][0][0], ultraList[0][0][0], ultraPrivacy!![0][0][0]) + // Create a string array for the filter list versions. + val filterListVersions = arrayOf(easyList[0][0][0], easyPrivacy[0][0][0], fanboysAnnoyanceList[0][0][0], fanboysSocialList[0][0][0], ultraList[0][0][0], ultraPrivacy!![0][0][0]) - // Add the blocklist versions to the intent. - aboutIntent.putExtra(AboutActivity.BLOCKLIST_VERSIONS, blocklistVersions) + // Add the filter list versions to the intent. + aboutIntent.putExtra(FILTERLIST_VERSIONS, filterListVersions) // Make it so. startActivity(aboutIntent) @@ -3789,14 +3789,14 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook currentWebView!!.findNext(false) } - override fun finishedPopulatingBlocklists(combinedBlocklists: ArrayList>>>) { - // Store the blocklists. - easyList = combinedBlocklists[0] - easyPrivacy = combinedBlocklists[1] - fanboysAnnoyanceList = combinedBlocklists[2] - fanboysSocialList = combinedBlocklists[3] - ultraList = combinedBlocklists[4] - ultraPrivacy = combinedBlocklists[5] + override fun finishedPopulatingFilterLists(combinedFilterLists: ArrayList>>>) { + // Store the filter lists. + easyList = combinedFilterLists[0] + easyPrivacy = combinedFilterLists[1] + fanboysAnnoyanceList = combinedFilterLists[2] + fanboysSocialList = combinedFilterLists[3] + ultraList = combinedFilterLists[4] + ultraPrivacy = combinedFilterLists[5] // Check to see if the activity has been restarted with a saved state. if ((savedStateArrayList == null) || (savedStateArrayList!!.size == 0)) { // The activity has not been restarted or it was restarted on start to change the theme. @@ -4265,8 +4265,8 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Update the domains settings set. updateDomainsSettingsSet() - // Instantiate the check blocklist helper. - checkBlocklistHelper = CheckBlocklistHelper() + // Instantiate the check filter list helper. + checkFilterListHelper = CheckFilterListHelper() } @SuppressLint("ClickableViewAccessibility") @@ -4810,10 +4810,10 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook return null } - // Wait until the blocklists have been populated. When Privacy Browser is being resumed after having the process killed in the background it will try to load the URLs immediately. + // Wait until the filter lists have been populated. When Privacy Browser is being resumed after having the process killed in the background it will try to load the URLs immediately. while (ultraPrivacy == null) { try { - // Check to see if the blocklists have been populated after 100 ms. + // Check to see if the filter lists have been populated after 100 ms. Thread.sleep(100) } catch (exception: InterruptedException) { // Do nothing. @@ -4824,7 +4824,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook val emptyWebResourceResponse = WebResourceResponse("text/plain", "utf8", ByteArrayInputStream("".toByteArray())) // Initialize the variables. - var whitelistResultStringArray: Array? = null + var allowListResultStringArray: Array? = null var isThirdPartyRequest = false // Get the current URL. `.getUrl()` throws an error because operations on the WebView cannot be made from this thread. @@ -4869,7 +4869,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook nestedScrollWebView.incrementRequestsCount(BLOCKED_REQUESTS) nestedScrollWebView.incrementRequestsCount(THIRD_PARTY_REQUESTS) - // Update the titles of the blocklist menu items if the WebView is currently displayed. + // Update the titles of the filter lists menu items if the WebView is currently displayed. if (webViewDisplayed) { // Updating the UI must be run from the UI thread. runOnUiThread { @@ -4878,7 +4878,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Update the options menu if it has been populated. if (optionsMenu != null) { - optionsBlocklistsMenuItem.title = getString(R.string.blocklists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) + optionsFilterListsMenuItem.title = getString(R.string.filterlists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) optionsBlockAllThirdPartyRequestsMenuItem.title = nestedScrollWebView.getRequestsCount(THIRD_PARTY_REQUESTS).toString() + " - " + getString(R.string.block_all_third_party_requests) } @@ -4892,10 +4892,10 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Check UltraList if it is enabled. if (nestedScrollWebView.ultraListEnabled) { // Check the URL against UltraList. - val ultraListResults = checkBlocklistHelper.checkBlocklist(currentDomain, requestUrlString, isThirdPartyRequest, ultraList) + val ultraListResults = checkFilterListHelper.checkFilterList(currentDomain, requestUrlString, isThirdPartyRequest, ultraList) // Process the UltraList results. - if (ultraListResults[0] == REQUEST_BLOCKED) { // The resource request matched UltraList's blacklist. + if (ultraListResults[0] == REQUEST_BLOCKED) { // The resource request matched UltraList's block list. // Add the result to the resource requests. nestedScrollWebView.addResourceRequest(arrayOf(ultraListResults[0], ultraListResults[1], ultraListResults[2], ultraListResults[3], ultraListResults[4], ultraListResults[5])) @@ -4903,7 +4903,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook nestedScrollWebView.incrementRequestsCount(BLOCKED_REQUESTS) nestedScrollWebView.incrementRequestsCount(ULTRALIST) - // Update the titles of the blocklist menu items if the WebView is currently displayed. + // Update the titles of the filter lists menu items if the WebView is currently displayed. if (webViewDisplayed) { // Updating the UI must be run from the UI thread. runOnUiThread { @@ -4912,7 +4912,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Update the options menu if it has been populated. if (optionsMenu != null) { - optionsBlocklistsMenuItem.title = getString(R.string.blocklists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) + optionsFilterListsMenuItem.title = getString(R.string.filterlists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) optionsUltraListMenuItem.title = nestedScrollWebView.getRequestsCount(ULTRALIST).toString() + " - " + getString(R.string.ultralist) } } @@ -4920,11 +4920,11 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // The resource request was blocked. Return an empty web resource response. return emptyWebResourceResponse - } else if (ultraListResults[0] == REQUEST_ALLOWED) { // The resource request matched UltraList's whitelist. - // Add a whitelist entry to the resource requests array. + } else if (ultraListResults[0] == REQUEST_ALLOWED) { // The resource request matched UltraList's allow list. + // Add an allow list entry to the resource requests array. nestedScrollWebView.addResourceRequest(arrayOf(ultraListResults[0], ultraListResults[1], ultraListResults[2], ultraListResults[3], ultraListResults[4], ultraListResults[5])) - // The resource request has been allowed by UltraPrivacy. `return null` loads the requested resource. + // The resource request has been allowed by UltraList. `return null` loads the requested resource. return null } } @@ -4932,10 +4932,10 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Check UltraPrivacy if it is enabled. if (nestedScrollWebView.ultraPrivacyEnabled) { // Check the URL against UltraPrivacy. - val ultraPrivacyResults = checkBlocklistHelper.checkBlocklist(currentDomain, requestUrlString, isThirdPartyRequest, ultraPrivacy!!) + val ultraPrivacyResults = checkFilterListHelper.checkFilterList(currentDomain, requestUrlString, isThirdPartyRequest, ultraPrivacy!!) // Process the UltraPrivacy results. - if (ultraPrivacyResults[0] == REQUEST_BLOCKED) { // The resource request matched UltraPrivacy's blacklist. + if (ultraPrivacyResults[0] == REQUEST_BLOCKED) { // The resource request matched UltraPrivacy's block list. // Add the result to the resource requests. nestedScrollWebView.addResourceRequest(arrayOf(ultraPrivacyResults[0], ultraPrivacyResults[1], ultraPrivacyResults[2], ultraPrivacyResults[3], ultraPrivacyResults[4], ultraPrivacyResults[5])) @@ -4944,7 +4944,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook nestedScrollWebView.incrementRequestsCount(BLOCKED_REQUESTS) nestedScrollWebView.incrementRequestsCount(ULTRAPRIVACY) - // Update the titles of the blocklist menu items if the WebView is currently displayed. + // Update the titles of the filter lists menu items if the WebView is currently displayed. if (webViewDisplayed) { // Updating the UI must be run from the UI thread. runOnUiThread { @@ -4953,7 +4953,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Update the options menu if it has been populated. if (optionsMenu != null) { - optionsBlocklistsMenuItem.title = getString(R.string.blocklists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) + optionsFilterListsMenuItem.title = getString(R.string.filterlists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) optionsUltraPrivacyMenuItem.title = nestedScrollWebView.getRequestsCount(ULTRAPRIVACY).toString() + " - " + getString(R.string.ultraprivacy) } } @@ -4961,8 +4961,8 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // The resource request was blocked. Return an empty web resource response. return emptyWebResourceResponse - } else if (ultraPrivacyResults[0] == REQUEST_ALLOWED) { // The resource request matched UltraPrivacy's whitelist. - // Add a whitelist entry to the resource requests array. + } else if (ultraPrivacyResults[0] == REQUEST_ALLOWED) { // The resource request matched UltraPrivacy's allow list. + // Add an allow list entry to the resource requests array. nestedScrollWebView.addResourceRequest(arrayOf(ultraPrivacyResults[0], ultraPrivacyResults[1], ultraPrivacyResults[2], ultraPrivacyResults[3], ultraPrivacyResults[4], ultraPrivacyResults[5])) @@ -4974,10 +4974,10 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Check EasyList if it is enabled. if (nestedScrollWebView.easyListEnabled) { // Check the URL against EasyList. - val easyListResults = checkBlocklistHelper.checkBlocklist(currentDomain, requestUrlString, isThirdPartyRequest, easyList) + val easyListResults = checkFilterListHelper.checkFilterList(currentDomain, requestUrlString, isThirdPartyRequest, easyList) // Process the EasyList results. - if (easyListResults[0] == REQUEST_BLOCKED) { // The resource request matched EasyList's blacklist. + if (easyListResults[0] == REQUEST_BLOCKED) { // The resource request matched EasyList's block list. // Add the result to the resource requests. nestedScrollWebView.addResourceRequest(arrayOf(easyListResults[0], easyListResults[1], easyListResults[2], easyListResults[3], easyListResults[4], easyListResults[5])) @@ -4985,7 +4985,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook nestedScrollWebView.incrementRequestsCount(BLOCKED_REQUESTS) nestedScrollWebView.incrementRequestsCount(EASYLIST) - // Update the titles of the blocklist menu items if the WebView is currently displayed. + // Update the titles of the filter lists menu items if the WebView is currently displayed. if (webViewDisplayed) { // Updating the UI must be run from the UI thread. runOnUiThread { @@ -4994,7 +4994,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Update the options menu if it has been populated. if (optionsMenu != null) { - optionsBlocklistsMenuItem.title = getString(R.string.blocklists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) + optionsFilterListsMenuItem.title = getString(R.string.filterlists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) optionsEasyListMenuItem.title = nestedScrollWebView.getRequestsCount(EASYLIST).toString() + " - " + getString(R.string.easylist) } } @@ -5002,19 +5002,19 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // The resource request was blocked. Return an empty web resource response. return emptyWebResourceResponse - } else if (easyListResults[0] == REQUEST_ALLOWED) { // The resource request matched EasyList's whitelist. - // Update the whitelist result string array tracker. - whitelistResultStringArray = arrayOf(easyListResults[0], easyListResults[1], easyListResults[2], easyListResults[3], easyListResults[4], easyListResults[5]) + } else if (easyListResults[0] == REQUEST_ALLOWED) { // The resource request matched EasyList's allow list. + // Update the allow list result string array tracker. + allowListResultStringArray = arrayOf(easyListResults[0], easyListResults[1], easyListResults[2], easyListResults[3], easyListResults[4], easyListResults[5]) } } // Check EasyPrivacy if it is enabled. if (nestedScrollWebView.easyPrivacyEnabled) { // Check the URL against EasyPrivacy. - val easyPrivacyResults = checkBlocklistHelper.checkBlocklist(currentDomain, requestUrlString, isThirdPartyRequest, easyPrivacy) + val easyPrivacyResults = checkFilterListHelper.checkFilterList(currentDomain, requestUrlString, isThirdPartyRequest, easyPrivacy) // Process the EasyPrivacy results. - if (easyPrivacyResults[0] == REQUEST_BLOCKED) { // The resource request matched EasyPrivacy's blacklist. + if (easyPrivacyResults[0] == REQUEST_BLOCKED) { // The resource request matched EasyPrivacy's block list. // Add the result to the resource requests. nestedScrollWebView.addResourceRequest(arrayOf(easyPrivacyResults[0], easyPrivacyResults[1], easyPrivacyResults[2], easyPrivacyResults[3], easyPrivacyResults[4], easyPrivacyResults[5])) @@ -5022,7 +5022,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook nestedScrollWebView.incrementRequestsCount(BLOCKED_REQUESTS) nestedScrollWebView.incrementRequestsCount(EASYPRIVACY) - // Update the titles of the blocklist menu items if the WebView is currently displayed. + // Update the titles of the filter lists menu items if the WebView is currently displayed. if (webViewDisplayed) { // Updating the UI must be run from the UI thread. runOnUiThread { @@ -5031,7 +5031,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Update the options menu if it has been populated. if (optionsMenu != null) { - optionsBlocklistsMenuItem.title = getString(R.string.blocklists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) + optionsFilterListsMenuItem.title = getString(R.string.filterlists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) optionsEasyPrivacyMenuItem.title = nestedScrollWebView.getRequestsCount(EASYPRIVACY).toString() + " - " + getString(R.string.easyprivacy) } } @@ -5039,19 +5039,19 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // The resource request was blocked. Return an empty web resource response. return emptyWebResourceResponse - } else if (easyPrivacyResults[0] == REQUEST_ALLOWED) { // The resource request matched EasyPrivacy's whitelist. - // Update the whitelist result string array tracker. - whitelistResultStringArray = arrayOf(easyPrivacyResults[0], easyPrivacyResults[1], easyPrivacyResults[2], easyPrivacyResults[3], easyPrivacyResults[4], easyPrivacyResults[5]) + } else if (easyPrivacyResults[0] == REQUEST_ALLOWED) { // The resource request matched EasyPrivacy's allow list. + // Update the allow list result string array tracker. + allowListResultStringArray = arrayOf(easyPrivacyResults[0], easyPrivacyResults[1], easyPrivacyResults[2], easyPrivacyResults[3], easyPrivacyResults[4], easyPrivacyResults[5]) } } // Check Fanboy’s Annoyance List if it is enabled. if (nestedScrollWebView.fanboysAnnoyanceListEnabled) { // Check the URL against Fanboy's Annoyance List. - val fanboysAnnoyanceListResults = checkBlocklistHelper.checkBlocklist(currentDomain, requestUrlString, isThirdPartyRequest, fanboysAnnoyanceList) + val fanboysAnnoyanceListResults = checkFilterListHelper.checkFilterList(currentDomain, requestUrlString, isThirdPartyRequest, fanboysAnnoyanceList) // Process the Fanboy's Annoyance List results. - if (fanboysAnnoyanceListResults[0] == REQUEST_BLOCKED) { // The resource request matched Fanboy's Annoyance List's blacklist. + if (fanboysAnnoyanceListResults[0] == REQUEST_BLOCKED) { // The resource request matched Fanboy's Annoyance List's block list. // Add the result to the resource requests. nestedScrollWebView.addResourceRequest(arrayOf(fanboysAnnoyanceListResults[0], fanboysAnnoyanceListResults[1], fanboysAnnoyanceListResults[2], fanboysAnnoyanceListResults[3], fanboysAnnoyanceListResults[4], fanboysAnnoyanceListResults[5])) @@ -5060,7 +5060,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook nestedScrollWebView.incrementRequestsCount(BLOCKED_REQUESTS) nestedScrollWebView.incrementRequestsCount(FANBOYS_ANNOYANCE_LIST) - // Update the titles of the blocklist menu items if the WebView is currently displayed. + // Update the titles of the filter lists menu items if the WebView is currently displayed. if (webViewDisplayed) { // Updating the UI must be run from the UI thread. runOnUiThread { @@ -5069,7 +5069,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Update the options menu if it has been populated. if (optionsMenu != null) { - optionsBlocklistsMenuItem.title = getString(R.string.blocklists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) + optionsFilterListsMenuItem.title = getString(R.string.filterlists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) optionsFanboysAnnoyanceListMenuItem.title = nestedScrollWebView.getRequestsCount(FANBOYS_ANNOYANCE_LIST).toString() + " - " + getString(R.string.fanboys_annoyance_list) } } @@ -5077,17 +5077,17 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // The resource request was blocked. Return an empty web resource response. return emptyWebResourceResponse - } else if (fanboysAnnoyanceListResults[0] == REQUEST_ALLOWED) { // The resource request matched Fanboy's Annoyance List's whitelist. - // Update the whitelist result string array tracker. - whitelistResultStringArray = arrayOf(fanboysAnnoyanceListResults[0], fanboysAnnoyanceListResults[1], fanboysAnnoyanceListResults[2], fanboysAnnoyanceListResults[3], + } else if (fanboysAnnoyanceListResults[0] == REQUEST_ALLOWED) { // The resource request matched Fanboy's Annoyance List's allow list. + // Update the allow list result string array tracker. + allowListResultStringArray = arrayOf(fanboysAnnoyanceListResults[0], fanboysAnnoyanceListResults[1], fanboysAnnoyanceListResults[2], fanboysAnnoyanceListResults[3], fanboysAnnoyanceListResults[4], fanboysAnnoyanceListResults[5]) } } else if (nestedScrollWebView.fanboysSocialBlockingListEnabled) { // Only check Fanboy’s Social Blocking List if Fanboy’s Annoyance List is disabled. // Check the URL against Fanboy's Annoyance List. - val fanboysSocialListResults = checkBlocklistHelper.checkBlocklist(currentDomain, requestUrlString, isThirdPartyRequest, fanboysSocialList) + val fanboysSocialListResults = checkFilterListHelper.checkFilterList(currentDomain, requestUrlString, isThirdPartyRequest, fanboysSocialList) // Process the Fanboy's Social Blocking List results. - if (fanboysSocialListResults[0] == REQUEST_BLOCKED) { // The resource request matched Fanboy's Social Blocking List's blacklist. + if (fanboysSocialListResults[0] == REQUEST_BLOCKED) { // The resource request matched Fanboy's Social Blocking List's block list. // Add the result to the resource requests. nestedScrollWebView.addResourceRequest(arrayOf(fanboysSocialListResults[0], fanboysSocialListResults[1], fanboysSocialListResults[2], fanboysSocialListResults[3], fanboysSocialListResults[4], fanboysSocialListResults[5])) @@ -5096,7 +5096,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook nestedScrollWebView.incrementRequestsCount(BLOCKED_REQUESTS) nestedScrollWebView.incrementRequestsCount(FANBOYS_SOCIAL_BLOCKING_LIST) - // Update the titles of the blocklist menu items if the WebView is currently displayed. + // Update the titles of the filter lists menu items if the WebView is currently displayed. if (webViewDisplayed) { // Updating the UI must be run from the UI thread. runOnUiThread { @@ -5105,7 +5105,7 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // Update the options menu if it has been populated. if (optionsMenu != null) { - optionsBlocklistsMenuItem.title = getString(R.string.blocklists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) + optionsFilterListsMenuItem.title = getString(R.string.filterlists) + " - " + nestedScrollWebView.getRequestsCount(BLOCKED_REQUESTS) optionsFanboysSocialBlockingListMenuItem.title = nestedScrollWebView.getRequestsCount(FANBOYS_SOCIAL_BLOCKING_LIST).toString() + " - " + getString(R.string.fanboys_social_blocking_list) } @@ -5114,17 +5114,17 @@ class MainWebViewActivity : AppCompatActivity(), CreateBookmarkDialog.CreateBook // The resource request was blocked. Return an empty web resource response. return emptyWebResourceResponse - } else if (fanboysSocialListResults[0] == REQUEST_ALLOWED) { // The resource request matched Fanboy's Social Blocking List's whitelist. - // Update the whitelist result string array tracker. - whitelistResultStringArray = arrayOf(fanboysSocialListResults[0], fanboysSocialListResults[1], fanboysSocialListResults[2], fanboysSocialListResults[3], fanboysSocialListResults[4], + } else if (fanboysSocialListResults[0] == REQUEST_ALLOWED) { // The resource request matched Fanboy's Social Blocking List's allow list. + // Update the allow list result string array tracker. + allowListResultStringArray = arrayOf(fanboysSocialListResults[0], fanboysSocialListResults[1], fanboysSocialListResults[2], fanboysSocialListResults[3], fanboysSocialListResults[4], fanboysSocialListResults[5]) } } // Add the request to the log because it hasn't been processed by any of the previous checks. - if (whitelistResultStringArray != null) { // The request was processed by a whitelist. - nestedScrollWebView.addResourceRequest(whitelistResultStringArray) - } else { // The request didn't match any blocklist entry. Log it as a default request. + if (allowListResultStringArray != null) { // The request was processed by an allow list. + nestedScrollWebView.addResourceRequest(allowListResultStringArray) + } else { // The request didn't match any filter list entry. Log it as a default request. nestedScrollWebView.addResourceRequest(arrayOf(REQUEST_DEFAULT, requestUrlString)) } diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.kt b/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.kt index dea186fc..11efe094 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/RequestsActivity.kt @@ -82,7 +82,7 @@ class RequestsActivity : AppCompatActivity(), ViewRequestListener { // Get the launching intent val intent = intent - // Get the status of the third-party blocklist. + // Get the status of the third-party filter list. val blockAllThirdPartyRequests = intent.getBooleanExtra(BLOCK_ALL_THIRD_PARTY_REQUESTS, false) // Set the content view. diff --git a/app/src/main/java/com/stoutner/privacybrowser/adapters/AboutPagerAdapter.kt b/app/src/main/java/com/stoutner/privacybrowser/adapters/AboutPagerAdapter.kt index ff00a284..e893c70d 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/adapters/AboutPagerAdapter.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/adapters/AboutPagerAdapter.kt @@ -31,7 +31,7 @@ import com.stoutner.privacybrowser.fragments.AboutWebViewFragment import java.util.LinkedList -class AboutPagerAdapter(fragmentManager: FragmentManager, private val context: Context, private val blocklistVersions: Array) : +class AboutPagerAdapter(fragmentManager: FragmentManager, private val context: Context, private val filterListVersions: Array) : FragmentPagerAdapter(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) { // Define the class variables. @@ -48,7 +48,7 @@ class AboutPagerAdapter(fragmentManager: FragmentManager, private val context: C // Create the tab fragment and add it to the list. if (tabNumber == 0) { // Add the version tab to the list. - aboutFragmentList.add(AboutVersionFragment.createTab(blocklistVersions)) + aboutFragmentList.add(AboutVersionFragment.createTab(filterListVersions)) } else { // Add the WebView tab to the list. aboutFragmentList.add(AboutWebViewFragment.createTab(tabNumber)) diff --git a/app/src/main/java/com/stoutner/privacybrowser/coroutines/PopulateBlocklistsCoroutine.kt b/app/src/main/java/com/stoutner/privacybrowser/coroutines/PopulateFilterListsCoroutine.kt similarity index 51% rename from app/src/main/java/com/stoutner/privacybrowser/coroutines/PopulateBlocklistsCoroutine.kt rename to app/src/main/java/com/stoutner/privacybrowser/coroutines/PopulateFilterListsCoroutine.kt index 32a4b3b3..1ee2dbf0 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/coroutines/PopulateBlocklistsCoroutine.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/coroutines/PopulateFilterListsCoroutine.kt @@ -27,7 +27,7 @@ import android.widget.TextView import androidx.drawerlayout.widget.DrawerLayout import com.stoutner.privacybrowser.R -import com.stoutner.privacybrowser.helpers.ParseBlocklistHelper +import com.stoutner.privacybrowser.helpers.ParseFilterListHelper import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -36,113 +36,111 @@ import kotlinx.coroutines.withContext import java.util.ArrayList -class PopulateBlocklistsCoroutine(context: Context) { +class PopulateFilterListsCoroutine(context: Context) { // The public interface is used to send information back to the parent activity. - interface PopulateBlocklistsListener { - fun finishedPopulatingBlocklists(combinedBlocklists: ArrayList>>>) + interface PopulateFilterListsListener { + fun finishedPopulatingFilterLists(combinedFilterLists: ArrayList>>>) } - // Define a populate blocklists listener. - private val populateBlocklistsListener: PopulateBlocklistsListener - // Define the class variables. private val context: Context + private val populateFilterListsListener: PopulateFilterListsListener // The public constructor. init { - // Get a handle for the populate blocklists listener from the launching activity. - populateBlocklistsListener = context as PopulateBlocklistsListener + // Get a handle for the populate filter lists listener from the launching activity. + populateFilterListsListener = context as PopulateFilterListsListener // Store the context. this.context = context } - fun populateBlocklists(activity: Activity) { - // Use a coroutine to populate the blocklists. + fun populateFilterLists(activity: Activity) { + // Use a coroutine to populate the filter lists. CoroutineScope(Dispatchers.Main).launch { // Get handles for the views. val drawerLayout = activity.findViewById(R.id.drawerlayout) - val loadingBlocklistsRelativeLayout = activity.findViewById(R.id.loading_blocklists_relativelayout) - val loadingBlocklistTextView = activity.findViewById(R.id.loading_blocklist_textview) + val loadingFilterListsRelativeLayout = activity.findViewById(R.id.loading_filterlists_relativelayout) + val loadingFilterListTextView = activity.findViewById(R.id.loading_filterlist_textview) - // Show the loading blocklists screen. - loadingBlocklistsRelativeLayout.visibility = View.VISIBLE + // Show the loading filter lists screen. + loadingFilterListsRelativeLayout.visibility = View.VISIBLE - // Instantiate the blocklist helper. - val parseBlocklistHelper = ParseBlocklistHelper() + // Instantiate the filter list helper. + val parseFilterListHelper = ParseFilterListHelper() // Create a combined array list. - val combinedBlocklists = ArrayList>>>() + val combinedFilterLists = ArrayList>>>() // Advertise the loading of EasyList. - loadingBlocklistTextView.text = context.getString(R.string.loading_easylist) + loadingFilterListTextView.text = context.getString(R.string.loading_easylist) - // Populate the blocklists on the IO thread. + // Populate the filter lists on the IO thread. withContext(Dispatchers.IO) { // Populate EasyList. - val easyList = parseBlocklistHelper.parseBlocklist(context.assets, "blocklists/easylist.txt") + val easyList = parseFilterListHelper.parseFilterList(context.assets, "filterlists/easylist.txt") // Advertise the loading of EasyPrivacy. withContext(Dispatchers.Main) { - loadingBlocklistTextView.text = context.getString(R.string.loading_easyprivacy) + loadingFilterListTextView.text = context.getString(R.string.loading_easyprivacy) } // Populate EasyPrivacy. - val easyPrivacy = parseBlocklistHelper.parseBlocklist(context.assets, "blocklists/easyprivacy.txt") + val easyPrivacy = parseFilterListHelper.parseFilterList(context.assets, "filterlists/easyprivacy.txt") // Advertise the loading of Fanboy's Annoyance List. withContext(Dispatchers.Main) { - loadingBlocklistTextView.text = context.getString(R.string.loading_fanboys_annoyance_list) + loadingFilterListTextView.text = context.getString(R.string.loading_fanboys_annoyance_list) } // Populate Fanboy's Annoyance List. - val fanboysAnnoyanceList = parseBlocklistHelper.parseBlocklist(context.assets, "blocklists/fanboy-annoyance.txt") + val fanboysAnnoyanceList = parseFilterListHelper.parseFilterList(context.assets, "filterlists/fanboy-annoyance.txt") // Advertise the loading of Fanboy's social blocking list. withContext(Dispatchers.Main) { - loadingBlocklistTextView.text = context.getString(R.string.loading_fanboys_social_blocking_list) + loadingFilterListTextView.text = context.getString(R.string.loading_fanboys_social_blocking_list) } // Populate Fanboy's Social Blocking List. - val fanboysSocialList = parseBlocklistHelper.parseBlocklist(context.assets, "blocklists/fanboy-social.txt") + val fanboysSocialList = parseFilterListHelper.parseFilterList(context.assets, "filterlists/fanboy-social.txt") // Advertise the loading of UltraList withContext(Dispatchers.Main) { - loadingBlocklistTextView.text = context.getString(R.string.loading_ultralist) + loadingFilterListTextView.text = context.getString(R.string.loading_ultralist) } // Populate UltraList. - val ultraList = parseBlocklistHelper.parseBlocklist(context.assets, "blocklists/ultralist.txt") + val ultraList = parseFilterListHelper.parseFilterList(context.assets, "filterlists/ultralist.txt") // Advertise the loading of UltraPrivacy. withContext(Dispatchers.Main) { - loadingBlocklistTextView.text = context.getString(R.string.loading_ultraprivacy) + loadingFilterListTextView.text = context.getString(R.string.loading_ultraprivacy) } // Populate UltraPrivacy. - val ultraPrivacy = parseBlocklistHelper.parseBlocklist(context.assets, "blocklists/ultraprivacy.txt") + val ultraPrivacy = parseFilterListHelper.parseFilterList(context.assets, "filterlists/ultraprivacy.txt") // Populate the combined array list. - combinedBlocklists.add(easyList) - combinedBlocklists.add(easyPrivacy) - combinedBlocklists.add(fanboysAnnoyanceList) - combinedBlocklists.add(fanboysSocialList) - combinedBlocklists.add(ultraList) - combinedBlocklists.add(ultraPrivacy) + combinedFilterLists.add(easyList) + combinedFilterLists.add(easyPrivacy) + combinedFilterLists.add(fanboysAnnoyanceList) + combinedFilterLists.add(fanboysSocialList) + combinedFilterLists.add(ultraList) + combinedFilterLists.add(ultraPrivacy) // Update the UI. withContext(Dispatchers.Main) { // Show the drawer layout. drawerLayout.visibility = View.VISIBLE - // Hide the loading blocklists screen. - loadingBlocklistsRelativeLayout.visibility = View.GONE + // Hide the loading filter lists screen. + loadingFilterListsRelativeLayout.visibility = View.GONE // Enable the sliding drawers. drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED) // Add the first tab. - populateBlocklistsListener.finishedPopulatingBlocklists(combinedBlocklists) + populateFilterListsListener.finishedPopulatingFilterLists(combinedFilterLists) } } } diff --git a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.kt b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.kt index 94ee8202..1c8648ea 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/dialogs/ViewRequestDialog.kt @@ -33,14 +33,14 @@ import androidx.fragment.app.DialogFragment import androidx.preference.PreferenceManager import com.stoutner.privacybrowser.R -import com.stoutner.privacybrowser.helpers.DOMAIN_BLACKLIST -import com.stoutner.privacybrowser.helpers.DOMAIN_FINAL_BLACKLIST -import com.stoutner.privacybrowser.helpers.DOMAIN_FINAL_WHITELIST -import com.stoutner.privacybrowser.helpers.DOMAIN_INITIAL_BLACKLIST -import com.stoutner.privacybrowser.helpers.DOMAIN_INITIAL_WHITELIST -import com.stoutner.privacybrowser.helpers.DOMAIN_REGULAR_EXPRESSION_BLACKLIST -import com.stoutner.privacybrowser.helpers.DOMAIN_WHITELIST -import com.stoutner.privacybrowser.helpers.INITIAL_BLACKLIST +import com.stoutner.privacybrowser.helpers.DOMAIN_ALLOWLIST +import com.stoutner.privacybrowser.helpers.DOMAIN_BLOCKLIST +import com.stoutner.privacybrowser.helpers.DOMAIN_FINAL_ALLOWLIST +import com.stoutner.privacybrowser.helpers.DOMAIN_FINAL_BLOCKLIST +import com.stoutner.privacybrowser.helpers.DOMAIN_INITIAL_ALLOWLIST +import com.stoutner.privacybrowser.helpers.DOMAIN_INITIAL_BLOCKLIST +import com.stoutner.privacybrowser.helpers.DOMAIN_REGULAR_EXPRESSION_BLOCKLIST +import com.stoutner.privacybrowser.helpers.INITIAL_BLOCKLIST import com.stoutner.privacybrowser.helpers.REQUEST_ALLOWED import com.stoutner.privacybrowser.helpers.REQUEST_BLOCKED import com.stoutner.privacybrowser.helpers.REQUEST_BLOCKLIST @@ -48,23 +48,23 @@ import com.stoutner.privacybrowser.helpers.REQUEST_BLOCKLIST_ENTRIES import com.stoutner.privacybrowser.helpers.REQUEST_BLOCKLIST_ORIGINAL_ENTRY import com.stoutner.privacybrowser.helpers.REQUEST_DEFAULT import com.stoutner.privacybrowser.helpers.REQUEST_DISPOSITION -import com.stoutner.privacybrowser.helpers.FINAL_BLACKLIST -import com.stoutner.privacybrowser.helpers.FINAL_WHITELIST -import com.stoutner.privacybrowser.helpers.MAIN_BLACKLIST -import com.stoutner.privacybrowser.helpers.MAIN_WHITELIST -import com.stoutner.privacybrowser.helpers.REGULAR_EXPRESSION_BLACKLIST +import com.stoutner.privacybrowser.helpers.FINAL_ALLOWLIST +import com.stoutner.privacybrowser.helpers.FINAL_BLOCKLIST +import com.stoutner.privacybrowser.helpers.MAIN_ALLOWLIST +import com.stoutner.privacybrowser.helpers.MAIN_BLOCKLIST +import com.stoutner.privacybrowser.helpers.REGULAR_EXPRESSION_BLOCKLIST import com.stoutner.privacybrowser.helpers.REQUEST_SUBLIST import com.stoutner.privacybrowser.helpers.REQUEST_THIRD_PARTY import com.stoutner.privacybrowser.helpers.REQUEST_URL -import com.stoutner.privacybrowser.helpers.THIRD_PARTY_BLACKLIST -import com.stoutner.privacybrowser.helpers.THIRD_PARTY_DOMAIN_BLACKLIST -import com.stoutner.privacybrowser.helpers.THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST -import com.stoutner.privacybrowser.helpers.THIRD_PARTY_DOMAIN_INITIAL_WHITELIST -import com.stoutner.privacybrowser.helpers.THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST -import com.stoutner.privacybrowser.helpers.THIRD_PARTY_DOMAIN_WHITELIST -import com.stoutner.privacybrowser.helpers.THIRD_PARTY_INITIAL_BLACKLIST -import com.stoutner.privacybrowser.helpers.THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST -import com.stoutner.privacybrowser.helpers.THIRD_PARTY_WHITELIST +import com.stoutner.privacybrowser.helpers.THIRD_PARTY_BLOCKLIST +import com.stoutner.privacybrowser.helpers.THIRD_PARTY_DOMAIN_BLOCKLIST +import com.stoutner.privacybrowser.helpers.THIRD_PARTY_DOMAIN_INITIAL_ALLOWLIST +import com.stoutner.privacybrowser.helpers.THIRD_PARTY_DOMAIN_INITIAL_BLOCKLIST +import com.stoutner.privacybrowser.helpers.THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLOCKLIST +import com.stoutner.privacybrowser.helpers.THIRD_PARTY_DOMAIN_ALLOWLIST +import com.stoutner.privacybrowser.helpers.THIRD_PARTY_INITIAL_BLOCKLIST +import com.stoutner.privacybrowser.helpers.THIRD_PARTY_ALLOWLIST +import com.stoutner.privacybrowser.helpers.THIRD_PARTY_REGULAR_EXPRESSION_BLOCKLIST // Define the class constants. private const val ID = "id" @@ -167,14 +167,14 @@ class ViewRequestDialog : DialogFragment() { // Get handles for the dialog views. val requestDisposition = alertDialog.findViewById(R.id.request_disposition)!! val requestUrl = alertDialog.findViewById(R.id.request_url)!! - val requestBlockListLabel = alertDialog.findViewById(R.id.request_blocklist_label)!! - val requestBlockList = alertDialog.findViewById(R.id.request_blocklist)!! + val requestFilterListLabel = alertDialog.findViewById(R.id.request_filterlist_label)!! + val requestFilterList = alertDialog.findViewById(R.id.request_filterlist)!! val requestSubListLabel = alertDialog.findViewById(R.id.request_sublist_label)!! val requestSubList = alertDialog.findViewById(R.id.request_sublist)!! - val requestBlockListEntriesLabel = alertDialog.findViewById(R.id.request_blocklist_entries_label)!! - val requestBlockListEntries = alertDialog.findViewById(R.id.request_blocklist_entries)!! - val requestBlockListOriginalEntryLabel = alertDialog.findViewById(R.id.request_blocklist_original_entry_label)!! - val requestBlockListOriginalEntry = alertDialog.findViewById(R.id.request_blocklist_original_entry)!! + val requestFilterListEntriesLabel = alertDialog.findViewById(R.id.request_filterlist_entries_label)!! + val requestFilterListEntries = alertDialog.findViewById(R.id.request_filterlist_entries)!! + val requestFilterListOriginalEntryLabel = alertDialog.findViewById(R.id.request_filterlist_original_entry_label)!! + val requestFilterListOriginalEntry = alertDialog.findViewById(R.id.request_filterlist_original_entry)!! val previousButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE) val nextButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE) @@ -225,42 +225,42 @@ class ViewRequestDialog : DialogFragment() { // Modify the dialog based on the request action. if (requestDetails.size == 2) { // A default request. // Hide the unused views. - requestBlockListLabel.visibility = View.GONE - requestBlockList.visibility = View.GONE + requestFilterListLabel.visibility = View.GONE + requestFilterList.visibility = View.GONE requestSubListLabel.visibility = View.GONE requestSubList.visibility = View.GONE - requestBlockListEntriesLabel.visibility = View.GONE - requestBlockListEntries.visibility = View.GONE - requestBlockListOriginalEntryLabel.visibility = View.GONE - requestBlockListOriginalEntry.visibility = View.GONE + requestFilterListEntriesLabel.visibility = View.GONE + requestFilterListEntries.visibility = View.GONE + requestFilterListOriginalEntryLabel.visibility = View.GONE + requestFilterListOriginalEntry.visibility = View.GONE } else { // A blocked or allowed request. // Set the text on the text views. - requestBlockList.text = requestDetails[REQUEST_BLOCKLIST] - requestBlockListEntries.text = requestDetails[REQUEST_BLOCKLIST_ENTRIES] - requestBlockListOriginalEntry.text = requestDetails[REQUEST_BLOCKLIST_ORIGINAL_ENTRY] + requestFilterList.text = requestDetails[REQUEST_BLOCKLIST] + requestFilterListEntries.text = requestDetails[REQUEST_BLOCKLIST_ENTRIES] + requestFilterListOriginalEntry.text = requestDetails[REQUEST_BLOCKLIST_ORIGINAL_ENTRY] when (requestDetails[REQUEST_SUBLIST]) { - MAIN_WHITELIST -> requestSubList.setText(R.string.main_whitelist) - FINAL_WHITELIST -> requestSubList.setText(R.string.final_whitelist) - DOMAIN_WHITELIST -> requestSubList.setText(R.string.domain_whitelist) - DOMAIN_INITIAL_WHITELIST -> requestSubList.setText(R.string.domain_initial_whitelist) - DOMAIN_FINAL_WHITELIST -> requestSubList.setText(R.string.domain_final_whitelist) - THIRD_PARTY_WHITELIST -> requestSubList.setText(R.string.third_party_whitelist) - THIRD_PARTY_DOMAIN_WHITELIST -> requestSubList.setText(R.string.third_party_domain_whitelist) - THIRD_PARTY_DOMAIN_INITIAL_WHITELIST -> requestSubList.setText(R.string.third_party_domain_initial_whitelist) - MAIN_BLACKLIST -> requestSubList.setText(R.string.main_blacklist) - INITIAL_BLACKLIST -> requestSubList.setText(R.string.initial_blacklist) - FINAL_BLACKLIST -> requestSubList.setText(R.string.final_blacklist) - DOMAIN_BLACKLIST -> requestSubList.setText(R.string.domain_blacklist) - DOMAIN_INITIAL_BLACKLIST -> requestSubList.setText(R.string.domain_initial_blacklist) - DOMAIN_FINAL_BLACKLIST -> requestSubList.setText(R.string.domain_final_blacklist) - DOMAIN_REGULAR_EXPRESSION_BLACKLIST -> requestSubList.setText(R.string.domain_regular_expression_blacklist) - THIRD_PARTY_BLACKLIST -> requestSubList.setText(R.string.third_party_blacklist) - THIRD_PARTY_INITIAL_BLACKLIST -> requestSubList.setText(R.string.third_party_initial_blacklist) - THIRD_PARTY_DOMAIN_BLACKLIST -> requestSubList.setText(R.string.third_party_domain_blacklist) - THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST -> requestSubList.setText(R.string.third_party_domain_initial_blacklist) - THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST -> requestSubList.setText(R.string.third_party_regular_expression_blacklist) - THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST -> requestSubList.setText(R.string.third_party_domain_regular_expression_blacklist) - REGULAR_EXPRESSION_BLACKLIST -> requestSubList.setText(R.string.regular_expression_blacklist) + MAIN_ALLOWLIST -> requestSubList.setText(R.string.main_allowlist) + FINAL_ALLOWLIST -> requestSubList.setText(R.string.final_allowlist) + DOMAIN_ALLOWLIST -> requestSubList.setText(R.string.domain_allowlist) + DOMAIN_INITIAL_ALLOWLIST -> requestSubList.setText(R.string.domain_initial_allowlist) + DOMAIN_FINAL_ALLOWLIST -> requestSubList.setText(R.string.domain_final_allowlist) + THIRD_PARTY_ALLOWLIST -> requestSubList.setText(R.string.third_party_allowlist) + THIRD_PARTY_DOMAIN_ALLOWLIST -> requestSubList.setText(R.string.third_party_domain_allowlist) + THIRD_PARTY_DOMAIN_INITIAL_ALLOWLIST -> requestSubList.setText(R.string.third_party_domain_initial_allowlist) + MAIN_BLOCKLIST -> requestSubList.setText(R.string.main_blocklist) + INITIAL_BLOCKLIST -> requestSubList.setText(R.string.initial_blocklist) + FINAL_BLOCKLIST -> requestSubList.setText(R.string.final_blocklist) + DOMAIN_BLOCKLIST -> requestSubList.setText(R.string.domain_blocklist) + DOMAIN_INITIAL_BLOCKLIST -> requestSubList.setText(R.string.domain_initial_blocklist) + DOMAIN_FINAL_BLOCKLIST -> requestSubList.setText(R.string.domain_final_blocklist) + DOMAIN_REGULAR_EXPRESSION_BLOCKLIST -> requestSubList.setText(R.string.domain_regular_expression_blocklist) + THIRD_PARTY_BLOCKLIST -> requestSubList.setText(R.string.third_party_blocklist) + THIRD_PARTY_INITIAL_BLOCKLIST -> requestSubList.setText(R.string.third_party_initial_blocklist) + THIRD_PARTY_DOMAIN_BLOCKLIST -> requestSubList.setText(R.string.third_party_domain_blocklist) + THIRD_PARTY_DOMAIN_INITIAL_BLOCKLIST -> requestSubList.setText(R.string.third_party_domain_initial_blocklist) + THIRD_PARTY_REGULAR_EXPRESSION_BLOCKLIST -> requestSubList.setText(R.string.third_party_regular_expression_blocklist) + THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLOCKLIST -> requestSubList.setText(R.string.third_party_domain_regular_expression_blocklist) + REGULAR_EXPRESSION_BLOCKLIST -> requestSubList.setText(R.string.regular_expression_blocklist) } } diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutVersionFragment.kt b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutVersionFragment.kt index b0f47002..b60303c5 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutVersionFragment.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/AboutVersionFragment.kt @@ -72,7 +72,7 @@ import java.text.NumberFormat import kotlin.text.StringBuilder // Define the class constants. -private const val BLOCKLIST_VERSIONS = "blocklist_versions" +private const val FILTERLISTS_VERSIONS = "filterlists_versions" private const val MEBIBYTE = 1048576 class AboutVersionFragment : Fragment() { @@ -80,72 +80,72 @@ class AboutVersionFragment : Fragment() { private var updateMemoryUsageBoolean = true // Declare the class variables. - private lateinit var blocklistVersions: Array private lateinit var aboutVersionLayout: View - private lateinit var appConsumedMemoryLabel: String + private lateinit var activityManager: ActivityManager private lateinit var appAvailableMemoryLabel: String - private lateinit var appTotalMemoryLabel: String + private lateinit var appConsumedMemoryLabel: String private lateinit var appMaximumMemoryLabel: String - private lateinit var systemConsumedMemoryLabel: String - private lateinit var systemAvailableMemoryLabel: String - private lateinit var systemTotalMemoryLabel: String - private lateinit var runtime: Runtime - private lateinit var activityManager: ActivityManager + private lateinit var appTotalMemoryLabel: String + private lateinit var blueColorSpan: ForegroundColorSpan + private lateinit var filterListsVersions: Array private lateinit var memoryInfo: ActivityManager.MemoryInfo private lateinit var numberFormat: NumberFormat - private lateinit var blueColorSpan: ForegroundColorSpan + private lateinit var runtime: Runtime + private lateinit var systemAvailableMemoryLabel: String + private lateinit var systemConsumedMemoryLabel: String + private lateinit var systemTotalMemoryLabel: String // Declare the class views. - private lateinit var privacyBrowserTextView: TextView - private lateinit var versionTextView: TextView - private lateinit var hardwareTextView: TextView - private lateinit var brandTextView: TextView - private lateinit var manufacturerTextView: TextView - private lateinit var modelTextView: TextView - private lateinit var deviceTextView: TextView - private lateinit var bootloaderTextView: TextView - private lateinit var radioTextView: TextView - private lateinit var softwareTextView: TextView private lateinit var androidTextView: TextView - private lateinit var securityPatchTextView: TextView - private lateinit var buildTextView: TextView - private lateinit var kernelTextView: TextView - private lateinit var webViewProviderTextView: TextView - private lateinit var webViewVersionTextView: TextView - private lateinit var orbotTextView: TextView - private lateinit var i2pTextView: TextView - private lateinit var openKeychainTextView: TextView - private lateinit var memoryUsageTextView: TextView - private lateinit var appConsumedMemoryTextView: TextView private lateinit var appAvailableMemoryTextView: TextView - private lateinit var appTotalMemoryTextView: TextView + private lateinit var appConsumedMemoryTextView: TextView private lateinit var appMaximumMemoryTextView: TextView - private lateinit var systemConsumedMemoryTextView: TextView - private lateinit var systemAvailableMemoryTextView: TextView - private lateinit var systemTotalMemoryTextView: TextView - private lateinit var blocklistsTextView: TextView + private lateinit var appTotalMemoryTextView: TextView + private lateinit var brandTextView: TextView + private lateinit var bootloaderTextView: TextView + private lateinit var certificateEndDateTextView: TextView + private lateinit var certificateIssuerDnTextView: TextView + private lateinit var certificateSerialNumberTextView: TextView + private lateinit var certificateSignatureAlgorithmTextView: TextView + private lateinit var certificateStartDateTextView: TextView + private lateinit var certificateSubjectDnTextView: TextView + private lateinit var certificateVersionTextView: TextView + private lateinit var buildTextView: TextView + private lateinit var deviceTextView: TextView private lateinit var easyListTextView: TextView private lateinit var easyPrivacyTextView: TextView private lateinit var fanboyAnnoyanceTextView: TextView private lateinit var fanboySocialTextView: TextView + private lateinit var filterListsTextView: TextView + private lateinit var hardwareTextView: TextView + private lateinit var i2pTextView: TextView + private lateinit var kernelTextView: TextView + private lateinit var manufacturerTextView: TextView + private lateinit var memoryUsageTextView: TextView + private lateinit var modelTextView: TextView + private lateinit var openKeychainTextView: TextView + private lateinit var orbotTextView: TextView + private lateinit var packageSignatureTextView: TextView + private lateinit var privacyBrowserTextView: TextView + private lateinit var radioTextView: TextView + private lateinit var securityPatchTextView: TextView + private lateinit var softwareTextView: TextView + private lateinit var systemAvailableMemoryTextView: TextView + private lateinit var systemConsumedMemoryTextView: TextView + private lateinit var systemTotalMemoryTextView: TextView + private lateinit var versionTextView: TextView private lateinit var ultraListTextView: TextView private lateinit var ultraPrivacyTextView: TextView - private lateinit var packageSignatureTextView: TextView - private lateinit var certificateIssuerDnTextView: TextView - private lateinit var certificateSubjectDnTextView: TextView - private lateinit var certificateStartDateTextView: TextView - private lateinit var certificateEndDateTextView: TextView - private lateinit var certificateVersionTextView: TextView - private lateinit var certificateSerialNumberTextView: TextView - private lateinit var certificateSignatureAlgorithmTextView: TextView + private lateinit var webViewProviderTextView: TextView + private lateinit var webViewVersionTextView: TextView companion object { - fun createTab(blocklistVersions: Array): AboutVersionFragment { + fun createTab(filterListsVersions: Array): AboutVersionFragment { // Create an arguments bundle. val argumentsBundle = Bundle() // Store the arguments in the bundle. - argumentsBundle.putStringArray(BLOCKLIST_VERSIONS, blocklistVersions) + argumentsBundle.putStringArray(FILTERLISTS_VERSIONS, filterListsVersions) // Create a new instance of the tab fragment. val aboutVersionFragment = AboutVersionFragment() @@ -219,7 +219,7 @@ class AboutVersionFragment : Fragment() { super.onCreate(savedInstanceState) // Store the arguments in class variables. - blocklistVersions = requireArguments().getStringArray(BLOCKLIST_VERSIONS)!! + filterListsVersions = requireArguments().getStringArray(FILTERLISTS_VERSIONS)!! // Enable the options menu for this fragment. setHasOptionsMenu(true) @@ -257,7 +257,7 @@ class AboutVersionFragment : Fragment() { systemConsumedMemoryTextView = aboutVersionLayout.findViewById(R.id.system_consumed_memory) systemAvailableMemoryTextView = aboutVersionLayout.findViewById(R.id.system_available_memory) systemTotalMemoryTextView = aboutVersionLayout.findViewById(R.id.system_total_memory) - blocklistsTextView = aboutVersionLayout.findViewById(R.id.blocklists) + filterListsTextView = aboutVersionLayout.findViewById(R.id.filterlists) easyListTextView = aboutVersionLayout.findViewById(R.id.easylist) easyPrivacyTextView = aboutVersionLayout.findViewById(R.id.easyprivacy) fanboyAnnoyanceTextView = aboutVersionLayout.findViewById(R.id.fanboy_annoyance) @@ -371,12 +371,12 @@ class AboutVersionFragment : Fragment() { val buildStringBuilder = SpannableStringBuilder(buildLabel + build) val kernelStringBuilder = SpannableStringBuilder(kernelLabel + kernel) val webViewVersionStringBuilder = SpannableStringBuilder(webViewVersionLabel + webView) - val easyListStringBuilder = SpannableStringBuilder(easyListLabel + blocklistVersions[0]) - val easyPrivacyStringBuilder = SpannableStringBuilder(easyPrivacyLabel + blocklistVersions[1]) - val fanboyAnnoyanceStringBuilder = SpannableStringBuilder(fanboyAnnoyanceLabel + blocklistVersions[2]) - val fanboySocialStringBuilder = SpannableStringBuilder(fanboySocialLabel + blocklistVersions[3]) - val ultraListStringBuilder = SpannableStringBuilder(ultraListLabel + blocklistVersions[4]) - val ultraPrivacyStringBuilder = SpannableStringBuilder(ultraPrivacyLabel + blocklistVersions[5]) + val easyListStringBuilder = SpannableStringBuilder(easyListLabel + filterListsVersions[0]) + val easyPrivacyStringBuilder = SpannableStringBuilder(easyPrivacyLabel + filterListsVersions[1]) + val fanboyAnnoyanceStringBuilder = SpannableStringBuilder(fanboyAnnoyanceLabel + filterListsVersions[2]) + val fanboySocialStringBuilder = SpannableStringBuilder(fanboySocialLabel + filterListsVersions[3]) + val ultraListStringBuilder = SpannableStringBuilder(ultraListLabel + filterListsVersions[4]) + val ultraPrivacyStringBuilder = SpannableStringBuilder(ultraPrivacyLabel + filterListsVersions[5]) // Set the blue color span according to the theme. The deprecated `getColor()` must be used until the minimum API >= 23. blueColorSpan = ForegroundColorSpan(requireContext().getColor(R.color.alt_blue_text)) @@ -869,7 +869,7 @@ class AboutVersionFragment : Fragment() { aboutVersionStringBuilder.append("\n") aboutVersionStringBuilder.append(systemTotalMemoryTextView.text) aboutVersionStringBuilder.append("\n\n") - aboutVersionStringBuilder.append(blocklistsTextView.text) + aboutVersionStringBuilder.append(filterListsTextView.text) aboutVersionStringBuilder.append("\n") aboutVersionStringBuilder.append(easyListTextView.text) aboutVersionStringBuilder.append("\n") diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/CheckBlocklistHelper.kt b/app/src/main/java/com/stoutner/privacybrowser/helpers/CheckBlocklistHelper.kt deleted file mode 100644 index 48867a8e..00000000 --- a/app/src/main/java/com/stoutner/privacybrowser/helpers/CheckBlocklistHelper.kt +++ /dev/null @@ -1,484 +0,0 @@ -/* - * Copyright 2018-2019,2021-2023 Soren Stoutner . - * - * This file is part of Privacy Browser Android . - * - * Privacy Browser Android is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Privacy Browser Android 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Privacy Browser Android. If not, see . - */ - -package com.stoutner.privacybrowser.helpers -import java.util.ArrayList -import java.util.regex.Pattern - -// Define the request disposition options. -const val REQUEST_DEFAULT = "0" -const val REQUEST_ALLOWED = "1" -const val REQUEST_THIRD_PARTY = "2" -const val REQUEST_BLOCKED = "3" - -class CheckBlocklistHelper { - fun checkBlocklist(currentDomain: String?, resourceUrl: String, isThirdPartyRequest: Boolean, blocklist: ArrayList>>): Array { - // Get the blocklist name. - val blocklistName = blocklist[0][1][0] - - // Process the whitelists. - // Main whitelist. - for (whitelistEntry in blocklist[MAIN_WHITELIST.toInt()]) { - when (whitelistEntry.size) { - // There is one entry. - 2 -> if (resourceUrl.contains(whitelistEntry[0])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, MAIN_WHITELIST, whitelistEntry[0], whitelistEntry[1]) - } - - // There are two entries. - 3 -> if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, MAIN_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}", whitelistEntry[2] - ) - } - - // There are three entries. - 4 -> if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, MAIN_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}\n${whitelistEntry[2]}", whitelistEntry[3]) - } - } - } - - // Final whitelist. - for (whitelistEntry in blocklist[FINAL_WHITELIST.toInt()]) { - when (whitelistEntry.size) { - // There is one entry. - 2 -> if (resourceUrl.contains(whitelistEntry[0])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, FINAL_WHITELIST, whitelistEntry[0], whitelistEntry[1]) - } - - // There are two entries. - 3 -> if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, FINAL_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}", whitelistEntry[2]) - } - } - } - - // Only check the domain lists if the current domain is not null (like `about:blank`). - if (currentDomain != null) { - // Domain whitelist. - for (whitelistEntry in blocklist[DOMAIN_WHITELIST.toInt()]) { - when (whitelistEntry.size) { - // There is one entry. - 3 -> if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, DOMAIN_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}", whitelistEntry[2]) - } - - // There are two entries. - 4 -> if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, DOMAIN_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}\n${whitelistEntry[2]}", whitelistEntry[3]) - } - - // There are three entries. - 5 -> if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2]) && resourceUrl.contains(whitelistEntry[3])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, DOMAIN_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}\n${whitelistEntry[2]}\n${whitelistEntry[3]}", whitelistEntry[4]) - } - - // There are four entries. - 6 -> if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2]) && resourceUrl.contains(whitelistEntry[3]) && - resourceUrl.contains(whitelistEntry[4])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, DOMAIN_WHITELIST, - "${whitelistEntry[0]}\n${whitelistEntry[1]}\n${whitelistEntry[2]}\n${whitelistEntry[3]}\n${whitelistEntry[4]}", whitelistEntry[5]) - } - } - } - - // Domain initial whitelist. - for (whitelistEntry in blocklist[DOMAIN_INITIAL_WHITELIST.toInt()]) { - when (whitelistEntry.size) { - // There is one entry. - 3 -> if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.startsWith(whitelistEntry[1])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, DOMAIN_INITIAL_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}".trimIndent(), whitelistEntry[2]) - } - - // There are two entries. - 4 -> if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.startsWith(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, DOMAIN_INITIAL_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}\n${whitelistEntry[2]}", whitelistEntry[3]) - } - - // There are three entries. - 5 -> if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.startsWith(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2]) && resourceUrl.startsWith(whitelistEntry[3])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, DOMAIN_INITIAL_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}\n${whitelistEntry[2]}\n${whitelistEntry[3]}", - whitelistEntry[4]) - } - } - } - - // Domain final whitelist. - for (whitelistEntry in blocklist[DOMAIN_FINAL_WHITELIST.toInt()]) { - when (whitelistEntry.size) { - // There is one entry. - 3 -> if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.endsWith(whitelistEntry[1])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, DOMAIN_FINAL_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}", whitelistEntry[2]) - } - - // There are two entries. - 4 -> if (currentDomain.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.endsWith(whitelistEntry[2])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, DOMAIN_FINAL_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}\n${whitelistEntry[2]}", whitelistEntry[3]) - } - } - } - } - - // Only check the third-party whitelists if this is a third-party request. - if (isThirdPartyRequest) { - // Third-party whitelist. - for (whitelistEntry in blocklist[THIRD_PARTY_WHITELIST.toInt()]) { - when (whitelistEntry.size) { - // There is one entry. - 2 -> if (resourceUrl.contains(whitelistEntry[0])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, THIRD_PARTY_WHITELIST, whitelistEntry[0], whitelistEntry[1]) - } - - // There are two entries. - 3 -> if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, THIRD_PARTY_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}", whitelistEntry[2]) - } - - // There are three entries. - 4 -> if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, THIRD_PARTY_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}\n${whitelistEntry[2]}", whitelistEntry[3]) - } - - // There are four entries. - 5 -> if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2]) && resourceUrl.contains(whitelistEntry[3])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, THIRD_PARTY_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}\n${whitelistEntry[2]}\n${whitelistEntry[3]}", - whitelistEntry[4]) - } - - // There are five entries. - 6 -> if (resourceUrl.contains(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2]) && resourceUrl.contains(whitelistEntry[3]) && - resourceUrl.contains(whitelistEntry[4])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, THIRD_PARTY_WHITELIST, - "${whitelistEntry[0]}\n${whitelistEntry[1]}\n${whitelistEntry[2]}\n${whitelistEntry[3]}\n${whitelistEntry[4]}", whitelistEntry[5]) - } - } - } - - // Third-party domain whitelist. - for (whitelistEntry in blocklist[THIRD_PARTY_DOMAIN_WHITELIST.toInt()]) { - when (whitelistEntry.size) { - // There is one entry. - 3 -> if (currentDomain!!.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, THIRD_PARTY_DOMAIN_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}\n", whitelistEntry[2]) - } - - // There are two entries. - 4 -> if (currentDomain!!.endsWith(whitelistEntry[0]) && resourceUrl.contains(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, THIRD_PARTY_DOMAIN_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}\n${whitelistEntry[2]}", whitelistEntry[3]) - } - } - } - - // Third-party domain initial whitelist. - for (whitelistEntry in blocklist[THIRD_PARTY_DOMAIN_INITIAL_WHITELIST.toInt()]) { - when (whitelistEntry.size) { - // There is one entry. - 3 -> if (currentDomain!!.endsWith(whitelistEntry[0]) && resourceUrl.startsWith(whitelistEntry[1])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, THIRD_PARTY_DOMAIN_INITIAL_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}\n", whitelistEntry[2]) - } - - // There are two entries. - 4 -> if (currentDomain!!.endsWith(whitelistEntry[0]) && resourceUrl.startsWith(whitelistEntry[1]) && resourceUrl.contains(whitelistEntry[2])) { - // Return a whitelist match request allowed. - return arrayOf(REQUEST_ALLOWED, resourceUrl, blocklistName, THIRD_PARTY_DOMAIN_WHITELIST, "${whitelistEntry[0]}\n${whitelistEntry[1]}\n${whitelistEntry[2]}", whitelistEntry[3]) - } - } - } - } - - // Process the blacklists. - // Main blacklist. - for (blacklistEntry in blocklist[MAIN_BLACKLIST.toInt()]) { - when (blacklistEntry.size) { - // There is one entry. - 2 -> if (resourceUrl.contains(blacklistEntry[0])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, MAIN_BLACKLIST, blacklistEntry[0], blacklistEntry[1]) - } - - // There are two entries. - 3 -> if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, MAIN_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}", blacklistEntry[2]) - } - - // There are three entries. - 4 -> if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, MAIN_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n${blacklistEntry[2]}", blacklistEntry[3]) - } - - // There are four entries. - 5 -> if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2]) && resourceUrl.contains(blacklistEntry[3])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, MAIN_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n${blacklistEntry[2]}\n${blacklistEntry[3]}", blacklistEntry[4]) - } - - // There are five entries. - 6 -> if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2]) && resourceUrl.contains(blacklistEntry[3]) && - resourceUrl.contains(blacklistEntry[4])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, MAIN_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n${blacklistEntry[2]}\n${blacklistEntry[3]}\n${blacklistEntry[4]}", - blacklistEntry[5]) - } - } - } - - // Initial blacklist. - for (blacklistEntry in blocklist[INITIAL_BLACKLIST.toInt()]) { - when (blacklistEntry.size) { - // There is one entry. - 2 -> if (resourceUrl.startsWith(blacklistEntry[0])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, INITIAL_BLACKLIST, blacklistEntry[0], blacklistEntry[1]) - } - - // There are two entries - 3 -> if (resourceUrl.startsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, INITIAL_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}", blacklistEntry[2]) - } - } - } - - // Final blacklist. - for (blacklistEntry in blocklist[FINAL_BLACKLIST.toInt()]) { - when (blacklistEntry.size) { - // There is one entry. - 2 -> if (resourceUrl.endsWith(blacklistEntry[0])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, FINAL_BLACKLIST, blacklistEntry[0], blacklistEntry[1]) - } - - // There are two entries. - 3 -> if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.endsWith(blacklistEntry[1])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, FINAL_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}", blacklistEntry[2]) - } - - // There are three entries. - 4 -> if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.endsWith(blacklistEntry[2])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, FINAL_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n${blacklistEntry[2]}", blacklistEntry[3]) - } - } - } - - // Only check the domain lists if the current domain is not null (like `about:blank`). - if (currentDomain != null) { - // Domain blacklist. - for (blacklistEntry in blocklist[DOMAIN_BLACKLIST.toInt()]) { - when (blacklistEntry.size) { - // There is one entry. - 3 -> if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, DOMAIN_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}", blacklistEntry[2]) - } - - // There are two entries. - 4 -> if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, DOMAIN_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n${blacklistEntry[2]}", blacklistEntry[3]) - } - - // There are three entries. - 5 -> if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2]) && resourceUrl.contains(blacklistEntry[3])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, DOMAIN_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n${blacklistEntry[2]}\n${blacklistEntry[3]}", blacklistEntry[4]) - } - } - } - - // Domain initial blacklist. - for (blacklistEntry in blocklist[DOMAIN_INITIAL_BLACKLIST.toInt()]) { - // Store the entry in the resource request log. - if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.startsWith(blacklistEntry[1])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, DOMAIN_INITIAL_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}", blacklistEntry[2]) - } - } - - // Domain final blacklist. - for (blacklistEntry in blocklist[DOMAIN_FINAL_BLACKLIST.toInt()]) { - when (blacklistEntry.size) { - // There is one entry. - 3 -> if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.endsWith(blacklistEntry[1])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, DOMAIN_FINAL_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}", blacklistEntry[2]) - } - - // There are two entries. - 4 -> if (currentDomain.endsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.endsWith(blacklistEntry[2])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, DOMAIN_FINAL_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n${blacklistEntry[2]}", blacklistEntry[3]) - } - } - } - - // Domain regular expression blacklist. - for (blacklistEntry in blocklist[DOMAIN_REGULAR_EXPRESSION_BLACKLIST.toInt()]) { - if (currentDomain.endsWith(blacklistEntry[0]) && Pattern.matches(blacklistEntry[1], resourceUrl)) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, DOMAIN_REGULAR_EXPRESSION_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}", blacklistEntry[2]) - } - } - } - - // Only check the third-party blacklists if this is a third-party request. - if (isThirdPartyRequest) { - // Third-party blacklist. - for (blacklistEntry in blocklist[THIRD_PARTY_BLACKLIST.toInt()]) { - when (blacklistEntry.size) { - // There is one entry. - 2 -> if (resourceUrl.contains(blacklistEntry[0])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_BLACKLIST, blacklistEntry[0], blacklistEntry[1]) - } - - // There are two entries. - 3 -> if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1])) { - // Return a blacklist match request blocked. - return arrayOf( - REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n", blacklistEntry[2]) - } - - // There are three entries. - 4 -> if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n${blacklistEntry[2]}", blacklistEntry[3]) - } - - // There are four entries. - 5 -> if (resourceUrl.contains(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2]) && resourceUrl.contains(blacklistEntry[3])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n${blacklistEntry[2]}\n${blacklistEntry[3]}", - blacklistEntry[4]) - } - } - } - - // Third-party initial blacklist. - for (blacklistEntry in blocklist[THIRD_PARTY_INITIAL_BLACKLIST.toInt()]) { - when (blacklistEntry.size) { - // There is one entry. - 2 -> if (resourceUrl.startsWith(blacklistEntry[0])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_INITIAL_BLACKLIST, blacklistEntry[0], blacklistEntry[1]) - } - - // There are two entries. - 3 -> if (resourceUrl.startsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_INITIAL_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}", blacklistEntry[2]) - } - } - } - - // Third-party domain blacklist. - for (blacklistEntry in blocklist[THIRD_PARTY_DOMAIN_BLACKLIST.toInt()]) { - when (blacklistEntry.size) { - // There is one entry. - 3 -> if (currentDomain!!.endsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_DOMAIN_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}", blacklistEntry[2]) - } - - // There are two entries. - 4 -> if (currentDomain!!.endsWith(blacklistEntry[0]) && resourceUrl.contains(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_DOMAIN_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n${blacklistEntry[2]}", blacklistEntry[3]) - } - } - } - - // Third-party domain initial blacklist. - for (blacklistEntry in blocklist[THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST.toInt()]) { - when (blacklistEntry.size) { - // There is one entry. - 3 -> if (currentDomain!!.endsWith(blacklistEntry[0]) && resourceUrl.startsWith(blacklistEntry[1])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n", blacklistEntry[2]) - } - - // There are two entries. - 4 -> if (currentDomain!!.endsWith(blacklistEntry[0]) && resourceUrl.startsWith(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}\n${blacklistEntry[2]}", blacklistEntry[3]) - } - - // There are three entries. - 5 -> if (currentDomain!!.endsWith(blacklistEntry[0]) && resourceUrl.startsWith(blacklistEntry[1]) && resourceUrl.contains(blacklistEntry[2]) && resourceUrl.contains(blacklistEntry[3])) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST, - "${blacklistEntry[0]}\n${blacklistEntry[1]}\n${blacklistEntry[2]}\n${blacklistEntry[3]}", blacklistEntry[4]) - } - } - } - - // Third-party regular expression blacklist. - for (blacklistEntry in blocklist[THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST.toInt()]) { - if (Pattern.matches(blacklistEntry[0], resourceUrl)) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST, blacklistEntry[0], blacklistEntry[1]) - } - } - - // Third-party domain regular expression blacklist. - for (blacklistEntry in blocklist[THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST.toInt()]) { - if (currentDomain!!.endsWith(blacklistEntry[0]) && Pattern.matches(blacklistEntry[1], resourceUrl)) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST, "${blacklistEntry[0]}\n${blacklistEntry[1]}", blacklistEntry[2]) - } - } - } - - // Regular expression blacklist. - for (blacklistEntry in blocklist[REGULAR_EXPRESSION_BLACKLIST.toInt()]) { - if (Pattern.matches(blacklistEntry[0], resourceUrl)) { - // Return a blacklist match request blocked. - return arrayOf(REQUEST_BLOCKED, resourceUrl, blocklistName, REGULAR_EXPRESSION_BLACKLIST, blacklistEntry[0], blacklistEntry[1]) - } - } - - // Return a no match request default. - return arrayOf(REQUEST_DEFAULT) - } -} diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/CheckFilterListHelper.kt b/app/src/main/java/com/stoutner/privacybrowser/helpers/CheckFilterListHelper.kt new file mode 100644 index 00000000..f330fa0d --- /dev/null +++ b/app/src/main/java/com/stoutner/privacybrowser/helpers/CheckFilterListHelper.kt @@ -0,0 +1,487 @@ +/* + * Copyright 2018-2019,2021-2023 Soren Stoutner . + * + * This file is part of Privacy Browser Android . + * + * Privacy Browser Android is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Privacy Browser Android 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Privacy Browser Android. If not, see . + */ + +package com.stoutner.privacybrowser.helpers + +import java.util.ArrayList +import java.util.regex.Pattern + +// Define the request disposition options. +const val REQUEST_DEFAULT = "0" +const val REQUEST_ALLOWED = "1" +const val REQUEST_THIRD_PARTY = "2" +const val REQUEST_BLOCKED = "3" + +class CheckFilterListHelper { + fun checkFilterList(currentDomain: String?, resourceUrl: String, isThirdPartyRequest: Boolean, filterList: ArrayList>>): Array { + // Get the filter list name. + val filterListName = filterList[0][1][0] + + // Process the allow lists. + // Main allow list. + for (allowListEntry in filterList[MAIN_ALLOWLIST.toInt()]) { + when (allowListEntry.size) { + // There is one entry. + 2 -> if (resourceUrl.contains(allowListEntry[0])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, MAIN_ALLOWLIST, allowListEntry[0], allowListEntry[1]) + } + + // There are two entries. + 3 -> if (resourceUrl.contains(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, MAIN_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}", allowListEntry[2]) + } + + // There are three entries. + 4 -> if (resourceUrl.contains(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1]) && resourceUrl.contains(allowListEntry[2])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, MAIN_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}\n${allowListEntry[2]}", allowListEntry[3]) + } + } + } + + // Final allow list. + for (allowListEntry in filterList[FINAL_ALLOWLIST.toInt()]) { + when (allowListEntry.size) { + // There is one entry. + 2 -> if (resourceUrl.contains(allowListEntry[0])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, FINAL_ALLOWLIST, allowListEntry[0], allowListEntry[1]) + } + + // There are two entries. + 3 -> if (resourceUrl.contains(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, FINAL_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}", allowListEntry[2]) + } + } + } + + // Only check the domain lists if the current domain is not null (like `about:blank`). + if (currentDomain != null) { + // Domain allow list. + for (allowListEntry in filterList[DOMAIN_ALLOWLIST.toInt()]) { + when (allowListEntry.size) { + // There is one entry. + 3 -> if (currentDomain.endsWith(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, DOMAIN_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}", allowListEntry[2]) + } + + // There are two entries. + 4 -> if (currentDomain.endsWith(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1]) && resourceUrl.contains(allowListEntry[2])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, DOMAIN_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}\n${allowListEntry[2]}", allowListEntry[3]) + } + + // There are three entries. + 5 -> if (currentDomain.endsWith(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1]) && resourceUrl.contains(allowListEntry[2]) && resourceUrl.contains(allowListEntry[3])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, DOMAIN_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}\n${allowListEntry[2]}\n${allowListEntry[3]}", + allowListEntry[4]) + } + + // There are four entries. + 6 -> if (currentDomain.endsWith(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1]) && resourceUrl.contains(allowListEntry[2]) && resourceUrl.contains(allowListEntry[3]) && + resourceUrl.contains(allowListEntry[4])) { + + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, DOMAIN_ALLOWLIST, + "${allowListEntry[0]}\n${allowListEntry[1]}\n${allowListEntry[2]}\n${allowListEntry[3]}\n${allowListEntry[4]}", allowListEntry[5]) + } + } + } + + // Domain initial allow list. + for (allowListEntry in filterList[DOMAIN_INITIAL_ALLOWLIST.toInt()]) { + when (allowListEntry.size) { + // There is one entry. + 3 -> if (currentDomain.endsWith(allowListEntry[0]) && resourceUrl.startsWith(allowListEntry[1])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, DOMAIN_INITIAL_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}", allowListEntry[2]) + } + + // There are two entries. + 4 -> if (currentDomain.endsWith(allowListEntry[0]) && resourceUrl.startsWith(allowListEntry[1]) && resourceUrl.contains(allowListEntry[2])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, DOMAIN_INITIAL_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}\n${allowListEntry[2]}", allowListEntry[3]) + } + + // There are three entries. + 5 -> if (currentDomain.endsWith(allowListEntry[0]) && resourceUrl.startsWith(allowListEntry[1]) && resourceUrl.contains(allowListEntry[2]) && resourceUrl.startsWith(allowListEntry[3])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, DOMAIN_INITIAL_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}\n${allowListEntry[2]}\n${allowListEntry[3]}", + allowListEntry[4]) + } + } + } + + // Domain final allow list. + for (allowListEntry in filterList[DOMAIN_FINAL_ALLOWLIST.toInt()]) { + when (allowListEntry.size) { + // There is one entry. + 3 -> if (currentDomain.endsWith(allowListEntry[0]) && resourceUrl.endsWith(allowListEntry[1])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, DOMAIN_FINAL_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}", allowListEntry[2]) + } + + // There are two entries. + 4 -> if (currentDomain.endsWith(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1]) && resourceUrl.endsWith(allowListEntry[2])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, DOMAIN_FINAL_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}\n${allowListEntry[2]}", allowListEntry[3]) + } + } + } + } + + // Only check the third-party allow lists if this is a third-party request. + if (isThirdPartyRequest) { + // Third-party allow list. + for (allowListEntry in filterList[THIRD_PARTY_ALLOWLIST.toInt()]) { + when (allowListEntry.size) { + // There is one entry. + 2 -> if (resourceUrl.contains(allowListEntry[0])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, THIRD_PARTY_ALLOWLIST, allowListEntry[0], allowListEntry[1]) + } + + // There are two entries. + 3 -> if (resourceUrl.contains(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, THIRD_PARTY_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}", allowListEntry[2]) + } + + // There are three entries. + 4 -> if (resourceUrl.contains(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1]) && resourceUrl.contains(allowListEntry[2])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, THIRD_PARTY_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}\n${allowListEntry[2]}", allowListEntry[3]) + } + + // There are four entries. + 5 -> if (resourceUrl.contains(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1]) && resourceUrl.contains(allowListEntry[2]) && resourceUrl.contains(allowListEntry[3])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, THIRD_PARTY_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}\n${allowListEntry[2]}\n${allowListEntry[3]}", + allowListEntry[4]) + } + + // There are five entries. + 6 -> if (resourceUrl.contains(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1]) && resourceUrl.contains(allowListEntry[2]) && resourceUrl.contains(allowListEntry[3]) && + resourceUrl.contains(allowListEntry[4])) { + + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, THIRD_PARTY_ALLOWLIST, + "${allowListEntry[0]}\n${allowListEntry[1]}\n${allowListEntry[2]}\n${allowListEntry[3]}\n${allowListEntry[4]}", allowListEntry[5]) + } + } + } + + // Third-party domain allow list. + for (allowListEntry in filterList[THIRD_PARTY_DOMAIN_ALLOWLIST.toInt()]) { + when (allowListEntry.size) { + // There is one entry. + 3 -> if (currentDomain!!.endsWith(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, THIRD_PARTY_DOMAIN_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}\n", allowListEntry[2]) + } + + // There are two entries. + 4 -> if (currentDomain!!.endsWith(allowListEntry[0]) && resourceUrl.contains(allowListEntry[1]) && resourceUrl.contains(allowListEntry[2])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, THIRD_PARTY_DOMAIN_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}\n${allowListEntry[2]}", allowListEntry[3]) + } + } + } + + // Third-party domain initial allow list. + for (allowListEntry in filterList[THIRD_PARTY_DOMAIN_INITIAL_ALLOWLIST.toInt()]) { + when (allowListEntry.size) { + // There is one entry. + 3 -> if (currentDomain!!.endsWith(allowListEntry[0]) && resourceUrl.startsWith(allowListEntry[1])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, THIRD_PARTY_DOMAIN_INITIAL_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}\n", allowListEntry[2]) + } + + // There are two entries. + 4 -> if (currentDomain!!.endsWith(allowListEntry[0]) && resourceUrl.startsWith(allowListEntry[1]) && resourceUrl.contains(allowListEntry[2])) { + // Allow the request. + return arrayOf(REQUEST_ALLOWED, resourceUrl, filterListName, THIRD_PARTY_DOMAIN_ALLOWLIST, "${allowListEntry[0]}\n${allowListEntry[1]}\n${allowListEntry[2]}", allowListEntry[3]) + } + } + } + } + + // Process the block lists. + // Main block list. + for (blockListEntry in filterList[MAIN_BLOCKLIST.toInt()]) { + when (blockListEntry.size) { + // There is one entry. + 2 -> if (resourceUrl.contains(blockListEntry[0])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, MAIN_BLOCKLIST, blockListEntry[0], blockListEntry[1]) + } + + // There are two entries. + 3 -> if (resourceUrl.contains(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, MAIN_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}", blockListEntry[2]) + } + + // There are three entries. + 4 -> if (resourceUrl.contains(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1]) && resourceUrl.contains(blockListEntry[2])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, MAIN_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n${blockListEntry[2]}", blockListEntry[3]) + } + + // There are four entries. + 5 -> if (resourceUrl.contains(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1]) && resourceUrl.contains(blockListEntry[2]) && resourceUrl.contains(blockListEntry[3])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, MAIN_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n${blockListEntry[2]}\n${blockListEntry[3]}", blockListEntry[4]) + } + + // There are five entries. + 6 -> if (resourceUrl.contains(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1]) && resourceUrl.contains(blockListEntry[2]) && resourceUrl.contains(blockListEntry[3]) && + resourceUrl.contains(blockListEntry[4])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, MAIN_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n${blockListEntry[2]}\n${blockListEntry[3]}\n${blockListEntry[4]}", + blockListEntry[5]) + } + } + } + + // Initial block list. + for (blockListEntry in filterList[INITIAL_BLOCKLIST.toInt()]) { + when (blockListEntry.size) { + // There is one entry. + 2 -> if (resourceUrl.startsWith(blockListEntry[0])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, INITIAL_BLOCKLIST, blockListEntry[0], blockListEntry[1]) + } + + // There are two entries + 3 -> if (resourceUrl.startsWith(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, INITIAL_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}", blockListEntry[2]) + } + } + } + + // Final block list. + for (blockListEntry in filterList[FINAL_BLOCKLIST.toInt()]) { + when (blockListEntry.size) { + // There is one entry. + 2 -> if (resourceUrl.endsWith(blockListEntry[0])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, FINAL_BLOCKLIST, blockListEntry[0], blockListEntry[1]) + } + + // There are two entries. + 3 -> if (resourceUrl.contains(blockListEntry[0]) && resourceUrl.endsWith(blockListEntry[1])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, FINAL_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}", blockListEntry[2]) + } + + // There are three entries. + 4 -> if (resourceUrl.contains(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1]) && resourceUrl.endsWith(blockListEntry[2])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, FINAL_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n${blockListEntry[2]}", blockListEntry[3]) + } + } + } + + // Only check the domain lists if the current domain is not null (like `about:blank`). + if (currentDomain != null) { + // Domain block list. + for (blockListEntry in filterList[DOMAIN_BLOCKLIST.toInt()]) { + when (blockListEntry.size) { + // There is one entry. + 3 -> if (currentDomain.endsWith(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, DOMAIN_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}", blockListEntry[2]) + } + + // There are two entries. + 4 -> if (currentDomain.endsWith(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1]) && resourceUrl.contains(blockListEntry[2])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, DOMAIN_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n${blockListEntry[2]}", blockListEntry[3]) + } + + // There are three entries. + 5 -> if (currentDomain.endsWith(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1]) && resourceUrl.contains(blockListEntry[2]) && resourceUrl.contains(blockListEntry[3])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, DOMAIN_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n${blockListEntry[2]}\n${blockListEntry[3]}", + blockListEntry[4]) + } + } + } + + // Domain initial block list. + for (blockListEntry in filterList[DOMAIN_INITIAL_BLOCKLIST.toInt()]) { + // Store the entry in the resource request log. + if (currentDomain.endsWith(blockListEntry[0]) && resourceUrl.startsWith(blockListEntry[1])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, DOMAIN_INITIAL_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}", blockListEntry[2]) + } + } + + // Domain final block list. + for (blockListEntry in filterList[DOMAIN_FINAL_BLOCKLIST.toInt()]) { + when (blockListEntry.size) { + // There is one entry. + 3 -> if (currentDomain.endsWith(blockListEntry[0]) && resourceUrl.endsWith(blockListEntry[1])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, DOMAIN_FINAL_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}", blockListEntry[2]) + } + + // There are two entries. + 4 -> if (currentDomain.endsWith(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1]) && resourceUrl.endsWith(blockListEntry[2])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, DOMAIN_FINAL_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n${blockListEntry[2]}", blockListEntry[3]) + } + } + } + + // Domain regular expression block list. + for (blockListEntry in filterList[DOMAIN_REGULAR_EXPRESSION_BLOCKLIST.toInt()]) { + if (currentDomain.endsWith(blockListEntry[0]) && Pattern.matches(blockListEntry[1], resourceUrl)) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, DOMAIN_REGULAR_EXPRESSION_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}", blockListEntry[2]) + } + } + } + + // Only check the third-party block lists if this is a third-party request. + if (isThirdPartyRequest) { + // Third-party block list. + for (blockListEntry in filterList[THIRD_PARTY_BLOCKLIST.toInt()]) { + when (blockListEntry.size) { + // There is one entry. + 2 -> if (resourceUrl.contains(blockListEntry[0])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_BLOCKLIST, blockListEntry[0], blockListEntry[1]) + } + + // There are two entries. + 3 -> if (resourceUrl.contains(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n", blockListEntry[2]) + } + + // There are three entries. + 4 -> if (resourceUrl.contains(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1]) && resourceUrl.contains(blockListEntry[2])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n${blockListEntry[2]}", blockListEntry[3]) + } + + // There are four entries. + 5 -> if (resourceUrl.contains(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1]) && resourceUrl.contains(blockListEntry[2]) && resourceUrl.contains(blockListEntry[3])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n${blockListEntry[2]}\n${blockListEntry[3]}", + blockListEntry[4]) + } + } + } + + // Third-party initial block list. + for (blockListEntry in filterList[THIRD_PARTY_INITIAL_BLOCKLIST.toInt()]) { + when (blockListEntry.size) { + // There is one entry. + 2 -> if (resourceUrl.startsWith(blockListEntry[0])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_INITIAL_BLOCKLIST, blockListEntry[0], blockListEntry[1]) + } + + // There are two entries. + 3 -> if (resourceUrl.startsWith(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_INITIAL_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}", blockListEntry[2]) + } + } + } + + // Third-party domain block list. + for (blockListEntry in filterList[THIRD_PARTY_DOMAIN_BLOCKLIST.toInt()]) { + when (blockListEntry.size) { + // There is one entry. + 3 -> if (currentDomain!!.endsWith(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_DOMAIN_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}", blockListEntry[2]) + } + + // There are two entries. + 4 -> if (currentDomain!!.endsWith(blockListEntry[0]) && resourceUrl.contains(blockListEntry[1]) && resourceUrl.contains(blockListEntry[2])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_DOMAIN_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n${blockListEntry[2]}", blockListEntry[3]) + } + } + } + + // Third-party domain initial block list. + for (blockListEntry in filterList[THIRD_PARTY_DOMAIN_INITIAL_BLOCKLIST.toInt()]) { + when (blockListEntry.size) { + // There is one entry. + 3 -> if (currentDomain!!.endsWith(blockListEntry[0]) && resourceUrl.startsWith(blockListEntry[1])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_DOMAIN_INITIAL_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n", blockListEntry[2]) + } + + // There are two entries. + 4 -> if (currentDomain!!.endsWith(blockListEntry[0]) && resourceUrl.startsWith(blockListEntry[1]) && resourceUrl.contains(blockListEntry[2])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_DOMAIN_INITIAL_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}\n${blockListEntry[2]}", blockListEntry[3]) + } + + // There are three entries. + 5 -> if (currentDomain!!.endsWith(blockListEntry[0]) && resourceUrl.startsWith(blockListEntry[1]) && resourceUrl.contains(blockListEntry[2]) && resourceUrl.contains(blockListEntry[3])) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_DOMAIN_INITIAL_BLOCKLIST, + "${blockListEntry[0]}\n${blockListEntry[1]}\n${blockListEntry[2]}\n${blockListEntry[3]}", blockListEntry[4]) + } + } + } + + // Third-party regular expression block list. + for (blockListEntry in filterList[THIRD_PARTY_REGULAR_EXPRESSION_BLOCKLIST.toInt()]) { + if (Pattern.matches(blockListEntry[0], resourceUrl)) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_REGULAR_EXPRESSION_BLOCKLIST, blockListEntry[0], blockListEntry[1]) + } + } + + // Third-party domain regular expression block list. + for (blockListEntry in filterList[THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLOCKLIST.toInt()]) { + if (currentDomain!!.endsWith(blockListEntry[0]) && Pattern.matches(blockListEntry[1], resourceUrl)) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLOCKLIST, "${blockListEntry[0]}\n${blockListEntry[1]}", blockListEntry[2]) + } + } + } + + // Regular expression block list. + for (blockListEntry in filterList[REGULAR_EXPRESSION_BLOCKLIST.toInt()]) { + if (Pattern.matches(blockListEntry[0], resourceUrl)) { + // Block the request. + return arrayOf(REQUEST_BLOCKED, resourceUrl, filterListName, REGULAR_EXPRESSION_BLOCKLIST, blockListEntry[0], blockListEntry[1]) + } + } + + // Return a default result. + return arrayOf(REQUEST_DEFAULT) + } +} diff --git a/app/src/main/java/com/stoutner/privacybrowser/helpers/ParseBlocklistHelper.kt b/app/src/main/java/com/stoutner/privacybrowser/helpers/ParseFilterListHelper.kt similarity index 53% rename from app/src/main/java/com/stoutner/privacybrowser/helpers/ParseBlocklistHelper.kt rename to app/src/main/java/com/stoutner/privacybrowser/helpers/ParseFilterListHelper.kt index e6c8bf48..f5af6d6f 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/helpers/ParseBlocklistHelper.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/helpers/ParseFilterListHelper.kt @@ -24,6 +24,7 @@ import android.content.res.AssetManager import java.io.BufferedReader import java.io.IOException import java.io.InputStreamReader + import java.util.ArrayList // Define the schema of the string array in each entry of the resource requests array list. @@ -34,152 +35,154 @@ const val REQUEST_SUBLIST = 3 const val REQUEST_BLOCKLIST_ENTRIES = 4 const val REQUEST_BLOCKLIST_ORIGINAL_ENTRY = 5 -// Define the whitelists. -const val MAIN_WHITELIST = "1" -const val FINAL_WHITELIST = "2" -const val DOMAIN_WHITELIST = "3" -const val DOMAIN_INITIAL_WHITELIST = "4" -const val DOMAIN_FINAL_WHITELIST = "5" -const val THIRD_PARTY_WHITELIST = "6" -const val THIRD_PARTY_DOMAIN_WHITELIST = "7" -const val THIRD_PARTY_DOMAIN_INITIAL_WHITELIST = "8" - -// Define the blacklists. -const val MAIN_BLACKLIST = "9" -const val INITIAL_BLACKLIST = "10" -const val FINAL_BLACKLIST = "11" -const val DOMAIN_BLACKLIST = "12" -const val DOMAIN_INITIAL_BLACKLIST = "13" -const val DOMAIN_FINAL_BLACKLIST = "14" -const val DOMAIN_REGULAR_EXPRESSION_BLACKLIST = "15" -const val THIRD_PARTY_BLACKLIST = "16" -const val THIRD_PARTY_INITIAL_BLACKLIST = "17" -const val THIRD_PARTY_DOMAIN_BLACKLIST = "18" -const val THIRD_PARTY_DOMAIN_INITIAL_BLACKLIST = "19" -const val THIRD_PARTY_REGULAR_EXPRESSION_BLACKLIST = "20" -const val THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLACKLIST = "21" -const val REGULAR_EXPRESSION_BLACKLIST = "22" - -class ParseBlocklistHelper { - fun parseBlocklist(assetManager: AssetManager, blocklistName: String): ArrayList>> { +// Define the allow lists. +const val MAIN_ALLOWLIST = "1" +const val FINAL_ALLOWLIST = "2" +const val DOMAIN_ALLOWLIST = "3" +const val DOMAIN_INITIAL_ALLOWLIST = "4" +const val DOMAIN_FINAL_ALLOWLIST = "5" +const val THIRD_PARTY_ALLOWLIST = "6" +const val THIRD_PARTY_DOMAIN_ALLOWLIST = "7" +const val THIRD_PARTY_DOMAIN_INITIAL_ALLOWLIST = "8" + +// Define the block lists. +const val MAIN_BLOCKLIST = "9" +const val INITIAL_BLOCKLIST = "10" +const val FINAL_BLOCKLIST = "11" +const val DOMAIN_BLOCKLIST = "12" +const val DOMAIN_INITIAL_BLOCKLIST = "13" +const val DOMAIN_FINAL_BLOCKLIST = "14" +const val DOMAIN_REGULAR_EXPRESSION_BLOCKLIST = "15" +const val THIRD_PARTY_BLOCKLIST = "16" +const val THIRD_PARTY_INITIAL_BLOCKLIST = "17" +const val THIRD_PARTY_DOMAIN_BLOCKLIST = "18" +const val THIRD_PARTY_DOMAIN_INITIAL_BLOCKLIST = "19" +const val THIRD_PARTY_REGULAR_EXPRESSION_BLOCKLIST = "20" +const val THIRD_PARTY_DOMAIN_REGULAR_EXPRESSION_BLOCKLIST = "21" +const val REGULAR_EXPRESSION_BLOCKLIST = "22" + +class ParseFilterListHelper { + fun parseFilterList(assetManager: AssetManager, filterListName: String): ArrayList>> { // Initialize the header list. val headers: MutableList> = ArrayList() // 0. - // Initialize the whitelists. - val mainWhitelist: MutableList> = ArrayList() // 1. - val finalWhitelist: MutableList> = ArrayList() // 2. - val domainWhitelist: MutableList> = ArrayList() // 3. - val domainInitialWhitelist: MutableList> = ArrayList() // 4. - val domainFinalWhitelist: MutableList> = ArrayList() // 5. - val thirdPartyWhitelist: MutableList> = ArrayList() // 6. - val thirdPartyDomainWhitelist: MutableList> = ArrayList() // 7. - val thirdPartyDomainInitialWhitelist: MutableList> = ArrayList() // 8. - - // Initialize the blacklists. - val mainBlacklist: MutableList> = ArrayList() // 9. - val initialBlacklist: MutableList> = ArrayList() // 10. - val finalBlacklist: MutableList> = ArrayList() // 11. - val domainBlacklist: MutableList> = ArrayList() // 12. - val domainInitialBlacklist: MutableList> = ArrayList() // 13. - val domainFinalBlacklist: MutableList> = ArrayList() // 14. - val domainRegularExpressionBlacklist: MutableList> = ArrayList() // 15. - val thirdPartyBlacklist: MutableList> = ArrayList() // 16. - val thirdPartyInitialBlacklist: MutableList> = ArrayList() // 17. - val thirdPartyDomainBlacklist: MutableList> = ArrayList() // 18. - val thirdPartyDomainInitialBlacklist: MutableList> = ArrayList() // 19. - val regularExpressionBlacklist: MutableList> = ArrayList() // 20. - val thirdPartyRegularExpressionBlacklist: MutableList> = ArrayList() // 21. - val thirdPartyDomainRegularExpressionBlacklist: MutableList> = ArrayList() // 22. - - // Populate the blocklists. The `try` is required by input stream reader. + // Initialize the allow lists. + val mainAllowList: MutableList> = ArrayList() // 1. + val finalAllowList: MutableList> = ArrayList() // 2. + val domainAllowList: MutableList> = ArrayList() // 3. + val domainInitialAllowList: MutableList> = ArrayList() // 4. + val domainFinalAllowList: MutableList> = ArrayList() // 5. + val thirdPartyAllowList: MutableList> = ArrayList() // 6. + val thirdPartyDomainAllowList: MutableList> = ArrayList() // 7. + val thirdPartyDomainInitialAllowList: MutableList> = ArrayList() // 8. + + // Initialize the block lists. + val mainBlockList: MutableList> = ArrayList() // 9. + val initialBlockList: MutableList> = ArrayList() // 10. + val finalBlockList: MutableList> = ArrayList() // 11. + val domainBlockList: MutableList> = ArrayList() // 12. + val domainInitialBlockList: MutableList> = ArrayList() // 13. + val domainFinalBlockList: MutableList> = ArrayList() // 14. + val domainRegularExpressionBlockList: MutableList> = ArrayList() // 15. + val thirdPartyBlockList: MutableList> = ArrayList() // 16. + val thirdPartyInitialBlockList: MutableList> = ArrayList() // 17. + val thirdPartyDomainBlockList: MutableList> = ArrayList() // 18. + val thirdPartyDomainInitialBlockList: MutableList> = ArrayList() // 19. + val regularExpressionBlockList: MutableList> = ArrayList() // 20. + val thirdPartyRegularExpressionBlockList: MutableList> = ArrayList() // 21. + val thirdPartyDomainRegularExpressionBlockList: MutableList> = ArrayList() // 22. + + // Parse the filter list. The `try` is required by input stream reader. try { - // Load the blocklist into a buffered reader. - val bufferedReader = BufferedReader(InputStreamReader(assetManager.open(blocklistName))) + // Load the filter list into a buffered reader. + val bufferedReader = BufferedReader(InputStreamReader(assetManager.open(filterListName))) - // Create strings for storing the block list entries. - var blocklistEntry: String - var originalBlocklistEntry: String + // Create strings for storing the filter list entries. + var filterListEntry: String + var originalFilterListEntry: String - // Parse the block list. + // Parse the filter list. bufferedReader.forEachLine { - // Store the original block list entry. - originalBlocklistEntry = it + // Store the original filter list entry. + originalFilterListEntry = it - // Remove any `^` from the block list entry. Privacy Browser does not process them in the interest of efficiency. - blocklistEntry = it.replace("^", "") + // Remove any `^` from the filter list entry. Privacy Browser does not process them in the interest of efficiency. + filterListEntry = it.replace("^", "") // Parse the entry. - if (blocklistEntry.contains("##") || blocklistEntry.contains("#?#") || blocklistEntry.contains("#@#") || blocklistEntry.startsWith("[")) { + if (filterListEntry.contains("##") || filterListEntry.contains("#?#") || filterListEntry.contains("#@#") || filterListEntry.startsWith("[")) { // Entries that contain `##`, `#?#`, and `#@#` are for hiding elements in the main page's HTML. Entries that start with `[` describe the AdBlock compatibility level. // Do nothing. Privacy Browser does not currently use these entries. - //Log.i("Blocklists", "Not added: " + blocklistEntry); - } else if (blocklistEntry.contains("\$csp=script-src")) { // Ignore entries that contain `$csp=script-src`. + //Log.i("FilterLists", "Not added: " + filterListEntry) + } else if (filterListEntry.contains("\$csp=script-src")) { // Ignore entries that contain `$csp=script-src`. // Do nothing. It is uncertain what this directive is even supposed to mean, and it is blocking entire websites like androidcentral.com. https://redmine.stoutner.com/issues/306. - //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry); - } else if (blocklistEntry.contains("\$websocket") || blocklistEntry.contains("\$third-party,websocket") || blocklistEntry.contains("\$script,websocket")) { + //Log.i("FilterLists", "Not added: " + originalFilterListEntry) + } else if (filterListEntry.contains("\$websocket") || filterListEntry.contains("\$third-party,websocket") || filterListEntry.contains("\$script,websocket")) { // Ignore entries with `websocket`. // Do nothing. Privacy Browser does not differentiate between websocket requests and other requests and these entries cause a lot of false positives. - //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry); - } else if (blocklistEntry.startsWith("!")) { // Comment entries. - if (blocklistEntry.startsWith("! Version:")) { + //Log.i("FilterLists", "Not added: " + originalFilterlistEntry) + } else if (filterListEntry.startsWith("!")) { // Comment entries. + if (filterListEntry.startsWith("! Version:")) { // Get the list version number. - val listVersion = arrayOf(blocklistEntry.substring(11)) + val listVersion = arrayOf(filterListEntry.substring(11)) // Store the list version in the headers list. headers.add(listVersion) } - if (blocklistEntry.startsWith("! Title:")) { + if (filterListEntry.startsWith("! Title:")) { // Get the list title. - val listTitle = arrayOf(blocklistEntry.substring(9)) + val listTitle = arrayOf(filterListEntry.substring(9)) // Store the list title in the headers list. headers.add(listTitle) } - //Log.i("Blocklists", "Not added: " + blocklistEntry); - } else if (blocklistEntry.startsWith("@@")) { // Entries that begin with `@@` are whitelists. + //Log.i("FilterLists", "Not added: " + filterListEntry); + } else if (filterListEntry.startsWith("@@")) { // Entries that begin with `@@` are allowed entries. // Remove the `@@` - blocklistEntry = blocklistEntry.substring(2) + filterListEntry = filterListEntry.substring(2) // Strip out any initial `||`. Privacy Browser doesn't differentiate items that only match against the end of the domain name. - if (blocklistEntry.startsWith("||")) { - blocklistEntry = blocklistEntry.substring(2) - } + if (filterListEntry.startsWith("||")) + filterListEntry = filterListEntry.substring(2) - if (blocklistEntry.contains("$")) { // Filter entries. - if (blocklistEntry.contains("~third-party")) { // Ignore entries that contain `~third-party`. + // Check if the entry contains an Adblock filter option (indicated by `$`). + if (filterListEntry.contains("$")) { // The entry contains a filter option. + if (filterListEntry.contains("~third-party")) { // Ignore entries that contain `~third-party`. // Do nothing. - //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry); - } else if (blocklistEntry.contains("third-party")) { // Third-party whitelist entries. - if (blocklistEntry.contains("domain=")) { // Third-party domain whitelist entries. + //Log.i("FilterLists", headers.get(1)[0] + " not added: " + originalFilterListEntry) + } else if (filterListEntry.contains("third-party")) { // Third-party allowed entries. + // Check if the entry only applies to certain domains. + if (filterListEntry.contains("domain=")) { // Third-party domain allowed entries. // Parse the entry. - var entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) - val filters = blocklistEntry.substring(blocklistEntry.indexOf("$") + 1) + var entry = filterListEntry.substring(0, filterListEntry.indexOf("$")) + val filters = filterListEntry.substring(filterListEntry.indexOf("$") + 1) var domains = filters.substring(filters.indexOf("domain=") + 7) if (domains.contains("~")) { // It is uncertain what a `~` domain means inside an `@@` entry. // Do Nothing - //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry); - } else if (blocklistEntry.startsWith("|")) { // Third-party domain initial whitelist entries. + //Log.i("FilterLists", headers.get(1)[0] + " not added: " + originalFilterListEntry) + } else if (filterListEntry.startsWith("|")) { // Third-party domain initial allowed entries. // Strip out the initial `|`. entry = entry.substring(1) if (entry == "http://" || entry == "https://") { // Ignore generic entries. // Do nothing. These entries are designed for filter options that Privacy Browser does not use. - //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry); - } else { // Process third-party domain initial whitelist entries. + //Log.i("FilterLists", headers.get(1)[0] + " not added: " + originalFilterListEntry); + } else { // Process third-party domain initial allowed entries. // Process each domain. do { // Create a string to keep track of the current domain. var domain: String + // Populate the current domain. if (domains.contains("|")) { // There is more than one domain in the list. // Get the first domain from the list. domain = domains.substring(0, domains.indexOf("|")) @@ -190,7 +193,8 @@ class ParseBlocklistHelper { domain = domains } - if (entry.contains("*")) { // Process a third-party domain initial whitelist double entry. + // Process the domain entry. + if (entry.contains("*")) { // Process a third-party domain initial allowed double entry. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -199,22 +203,23 @@ class ParseBlocklistHelper { val secondEntry = entry.substring(wildcardIndex + 1) // Create an entry string array. - val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalBlocklistEntry) + val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the whitelist. - thirdPartyDomainInitialWhitelist.add(domainDoubleEntry) + // Add the entry to the allow list. + thirdPartyDomainInitialAllowList.add(domainDoubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain initial whitelist added: " + domain + " , " + firstEntry + " , " + secondEntry + - // " - " + originalBlocklistEntry); - } else { // Process a third-party domain initial whitelist single entry. + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain initial allow list added: " + domain + " , " + firstEntry + " , " + secondEntry + + // " - " + originalFilterListEntry) + } else { // Process a third-party domain initial allowed single entry. // Create a domain entry string array. - val domainEntry = arrayOf(domain, entry, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the third party domain initial whitelist. - thirdPartyDomainInitialWhitelist.add(domainEntry) + // Add the entry to the third party domain initial allow list. + thirdPartyDomainInitialAllowList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain initial whitelist added: " + domain + " , " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain initial allow list added: " + domain + " , " + entry + " - " + originalFilterListEntry) } + // Repeat until all the domains have been processed. } while (domains.contains("|")) } } else { // Third-party domain entries. @@ -223,7 +228,8 @@ class ParseBlocklistHelper { // Create a string to keep track of the current domain. var domain: String - if (domains.contains("|")) { // three is more than one domain in the list. + // Populate the current domain. + if (domains.contains("|")) { // There is more than one domain in the list. // Get the first domain from the list. domain = domains.substring(0, domains.indexOf("|")) @@ -238,6 +244,7 @@ class ParseBlocklistHelper { entry = entry.substring(0, entry.length - 1) } + // Process the domain entry. if (entry.contains("*")) { // Process a third-party domain double entry. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -247,28 +254,30 @@ class ParseBlocklistHelper { val secondEntry = entry.substring(wildcardIndex + 1) // Create an entry string array. - val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalBlocklistEntry) + val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the whitelist. - thirdPartyDomainWhitelist.add(domainDoubleEntry) + // Add the entry to the allow list. + thirdPartyDomainAllowList.add(domainDoubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain whitelist added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + - // originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain allow list added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + + // originalFilterListEntry) } else { // Process a third-party domain single entry. // Create an entry string array. - val domainEntry = arrayOf(domain, entry, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the whitelist. - thirdPartyDomainWhitelist.add(domainEntry) + // Add the entry to the allow list. + thirdPartyDomainAllowList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain whitelist added: " + domain + " , " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain allow list added: " + domain + " , " + entry + " - " + originalFilterListEntry) } + // Repeat until all the domains have been processed. } while (domains.contains("|")) } - } else { // Process third-party whitelist entries. + } else { // Process third-party allow list entries. // Parse the entry - val entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) + val entry = filterListEntry.substring(0, filterListEntry.indexOf("$")) + // Process the entry. if (entry.contains("*")) { // There are two or more entries. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -277,6 +286,7 @@ class ParseBlocklistHelper { val firstEntry = entry.substring(0, wildcardIndex) val secondEntry = entry.substring(wildcardIndex + 1) + // Process the second entry. if (secondEntry.contains("*")) { // There are three or more entries. // Get the index of the wildcard. val secondWildcardIndex = secondEntry.indexOf("*") @@ -285,6 +295,7 @@ class ParseBlocklistHelper { val realSecondEntry = secondEntry.substring(0, secondWildcardIndex) val thirdEntry = secondEntry.substring(secondWildcardIndex + 1) + // Process the third entry. if (thirdEntry.contains("*")) { // There are four or more entries. // Get the index of the wildcard. val thirdWildcardIndex = thirdEntry.indexOf("*") @@ -293,7 +304,8 @@ class ParseBlocklistHelper { val realThirdEntry = thirdEntry.substring(0, thirdWildcardIndex) val fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1) - if (fourthEntry.contains("*")) { // Process a third-party whitelist quintuple entry. + // Process the fourth entry. + if (fourthEntry.contains("*")) { // Process a third-party allow list quintuple entry. // Get the index of the wildcard. val fourthWildcardIndex = fourthEntry.indexOf("*") @@ -302,72 +314,75 @@ class ParseBlocklistHelper { val fifthEntry = fourthEntry.substring(fourthWildcardIndex + 1) // Create an entry string array. - val quintupleEntry = arrayOf(firstEntry, realSecondEntry, realThirdEntry, realFourthEntry, fifthEntry, originalBlocklistEntry) + val quintupleEntry = arrayOf(firstEntry, realSecondEntry, realThirdEntry, realFourthEntry, fifthEntry, originalFilterListEntry) - // Add the entry to the whitelist. - thirdPartyWhitelist.add(quintupleEntry) + // Add the entry to the allow list. + thirdPartyAllowList.add(quintupleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party whitelist added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " + - // realFourthEntry + " , " + fifthEntry + " - " + originalBlocklistEntry); - } else { // Process a third-party whitelist quadruple entry. + //Log.i("FilerLists", headers.get(1)[0] + " third-party allow list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " + + // realFourthEntry + " , " + fifthEntry + " - " + originalFilterListEntry) + } else { // Third-party allow list quadruple entry. // Create an entry string array. - val quadrupleEntry = arrayOf(firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlocklistEntry) + val quadrupleEntry = arrayOf(firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalFilterListEntry) - // Add the entry to the whitelist. - thirdPartyWhitelist.add(quadrupleEntry) + // Add the entry to the allow list. + thirdPartyAllowList.add(quadrupleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party whitelist added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " + - // fourthEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party allow list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " + + // fourthEntry + " - " + originalAllowListEntry) } - } else { // Process a third-party whitelist triple entry. + } else { // Process a third-party allow list triple entry. // Create an entry string array. - val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry) + val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalFilterListEntry) - // Add the entry to the whitelist. - thirdPartyWhitelist.add(tripleEntry) + // Add the entry to the allow list. + thirdPartyAllowList.add(tripleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party whitelist added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + - // originalBlocklistEntry); + //Log.i("AllowLists", headers.get(1)[0] + " third-party allow list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + + // originalFilterListEntry) } - } else { // Process a third-party whitelist double entry. + } else { // Process a third-party allow list double entry. // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the whitelist. - thirdPartyWhitelist.add(doubleEntry) + // Add the entry to the allow list. + thirdPartyAllowList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party whitelist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party allow list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) } - } else { // Process a third-party whitelist single entry. + } else { // Process a third-party allow list single entry. // Create an entry string array. - val singleEntry = arrayOf(entry, originalBlocklistEntry) + val singleEntry = arrayOf(entry, originalFilterListEntry) - // Add the entry to the whitelist. - thirdPartyWhitelist.add(singleEntry) + // Add the entry to the allow list. + thirdPartyAllowList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain whitelist added: " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain allow list added: " + entry + " - " + originalFilterListEntry) } } - } else if (blocklistEntry.contains("domain=")) { // Process domain whitelist entries. + } else if (filterListEntry.contains("domain=")) { // Process domain allow list entries. // Parse the entry - var entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) - val filters = blocklistEntry.substring(blocklistEntry.indexOf("$") + 1) + var entry = filterListEntry.substring(0, filterListEntry.indexOf("$")) + val filters = filterListEntry.substring(filterListEntry.indexOf("$") + 1) var domains = filters.substring(filters.indexOf("domain=") + 7) - if (entry.startsWith("|")) { // Initial domain whitelist entries. + // Process the entry. + if (entry.startsWith("|")) { // Initial domain allow list entries. // Strip the initial `|`. entry = entry.substring(1) + // Process the entry. if (entry == "http://" || entry == "https://") { // Ignore generic entries. // Do nothing. These entries are designed for filter options that Privacy Browser does not use. - //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry); - } else { // Initial domain whitelist entry. + //Log.i("FilterLists", headers.get(1)[0] + " not added: " + originalFilterListEntry) + } else { // Initial domain allow list entry. // Process each domain. do { // Create a string to keep track of the current domain. var domain: String + // Get the first domain. if (domains.contains("|")) { // There is more than one domain in the list. // Get the first domain from the list. domain = domains.substring(0, domains.indexOf("|")) @@ -378,6 +393,7 @@ class ParseBlocklistHelper { domain = domains } + // Process the entry. if (entry.contains("*")) { // There are two or more entries. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -386,6 +402,7 @@ class ParseBlocklistHelper { val firstEntry = entry.substring(0, wildcardIndex) val secondEntry = entry.substring(wildcardIndex + 1) + // Process the second entry. if (secondEntry.contains("*")) { // Process a domain initial triple entry. // Get the index of the wildcard. val secondWildcardIndex = secondEntry.indexOf("*") @@ -395,35 +412,36 @@ class ParseBlocklistHelper { val thirdEntry = secondEntry.substring(secondWildcardIndex + 1) // Create an entry string array. - val domainTripleEntry = arrayOf(domain, firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry) + val domainTripleEntry = arrayOf(domain, firstEntry, realSecondEntry, thirdEntry, originalFilterListEntry) - // Add the entry to the whitelist. - domainInitialWhitelist.add(domainTripleEntry) + // Add the entry to the allow list. + domainInitialAllowList.add(domainTripleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain initial whitelist entry added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + - // thirdEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain initial allow list entry added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + + // thirdEntry + " - " + originalFilterListEntry) } else { // Process a domain initial double entry. // Create an entry string array. - val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalBlocklistEntry) + val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the whitelist. - domainInitialWhitelist.add(domainDoubleEntry) + // Add the entry to the allow list. + domainInitialAllowList.add(domainDoubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain initial whitelist entry added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + - // originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain initial allow list entry added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + + // originalFilterListEntry) } } else { // Process a domain initial single entry. // Create an entry string array. - val domainEntry = arrayOf(domain, entry, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the whitelist. - domainInitialWhitelist.add(domainEntry) + // Add the entry to the allow list. + domainInitialAllowList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain initial whitelist entry added: " + domain + " , " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain initial allow list entry added: " + domain + " , " + entry + " - " + originalFilterListEntry) } + // Repeat until all the domains have been processed. } while (domains.contains("|")) } - } else if (entry.endsWith("|")) { // Final domain whitelist entries. + } else if (entry.endsWith("|")) { // Final domain allow list entries. // Strip the `|` from the end of the entry. entry = entry.substring(0, entry.length - 1) @@ -432,6 +450,7 @@ class ParseBlocklistHelper { // Create a string to keep track of the current domain. var domain: String + // Get the first domain. if (domains.contains("|")) { // There is more than one domain in the list. // Get the first domain from the list. domain = domains.substring(0, domains.indexOf("|")) @@ -442,7 +461,7 @@ class ParseBlocklistHelper { domain = domains } - if (entry.contains("*")) { // Process a domain final whitelist double entry. + if (entry.contains("*")) { // Domain final allow list double entry. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -451,34 +470,36 @@ class ParseBlocklistHelper { val secondEntry = entry.substring(wildcardIndex + 1) // Create an entry string array. - val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalBlocklistEntry) + val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the whitelist. - domainFinalWhitelist.add(domainDoubleEntry) + // Add the entry to the allow list. + domainFinalAllowList.add(domainDoubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain final whitelist added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + - // originalBlocklistEntry); - } else { // Process a domain final whitelist single entry. + //Log.i("FilterLists", headers.get(1)[0] + " domain final allow list added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + + // originalFilterListEntry); + } else { // Process a domain final allow list single entry. // create an entry string array. - val domainEntry = arrayOf(domain, entry, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the whitelist. - domainFinalWhitelist.add(domainEntry) + // Add the entry to the allow list. + domainFinalAllowList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain final whitelist added: " + domain + " , " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain final allow list added: " + domain + " , " + entry + " - " + originalFilterListEntry); } + // Repeat until all the domains have been processed. } while (domains.contains("|")) - } else { // Standard domain whitelist entries with filters. + } else { // Standard domain allow list entries with filters. if (domains.contains("~")) { // It is uncertain what a `~` domain means inside an `@@` entry. // Do Nothing - //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " not added: " + originalFilterListEntry) } else { // Process each domain. do { // Create a string to keep track of the current domain. var domain: String + // Get the first domain. if (domains.contains("|")) { // There is more than one domain in the list. // Get the first domain from the list. domain = domains.substring(0, domains.indexOf("|")) @@ -489,6 +510,7 @@ class ParseBlocklistHelper { domain = domains } + // Process the entry. if (entry.contains("*")) { // There are two or more entries. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -497,6 +519,7 @@ class ParseBlocklistHelper { val firstEntry = entry.substring(0, wildcardIndex) val secondEntry = entry.substring(wildcardIndex + 1) + // Process the second entry. if (secondEntry.contains("*")) { // There are three or more entries. // Get the index of the wildcard. val secondWildcardIndex = secondEntry.indexOf("*") @@ -505,7 +528,8 @@ class ParseBlocklistHelper { val realSecondEntry = secondEntry.substring(0, secondWildcardIndex) val thirdEntry = secondEntry.substring(secondWildcardIndex + 1) - if (thirdEntry.contains("*")) { // Process a domain whitelist quadruple entry. + // Process the third entry. + if (thirdEntry.contains("*")) { // Process a domain allow list quadruple entry. // Get the index of the wildcard. val thirdWildcardIndex = thirdEntry.indexOf("*") @@ -514,51 +538,52 @@ class ParseBlocklistHelper { val fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1) // Create an entry string array. - val domainQuadrupleEntry = arrayOf(domain, firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlocklistEntry) + val domainQuadrupleEntry = arrayOf(domain, firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalFilterListEntry) - // Add the entry to the whitelist. - domainWhitelist.add(domainQuadrupleEntry) + // Add the entry to the allow list. + domainAllowList.add(domainQuadrupleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain whitelist added : " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + - // realThirdEntry + " , " + fourthEntry + " - " + originalBlocklistEntry); - } else { // Process a domain whitelist triple entry. + //Log.i("FilterLists", headers.get(1)[0] + " domain allow list added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + + // realThirdEntry + " , " + fourthEntry + " - " + originalFilterListEntry) + } else { // Process a domain allow list triple entry. // Create an entry string array. - val domainTripleEntry = arrayOf(domain, firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry) + val domainTripleEntry = arrayOf(domain, firstEntry, realSecondEntry, thirdEntry, originalFilterListEntry) - // Add the entry to the whitelist. - domainWhitelist.add(domainTripleEntry) + // Add the entry to the allow list. + domainAllowList.add(domainTripleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain whitelist added : " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + - // thirdEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain allow list added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + + // thirdEntry + " - " + originalFilterListEntry) } - } else { // Process a domain whitelist double entry. + } else { // Process a domain allow list double entry. // Create an entry string array. - val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalBlocklistEntry) + val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the whitelist. - domainWhitelist.add(domainDoubleEntry) + // Add the entry to the allow list. + domainAllowList.add(domainDoubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain whitelist added : " + domain + " , " + firstEntry + " , " + secondEntry + " - " + - // originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain allow list added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " originalFilterListEntry) } - } else { // Process a domain whitelist single entry. + } else { // Process a domain allow list single entry. // Create an entry string array. - val domainEntry = arrayOf(domain, entry, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the whitelist. - domainWhitelist.add(domainEntry) + // Add the entry to the allow list. + domainAllowList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain whitelist added : " + domain + " , " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain allow list added: " + domain + " , " + entry + " - " + originalFilterListEntry) } + // Repeat until all the domains have been processed. } while (domains.contains("|")) } } } // Ignore all other filter entries. - } else if (blocklistEntry.endsWith("|")) { // Final whitelist entries. + } else if (filterListEntry.endsWith("|")) { // Final allow list entries. // Remove the final `|` from the entry. - val entry = blocklistEntry.substring(0, blocklistEntry.length - 1) + val entry = filterListEntry.substring(0, filterListEntry.length - 1) - if (entry.contains("*")) { // Process a final whitelist double entry + // Process the entry. + if (entry.contains("*")) { // Process a final allow list double entry // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -567,31 +592,33 @@ class ParseBlocklistHelper { val secondEntry = entry.substring(wildcardIndex + 1) // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the whitelist. - finalWhitelist.add(doubleEntry) + // Add the entry to the allow list. + finalAllowList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " final whitelist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); - } else { // Process a final whitelist single entry. + //Log.i("FilterLists", headers.get(1)[0] + " final allow list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) + } else { // Process a final allow list single entry. // Create an entry string array. - val singleEntry = arrayOf(entry, originalBlocklistEntry) + val singleEntry = arrayOf(entry, originalFilterListEntry) - // Add the entry to the whitelist. - finalWhitelist.add(singleEntry) + // Add the entry to the allow list. + finalAllowList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " final whitelist added: " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " final allow list added: " + entry + " - " + originalFilterListEntry) } - } else { // Main whitelist entries. - if (blocklistEntry.contains("*")) { // There are two or more entries. + } else { // Main allow list entries. + // Process the entry. + if (filterListEntry.contains("*")) { // There are two or more entries. // Get the index of the wildcard. - val wildcardIndex = blocklistEntry.indexOf("*") + val wildcardIndex = filterListEntry.indexOf("*") // Split the entry into components. - val firstEntry = blocklistEntry.substring(0, wildcardIndex) - val secondEntry = blocklistEntry.substring(wildcardIndex + 1) + val firstEntry = filterListEntry.substring(0, wildcardIndex) + val secondEntry = filterListEntry.substring(wildcardIndex + 1) - if (secondEntry.contains("*")) { // Process a main whitelist triple entry. + // Process the second entry. + if (secondEntry.contains("*")) { // Main allow list triple entry. // Get the index of the wildcard. val secondWildcardIndex = secondEntry.indexOf("*") @@ -600,41 +627,41 @@ class ParseBlocklistHelper { val thirdEntry = secondEntry.substring(secondWildcardIndex + 1) // Create an entry string array. - val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry) + val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalFilterListEntry) - // Add the entry to the whitelist. - mainWhitelist.add(tripleEntry) + // Add the entry to the allow list. + mainAllowList.add(tripleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main whitelist added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + originalBlocklistEntry); - } else { // Process a main whitelist double entry. + //Log.i("FilterLists", headers.get(1)[0] + " main allow list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + originalFilterListEntry) + } else { // Process a main allow list double entry. // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the whitelist. - mainWhitelist.add(doubleEntry) + // Add the entry to the allow list. + mainAllowList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main whitelist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " main allow list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) } - } else { // Process a main whitelist single entry. + } else { // Process a main allow list single entry. // Create an entry string array. - val singleEntry = arrayOf(blocklistEntry, originalBlocklistEntry) + val singleEntry = arrayOf(filterListEntry, originalFilterListEntry) - // Add the entry to the whitelist. - mainWhitelist.add(singleEntry) + // Add the entry to the allow list. + mainAllowList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main whitelist added: " + blocklistEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " main allow list added: " + filterListEntry + " - " + originalFilterListEntry) } } - } else if (blocklistEntry.endsWith("|")) { // Final blacklist entries. + } else if (filterListEntry.endsWith("|")) { // Final block list entries. // Strip out the final "|" - var entry = blocklistEntry.substring(0, blocklistEntry.length - 1) + var entry = filterListEntry.substring(0, filterListEntry.length - 1) - // Strip out any initial `||`. They are redundant in this case because the blocklist entry is being matched against the end of the URL. - if (entry.startsWith("||")) { + // Strip out any initial `||`. They are redundant in this case because the block list entry is being matched against the end of the URL. + if (entry.startsWith("||")) entry = entry.substring(2) - } - if (entry.contains("*")) { // Process a final blacklist double entry. + // Process the entry. + if (entry.contains("*")) { // Process a final block list double entry. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -643,53 +670,57 @@ class ParseBlocklistHelper { val secondEntry = entry.substring(wildcardIndex + 1) // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - finalBlacklist.add(doubleEntry) + // Add the entry to the block list. + finalBlockList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " final blacklist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); - } else { // Process a final blacklist single entry. - // create an entry string array. - val singleEntry = arrayOf(entry, originalBlocklistEntry) + //Log.i("FilterLists", headers.get(1)[0] + " final block list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) + } else { // Process a final block list single entry. + // Create an entry string array. + val singleEntry = arrayOf(entry, originalFilterListEntry) - // Add the entry to the blacklist. - finalBlacklist.add(singleEntry) + // Add the entry to the block list. + finalBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " final blacklist added: " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " final block list added: " + entry + " - " + originalFilterListEntry) } - } else if (blocklistEntry.contains("$")) { // Entries with filter options. + } else if (filterListEntry.contains("$")) { // Entries with filter options. // Strip out any initial `||`. These will be treated like any other entry. - if (blocklistEntry.startsWith("||")) { - blocklistEntry = blocklistEntry.substring(2) - } - - if (blocklistEntry.contains("third-party")) { // Third-party entries. - if (blocklistEntry.contains("~third-party")) { // Third-party filter whitelist entries. - // Do not process these whitelist entries. They are designed to combine with block filters that Privacy Browser doesn't use, like `subdocument` and `xmlhttprequest`. - - //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry); - } else if (blocklistEntry.contains("domain=")) { // Third-party domain entries. - if (blocklistEntry.startsWith("|")) { // Third-party domain initial entries. + if (filterListEntry.startsWith("||")) + filterListEntry = filterListEntry.substring(2) + + // Process the entry. + if (filterListEntry.contains("third-party")) { // Third-party entries. + // Process the entry. + if (filterListEntry.contains("~third-party")) { // Third-party filter allow list entries. + // Do not process these allow list entries. They are designed to combine with block filters that Privacy Browser doesn't use, like `subdocument` and `xmlhttprequest`. + + //Log.i("FilterLists", headers.get(1)[0] + " not added: " + originalFilterListEntry) + } else if (filterListEntry.contains("domain=")) { // Third-party domain entries. + // Process the domain entry. + if (filterListEntry.startsWith("|")) { // Third-party domain initial entries. // Strip the initial `|`. - blocklistEntry = blocklistEntry.substring(1) + filterListEntry = filterListEntry.substring(1) // Parse the entry - val entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) - val filters = blocklistEntry.substring(blocklistEntry.indexOf("$") + 1) + val entry = filterListEntry.substring(0, filterListEntry.indexOf("$")) + val filters = filterListEntry.substring(filterListEntry.indexOf("$") + 1) var domains = filters.substring(filters.indexOf("domain=") + 7) + // Process the entry. if (entry == "http:" || entry == "https:" || entry == "http://" || entry == "https://") { // Ignore generic entries. // Do nothing. These entries will almost entirely disable the website. // Often the original entry blocks filter options like `$script`, which Privacy Browser does not differentiate. - //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " not added: " + originalFilterListEntry) } else { // Third-party domain initial entries. // Process each domain. do { // Create a string to keep track of the current domain. var domain: String + // Get the first domain. if (domains.contains("|")) { // There is more than one domain in the list. // Get the first domain from the list. domain = domains.substring(0, domains.indexOf("|")) @@ -700,6 +731,7 @@ class ParseBlocklistHelper { domain = domains } + // Process the entry. if (entry.contains("*")) { // Three are two or more entries. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -708,7 +740,8 @@ class ParseBlocklistHelper { val firstEntry = entry.substring(0, wildcardIndex) val secondEntry = entry.substring(wildcardIndex + 1) - if (secondEntry.contains("*")) { // Process a third-party domain initial blacklist triple entry. + // Process the second entry. + if (secondEntry.contains("*")) { // Third-party domain initial block list triple entry. // Get the index of the wildcard. val secondWildcardIndex = secondEntry.indexOf("*") @@ -717,38 +750,39 @@ class ParseBlocklistHelper { val thirdEntry = secondEntry.substring(secondWildcardIndex + 1) // Create an entry string array. - val tripleDomainEntry = arrayOf(domain, firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry) + val tripleDomainEntry = arrayOf(domain, firstEntry, realSecondEntry, thirdEntry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyDomainInitialBlacklist.add(tripleDomainEntry) + // Add the entry to the block list. + thirdPartyDomainInitialBlockList.add(tripleDomainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain initial blacklist added: " + domain + " , " + firstEntry + " , " + realSecondEntry + - // " , " + thirdEntry + " - " + originalBlocklistEntry); - } else { // Process a third-party domain initial blacklist double entry. + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain initial block list added: " + domain + " , " + firstEntry + " , " + realSecondEntry + + // " , " + thirdEntry + " - " + originalFilterListEntry) + } else { // Process a third-party domain initial block list double entry. // Create an entry string array. - val doubleDomainEntry = arrayOf(domain, firstEntry, secondEntry, originalBlocklistEntry) + val doubleDomainEntry = arrayOf(domain, firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyDomainInitialBlacklist.add(doubleDomainEntry) + // Add the entry to the block list. + thirdPartyDomainInitialBlockList.add(doubleDomainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain initial blacklist added: " + domain + " , " + firstEntry + " , " + secondEntry + - // " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain initial block list added: " + domain + " , " + firstEntry + " , " + secondEntry + + // " - " + originalFilterListEntry) } - } else { // Process a third-party domain initial blacklist single entry. + } else { // Process a third-party domain initial block list single entry. // Create an entry string array. - val singleEntry = arrayOf(domain, entry, originalBlocklistEntry) + val singleEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyDomainInitialBlacklist.add(singleEntry) + // Add the entry to the block list. + thirdPartyDomainInitialBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain initial blacklist added: " + domain + " , " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain initial block list added: " + domain + " , " + entry + " - " + originalFilterListEntry) } + // Repeat until all the domains have been processed. } while (domains.contains("|")) } - } else if (blocklistEntry.contains("\\")) { // Process a third-party domain blacklist regular expression. + } else if (filterListEntry.contains("\\")) { // Process a third-party domain block list regular expression. // Parse the entry. At least one regular expression in this entry contains `$`, so the parser uses `/$`. - val entry = blocklistEntry.substring(0, blocklistEntry.indexOf("/$") + 1) - val filters = blocklistEntry.substring(blocklistEntry.indexOf("/$") + 2) + val entry = filterListEntry.substring(0, filterListEntry.indexOf("/$") + 1) + val filters = filterListEntry.substring(filterListEntry.indexOf("/$") + 2) var domains = filters.substring(filters.indexOf("domain=") + 7) // Process each domain. @@ -756,6 +790,7 @@ class ParseBlocklistHelper { // Create a string to keep track of the current domain. var domain: String + // Get the first domain. if (domains.contains("|")) { // There is more than one domain in the list. // Get the first domain from the list. domain = domains.substring(0, domains.indexOf("|")) @@ -767,32 +802,33 @@ class ParseBlocklistHelper { } // Create an entry string array. - val domainEntry = arrayOf(domain, entry, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyDomainRegularExpressionBlacklist.add(domainEntry) + // Add the entry to the block list. + thirdPartyDomainRegularExpressionBlockList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain regular expression blacklist added: " + domain + " , " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain regular expression block list added: " + domain + " , " + entry + " - " + originalFilterListEntry) + // Repeat until all the domains have been processed. } while (domains.contains("|")) } else { // Third-party domain entries. // Parse the entry - var entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) - val filters = blocklistEntry.substring(blocklistEntry.indexOf("$") + 1) + var entry = filterListEntry.substring(0, filterListEntry.indexOf("$")) + val filters = filterListEntry.substring(filterListEntry.indexOf("$") + 1) var domains = filters.substring(filters.indexOf("domain=") + 7) // Strip any trailing "*" from the entry. - if (entry.endsWith("*")) { + if (entry.endsWith("*")) entry = entry.substring(0, entry.length - 1) - } - // Track if any third-party whitelist filters are applied. - var whitelistDomain = false + // Create an allow domain tracker. + var allowDomain = false // Process each domain. do { // Create a string to keep track of the current domain. var domain: String + // Get the first domain. if (domains.contains("|")) { // There is more than one domain in the list. // Get the first domain from the list. domain = domains.substring(0, domains.indexOf("|")) @@ -803,15 +839,16 @@ class ParseBlocklistHelper { domain = domains } - // Differentiate between blocklist domains and whitelist domains. - if (domain.startsWith("~")) { // Whitelist third-party domain entry. + // Differentiate between block list domains and allow list domains. + if (domain.startsWith("~")) { // Allow list third-party domain entry. // Strip the initial `~`. domain = domain.substring(1) - // Set the whitelist domain flag. - whitelistDomain = true + // Set the allow list domain flag. + allowDomain = true - if (entry.contains("*")) { // Process a third-party domain whitelist double entry. + // Process the entry. + if (entry.contains("*")) { // Third-party domain allow list double entry. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -820,24 +857,24 @@ class ParseBlocklistHelper { val secondEntry = entry.substring(wildcardIndex + 1) // Create an entry string array. - val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalBlocklistEntry) + val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the whitelist. - thirdPartyDomainWhitelist.add(domainDoubleEntry) + // Add the entry to the allow list. + thirdPartyDomainAllowList.add(domainDoubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain whitelist added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + - // originalBlocklistEntry); - } else { // Process a third-party domain whitelist single entry. + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain allow list added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + + // originalFilterListEntry) + } else { // Process a third-party domain allow list single entry. // Create an entry string array. - val domainEntry = arrayOf(domain, entry, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the whitelist. - thirdPartyDomainWhitelist.add(domainEntry) + // Add the entry to the allow list. + thirdPartyDomainAllowList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain whitelist added: " + domain + " , " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain allow list added: " + domain + " , " + entry + " - " + originalFilterListEntry) } - } else { // Third-party domain blacklist entries. - if (entry.contains("*")) { // Process a third-party domain blacklist double entry. + } else { // Third-party domain block list entries. + if (entry.contains("*")) { // Process a third-party domain block list double entry. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -846,28 +883,29 @@ class ParseBlocklistHelper { val secondEntry = entry.substring(wildcardIndex + 1) // Create an entry string array. - val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalBlocklistEntry) + val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist - thirdPartyDomainBlacklist.add(domainDoubleEntry) + // Add the entry to the block list + thirdPartyDomainBlockList.add(domainDoubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain blacklist added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + - // originalBlocklistEntry); - } else { // Process a third-party domain blacklist single entry. + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain block list added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + + // originalFilterListEntry) + } else { // Process a third-party domain block list single entry. // Create an entry string array. - val domainEntry = arrayOf(domain, entry, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyDomainBlacklist.add(domainEntry) + // Add the entry to the block list. + thirdPartyDomainBlockList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party domain blocklist added: " + domain + " , " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party domain block list added: " + domain + " , " + entry + " - " + originalFilterListEntry) } } + // Repeat until all the domains have been processed. } while (domains.contains("|")) - // Add a third-party blacklist entry if a whitelist domain was processed. - if (whitelistDomain) { - if (entry.contains("*")) { // Process a third-party blacklist double entry. + // Add a third-party block list entry if an allow list domain was processed. + if (allowDomain) { + if (entry.contains("*")) { // Third-party block list double entry. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -876,30 +914,32 @@ class ParseBlocklistHelper { val secondEntry = entry.substring(wildcardIndex + 1) // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyBlacklist.add(doubleEntry) + // Add the entry to the block list. + thirdPartyBlockList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party blacklist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); - } else { // Process a third-party blacklist single entry. + //Log.i("FilterLists", headers.get(1)[0] + " third-party block list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) + } else { // Process a third-party block list single entry. // Create an entry string array. - val singleEntry = arrayOf(entry, originalBlocklistEntry) + val singleEntry = arrayOf(entry, originalFilterListEntry) - // Add an entry to the blacklist. - thirdPartyBlacklist.add(singleEntry) + // Add an entry to the block list. + thirdPartyBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party blacklist added: " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party block list added: " + entry + " - " + originalFilterListEntry) } } } - } else if (blocklistEntry.startsWith("|")) { // Third-party initial blacklist entries. + } else if (filterListEntry.startsWith("|")) { // Third-party initial block list entries. // Strip the initial `|`. - blocklistEntry = blocklistEntry.substring(1) + filterListEntry = filterListEntry.substring(1) // Get the entry. - val entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) - if (entry.contains("*")) { // Process a third-party initial blacklist double entry. + val entry = filterListEntry.substring(0, filterListEntry.indexOf("$")) + + // Process the entry. + if (entry.contains("*")) { // Process a third-party initial block list double entry. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -908,53 +948,51 @@ class ParseBlocklistHelper { val secondEntry = entry.substring(wildcardIndex + 1) // Create an entry string array. - val thirdPartyDoubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val thirdPartyDoubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyInitialBlacklist.add(thirdPartyDoubleEntry) + // Add the entry to the block list. + thirdPartyInitialBlockList.add(thirdPartyDoubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party initial blacklist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); - } else { // Process a third-party initial blacklist single entry. + //Log.i("FilterLists", headers.get(1)[0] + " third-party initial block list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) + } else { // Process a third-party initial block list single entry. // Create an entry string array. - val singleEntry = arrayOf(entry, originalBlocklistEntry) + val singleEntry = arrayOf(entry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyInitialBlacklist.add(singleEntry) + // Add the entry to the block list. + thirdPartyInitialBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party initial blacklist added: " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party initial block list added: " + entry + " - " + originalFilterListEntry) } - } else if (blocklistEntry.contains("\\")) { // Process a regular expression blacklist entry. - // Prepare a string to hold the entry. - + } else if (filterListEntry.contains("\\")) { // Third-party regular expression block list entry. // Get the entry. - val entry: String = if (blocklistEntry.contains("$/$")) { // The first `$` is part of the regular expression. - blocklistEntry.substring(0, blocklistEntry.indexOf("$/$") + 2) - } else { // The only `$` indicates the filter options. - blocklistEntry.substring(0, blocklistEntry.indexOf("$")) - } + val entry = if (filterListEntry.contains("$/$")) // The first `$` is part of the regular expression. + filterListEntry.substring(0, filterListEntry.indexOf("$/$") + 2) + else // The only `$` indicates the filter options. + filterListEntry.substring(0, filterListEntry.indexOf("$")) // Create an entry string array. - val singleEntry = arrayOf(entry, originalBlocklistEntry) + val singleEntry = arrayOf(entry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyRegularExpressionBlacklist.add(singleEntry) + // Add the entry to the block list. + thirdPartyRegularExpressionBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party regular expression blacklist added: " + entry + " - " + originalBlocklistEntry); - } else if (blocklistEntry.contains("*")) { // Third-party and regular expression blacklist entries. + //Log.i("FilterLists", headers.get(1)[0] + " third-party regular expression block list added: " + entry + " - " + originalFilterListEntry) + } else if (filterListEntry.contains("*")) { // Third-party and regular expression block list entries. // Get the entry. - var entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) + var entry = filterListEntry.substring(0, filterListEntry.indexOf("$")) - if (entry.endsWith("*")) { // Process a third-party blacklist single entry. + // Process the entry. + if (entry.endsWith("*")) { // Third-party block list single entry. // Strip the final `*`. entry = entry.substring(0, entry.length - 1) // Create an entry string array. - val singleEntry = arrayOf(entry, originalBlocklistEntry) + val singleEntry = arrayOf(entry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyBlacklist.add(singleEntry) + // Add the entry to the block list. + thirdPartyBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third party blacklist added: " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third party block list added: " + entry + " - " + originalFilterListEntry) } else { // There are two or more entries. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -963,6 +1001,7 @@ class ParseBlocklistHelper { val firstEntry = entry.substring(0, wildcardIndex) val secondEntry = entry.substring(wildcardIndex + 1) + // Process the second entry. if (secondEntry.contains("*")) { // There are three or more entries. // Get the index of the wildcard. val secondWildcardIndex = secondEntry.indexOf("*") @@ -971,7 +1010,8 @@ class ParseBlocklistHelper { val realSecondEntry = secondEntry.substring(0, secondWildcardIndex) val thirdEntry = secondEntry.substring(secondWildcardIndex + 1) - if (thirdEntry.contains("*")) { // Process a third-party blacklist quadruple entry. + // Process a third entry. + if (thirdEntry.contains("*")) { // Third-party block list quadruple entry. // Get the index of the wildcard. val thirdWildcardIndex = thirdEntry.indexOf("*") @@ -980,62 +1020,63 @@ class ParseBlocklistHelper { val fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1) // Create an entry string array. - val quadrupleEntry = arrayOf(firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlocklistEntry) + val quadrupleEntry = arrayOf(firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyBlacklist.add(quadrupleEntry) + // Add the entry to the block list. + thirdPartyBlockList.add(quadrupleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party blacklist added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " + - // fourthEntry + " - " + originalBlocklistEntry); - } else { // Process a third-party blacklist triple entry. + //Log.i("FilterLists", headers.get(1)[0] + " third-party block list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " + + // fourthEntry + " - " + originalFilterListEntry); + } else { // Third-party block list triple entry. // Create an entry string array. - val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry) + val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyBlacklist.add(tripleEntry) + // Add the entry to the block list. + thirdPartyBlockList.add(tripleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party blacklist added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + - // originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party block list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + + // originalFilterListEntry) } - } else { // Process a third-party blacklist double entry. + } else { // Third-party block list double entry. // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyBlacklist.add(doubleEntry) + // Add the entry to the block list. + thirdPartyBlockList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third-party blacklist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third-party block list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) } } - } else { // Process a third party blacklist single entry. + } else { // Third party block list single entry. // Get the entry. - val entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) + val entry = filterListEntry.substring(0, filterListEntry.indexOf("$")) // Create an entry string array. - val singleEntry = arrayOf(entry, originalBlocklistEntry) + val singleEntry = arrayOf(entry, originalFilterListEntry) - // Add the entry to the blacklist. - thirdPartyBlacklist.add(singleEntry) + // Add the entry to the block list. + thirdPartyBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " third party blacklist added: " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " third party block list added: " + entry + " - " + originalFilterListEntry) } - } else if (blocklistEntry.substring(blocklistEntry.indexOf("$")).contains("domain=")) { // Domain entries. - if (blocklistEntry.contains("~")) { // Domain whitelist entries. + } else if (filterListEntry.substring(filterListEntry.indexOf("$")).contains("domain=")) { // Domain entries. + // Process the entry. + if (filterListEntry.contains("~")) { // Domain allow list entries. // Separate the filters. - var entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) - val filters = blocklistEntry.substring(blocklistEntry.indexOf("$") + 1) + var entry = filterListEntry.substring(0, filterListEntry.indexOf("$")) + val filters = filterListEntry.substring(filterListEntry.indexOf("$") + 1) var domains = filters.substring(filters.indexOf("domain=") + 7) // Strip any final `*` from the entry. They are redundant. - if (entry.endsWith("*")) { + if (entry.endsWith("*")) entry = entry.substring(0, entry.length - 1) - } // Process each domain. do { // Create a string to keep track of the current domain. var domain: String + // Get the first domain. if (domains.contains("|")) { // There is more than one domain in the list. // Get the first domain from the list. domain = domains.substring(0, domains.indexOf("|")) @@ -1048,6 +1089,8 @@ class ParseBlocklistHelper { // Strip the initial `~`. domain = domain.substring(1) + + // Process the entry. if (entry.contains("*")) { // There are two or more entries. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -1056,7 +1099,8 @@ class ParseBlocklistHelper { val firstEntry = entry.substring(0, wildcardIndex) val secondEntry = entry.substring(wildcardIndex + 1) - if (secondEntry.contains("*")) { // Process a domain whitelist triple entry. + // Process the second entry. + if (secondEntry.contains("*")) { // Domain allow list triple entry. // Get the index of the wildcard. val secondWildcardIndex = secondEntry.indexOf("*") @@ -1065,45 +1109,47 @@ class ParseBlocklistHelper { val thirdEntry = secondEntry.substring(secondWildcardIndex + 1) // Create an entry string array. - val domainTripleEntry = arrayOf(domain, firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry) + val domainTripleEntry = arrayOf(domain, firstEntry, realSecondEntry, thirdEntry, originalFilterListEntry) - // Add the entry to the whitelist. - domainWhitelist.add(domainTripleEntry) + // Add the entry to the allow list. + domainAllowList.add(domainTripleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain whitelist added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + - // " - " + originalBlocklistEntry); - } else { // Process a domain whitelist double entry. + //Log.i("FilterLists", headers.get(1)[0] + " domain allow list added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + + // " - " + originalFilterListEntry) + } else { // Process a domain allow list double entry. // Create an entry string array. - val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalBlocklistEntry) + val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the whitelist. - domainWhitelist.add(domainDoubleEntry) + // Add the entry to the allow list. + domainAllowList.add(domainDoubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain whitelist added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain allow list added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) } - } else { // Process a domain whitelist single entry. + } else { // Process a domain allow list single entry. // Create an entry string array. - val domainEntry = arrayOf(domain, entry, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the whitelist. - domainWhitelist.add(domainEntry) + // Add the entry to the allow list. + domainAllowList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain whitelist added: " + domain + " , " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain allow list added: " + domain + " , " + entry + " - " + originalFilterListEntry) } + // Repeat until all the domains have been processed. } while (domains.contains("|")) - } else { // Domain blacklist entries. + } else { // Domain block list entries. // Separate the filters. - val entry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) - val filters = blocklistEntry.substring(blocklistEntry.indexOf("$") + 1) + var entry = filterListEntry.substring(0, filterListEntry.indexOf("$")) + val filters = filterListEntry.substring(filterListEntry.indexOf("$") + 1) var domains = filters.substring(filters.indexOf("domain=") + 7) - // Only process the item if the entry is not null. For example, some lines begin with `$websocket`, which create a null entry. - if (entry != "") { + // Only process the item if the entry is not empty. For example, some lines begin with `$websocket`, which create an empty entry. + if (entry.isNotEmpty()) { // Process each domain. do { // Create a string to keep track of the current domain. var domain: String + // Get the first domain. if (domains.contains("|")) { // There is more than one domain in the list. // Get the first domain from the list. domain = domains.substring(0, domains.indexOf("|")) @@ -1114,61 +1160,64 @@ class ParseBlocklistHelper { domain = domains } - if (entry.startsWith("|")) { // Domain initial blacklist entries. + // Process the entry. + if (entry.startsWith("|")) { // Domain initial block list entries. // Remove the initial `|`; - val entryBase = entry.substring(1) + entry = entry.substring(1) - if (entryBase == "http://" || entryBase == "https://") { + // Process the entry. + if (entry == "http://" || entry == "https://") { // Do nothing. These entries will entirely block the website. // Often the original entry blocks `$script` but Privacy Browser does not currently differentiate between scripts and other entries. - //Log.i("Blocklists", headers.get(1)[0] + " not added: " + originalBlocklistEntry); - } else { // Process a domain initial blacklist entry + //Log.i("FilterLists", headers.get(1)[0] + " not added: " + originalFilterListEntry) + } else { // Domain initial block list entry. // Create an entry string array. - val domainEntry = arrayOf(domain, entryBase, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the blacklist. - domainInitialBlacklist.add(domainEntry) + // Add the entry to the block list. + domainInitialBlockList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain initial blacklist added: " + domain + " , " + entryBase + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain initial block list added: " + domain + " , " + entryBase + " - " + originalFilterListEntry) } - } else if (entry.endsWith("|")) { // Domain final blacklist entries. + } else if (entry.endsWith("|")) { // Domain final block list entries. // Remove the final `|`. - val entryBase = entry.substring(0, entry.length - 1) + entry = entry.substring(0, entry.length - 1) - if (entryBase.contains("*")) { // Process a domain final blacklist double entry. + // Process the entry. + if (entry.contains("*")) { // Process a domain final block list double entry. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") // Split the entry into components. - val firstEntry = entryBase.substring(0, wildcardIndex) - val secondEntry = entryBase.substring(wildcardIndex + 1) + val firstEntry = entry.substring(0, wildcardIndex) + val secondEntry = entry.substring(wildcardIndex + 1) // Create an entry string array. - val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalBlocklistEntry) + val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - domainFinalBlacklist.add(domainDoubleEntry) + // Add the entry to the block list. + domainFinalBlockList.add(domainDoubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain final blacklist added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + - // originalBlocklistEntry); - } else { // Process a domain final blacklist single entry. + //Log.i("FilterLists", headers.get(1)[0] + " domain final block list added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + + // originalFilterListEntry) + } else { // Domain final block list single entry. // Create an entry string array. - val domainEntry = arrayOf(domain, entryBase, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the blacklist. - domainFinalBlacklist.add(domainEntry) + // Add the entry to the block list. + domainFinalBlockList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain final blacklist added: " + domain + " , " + entryBase + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain final block list added: " + domain + " , " + entryBase + " - " + originalFilterListEntry) } - } else if (entry.contains("\\")) { // Process a domain regular expression blacklist entry. + } else if (entry.contains("\\")) { // Domain regular expression block list entry. // Create an entry string array. - val domainEntry = arrayOf(domain, entry, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the blacklist. - domainRegularExpressionBlacklist.add(domainEntry) + // Add the entry to the block list. + domainRegularExpressionBlockList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain regular expression blacklist added: " + domain + " , " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain regular expression block list added: " + domain + " , " + entry + " - " + originalFilterListEntry) } else if (entry.contains("*")) { // There are two or more entries. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -1177,7 +1226,8 @@ class ParseBlocklistHelper { val firstEntry = entry.substring(0, wildcardIndex) val secondEntry = entry.substring(wildcardIndex + 1) - if (secondEntry.contains("*")) { // Process a domain blacklist triple entry. + // Process the second entry. + if (secondEntry.contains("*")) { // Process a domain block list triple entry. // Get the index of the wildcard. val secondWildcardIndex = secondEntry.indexOf("*") @@ -1186,95 +1236,95 @@ class ParseBlocklistHelper { val thirdEntry = secondEntry.substring(secondWildcardIndex + 1) // Create an entry string array. - val domainTripleEntry = arrayOf(domain, firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry) + val domainTripleEntry = arrayOf(domain, firstEntry, realSecondEntry, thirdEntry, originalFilterListEntry) - // Add the entry to the blacklist. - domainBlacklist.add(domainTripleEntry) + // Add the entry to the block list. + domainBlockList.add(domainTripleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain blacklist added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + - // " - " + originalBlocklistEntry); - } else { // Process a domain blacklist double entry. + //Log.i("FilterLists", headers.get(1)[0] + " domain block list added: " + domain + " , " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + + // " - " + originalFilterListEntry) + } else { // Process a domain block list double entry. // Create an entry string array. - val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalBlocklistEntry) + val domainDoubleEntry = arrayOf(domain, firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - domainBlacklist.add(domainDoubleEntry) + // Add the entry to the block list. + domainBlockList.add(domainDoubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain blacklist added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + - // originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain block list added: " + domain + " , " + firstEntry + " , " + secondEntry + " - " + + // originalFilterListEntry) } - } else { // Process a domain blacklist single entry. + } else { // Process a domain block list single entry. // Create an entry string array. - val domainEntry = arrayOf(domain, entry, originalBlocklistEntry) + val domainEntry = arrayOf(domain, entry, originalFilterListEntry) - // Add the entry to the blacklist. - domainBlacklist.add(domainEntry) + // Add the entry to the block list. + domainBlockList.add(domainEntry) - //Log.i("Blocklists", headers.get(1)[0] + " domain blacklist added: " + domain + " , " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " domain block list added: " + domain + " , " + entry + " - " + originalFilterListEntry) } + // Repeat until all the domains have been processed. } while (domains.contains("|")) } } - } else if (blocklistEntry.contains("~")) { // Whitelist entries. Privacy Browser does not differentiate against these filter options, so they are just generally whitelisted. + } else if (filterListEntry.contains("~")) { // Allow list entries. Privacy Browser does not differentiate against these filter options, so they are just generally allowed. // Remove the filter options. - blocklistEntry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) + filterListEntry = filterListEntry.substring(0, filterListEntry.indexOf("$")) // Strip any trailing `*`. - if (blocklistEntry.endsWith("*")) { - blocklistEntry = blocklistEntry.substring(0, blocklistEntry.length - 1) - } + if (filterListEntry.endsWith("*")) + filterListEntry = filterListEntry.substring(0, filterListEntry.length - 1) - if (blocklistEntry.contains("*")) { // Process a whitelist double entry. + // Process the entry. + if (filterListEntry.contains("*")) { // Allow list double entry. // Get the index of the wildcard. - val wildcardIndex = blocklistEntry.indexOf("*") + val wildcardIndex = filterListEntry.indexOf("*") // Split the entry into components. - val firstEntry = blocklistEntry.substring(0, wildcardIndex) - val secondEntry = blocklistEntry.substring(wildcardIndex + 1) + val firstEntry = filterListEntry.substring(0, wildcardIndex) + val secondEntry = filterListEntry.substring(wildcardIndex + 1) // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the whitelist. - mainWhitelist.add(doubleEntry) + // Add the entry to the allow list. + mainAllowList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main whitelist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); - } else { // Process a whitelist single entry. + //Log.i("FilterLists", headers.get(1)[0] + " main allow list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) + } else { // Allow list single entry. // Create an entry string array. - val singleEntry = arrayOf(blocklistEntry, originalBlocklistEntry) + val singleEntry = arrayOf(filterListEntry, originalFilterListEntry) - // Add the entry to the whitelist. - mainWhitelist.add(singleEntry) + // Add the entry to the allow list. + mainAllowList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main whitelist added: " + blocklistEntry + " - + " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " main allow list added: " + filterListEntry + " - + " + originalFilterListEntry) } - } else if (blocklistEntry.contains("\\")) { // Process a regular expression blacklist entry. + } else if (filterListEntry.contains("\\")) { // Regular expression block list entry. // Remove the filter options. - blocklistEntry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) + filterListEntry = filterListEntry.substring(0, filterListEntry.indexOf("$")) // Create an entry string array. - val singleEntry = arrayOf(blocklistEntry, originalBlocklistEntry) + val singleEntry = arrayOf(filterListEntry, originalFilterListEntry) - // Add the entry to the blacklist. - regularExpressionBlacklist.add(singleEntry) + // Add the entry to the block list. + regularExpressionBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " regular expression blacklist added: " + blocklistEntry + " - " + originalBlocklistEntry); - } else { // Blacklist entries. + //Log.i("FilterLists", headers.get(1)[0] + " regular expression block list added: " + filterListEntry + " - " + originalFilterListEntry); + } else { // Block list entries. // Remove the filter options. - if (!blocklistEntry.contains("\$file")) { // EasyPrivacy contains an entry with `$file` that does not have filter options. - blocklistEntry = blocklistEntry.substring(0, blocklistEntry.indexOf("$")) - } + if (!filterListEntry.contains("\$file")) // EasyPrivacy contains an entry with `$file` that does not have filter options. + filterListEntry = filterListEntry.substring(0, filterListEntry.indexOf("$")) // Strip any trailing `*`. These are redundant. - if (blocklistEntry.endsWith("*")) { - blocklistEntry = blocklistEntry.substring(0, blocklistEntry.length - 1) - } + if (filterListEntry.endsWith("*")) + filterListEntry = filterListEntry.substring(0, filterListEntry.length - 1) - if (blocklistEntry.startsWith("|")) { // Initial blacklist entries. + // Process the entry. + if (filterListEntry.startsWith("|")) { // Initial block list entries. // Strip the initial `|`. - val entry = blocklistEntry.substring(1) + val entry = filterListEntry.substring(1) - if (entry.contains("*")) { // Process an initial blacklist double entry. + if (entry.contains("*")) { // Process an initial block list double entry. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -1283,27 +1333,28 @@ class ParseBlocklistHelper { val secondEntry = entry.substring(wildcardIndex + 1) // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - initialBlacklist.add(doubleEntry) + // Add the entry to the block list. + initialBlockList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " initial blacklist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); - } else { // Process an initial blacklist single entry. + //Log.i("FilterLists", headers.get(1)[0] + " initial block list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) + } else { // Initial blocklist single entry. // Create an entry string array. - val singleEntry = arrayOf(entry, originalBlocklistEntry) + val singleEntry = arrayOf(entry, originalFilterListEntry) - // Add the entry to the blacklist. - initialBlacklist.add(singleEntry) + // Add the entry to the block list. + initialBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " initial blacklist added: " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " initial block list added: " + entry + " - " + originalFilterListEntry) } - } else if (blocklistEntry.endsWith("|")) { // Final blacklist entries. + } else if (filterListEntry.endsWith("|")) { // Final block list entries. // Ignore entries with `object` filters. They can block entire websites and don't have any meaning in the context of Privacy Browser. - if (!originalBlocklistEntry.contains("\$object")) { + if (!originalFilterListEntry.contains("\$object")) { // Strip the final `|`. - val entry = blocklistEntry.substring(0, blocklistEntry.length - 1) + val entry = filterListEntry.substring(0, filterListEntry.length - 1) + // Process the entry. if (entry.contains("*")) { // There are two or more entries. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -1312,7 +1363,8 @@ class ParseBlocklistHelper { val firstEntry = entry.substring(0, wildcardIndex) val secondEntry = entry.substring(wildcardIndex + 1) - if (secondEntry.contains("*")) { // Process a final blacklist triple entry. + // Process the second entry. + if (secondEntry.contains("*")) { // Final block list triple entry. // Get the index of the wildcard. val secondWildcardIndex = secondEntry.indexOf("*") @@ -1321,41 +1373,41 @@ class ParseBlocklistHelper { val thirdEntry = secondEntry.substring(secondWildcardIndex + 1) // Create an entry string array. - val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry) + val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalFilterListEntry) - // Add the entry to the blacklist. - finalBlacklist.add(tripleEntry) + // Add the entry to the block list. + finalBlockList.add(tripleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " final blacklist added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + - // originalBlocklistEntry); - } else { // Process a final blacklist double entry. + //Log.i("FilterLists", headers.get(1)[0] + " final block list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + originalFilterListEntry) + } else { // Final block list double entry. // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - finalBlacklist.add(doubleEntry) + // Add the entry to the block list. + finalBlockList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " final blacklist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " final block list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) } - } else { // Process a final blacklist single entry. + } else { // Final block list single entry. // Create an entry sting array. - val singleEntry = arrayOf(entry, originalBlocklistEntry) + val singleEntry = arrayOf(entry, originalFilterListEntry) - // Add the entry to the blacklist. - finalBlacklist.add(singleEntry) + // Add the entry to the block list. + finalBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " final blacklist added: " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " final block list added: " + entry + " - " + originalFilterListEntry) } } - } else if (blocklistEntry.contains("*")) { // There are two or more entries. + } else if (filterListEntry.contains("*")) { // There are two or more entries. // Get the index of the wildcard. - val wildcardIndex = blocklistEntry.indexOf("*") + val wildcardIndex = filterListEntry.indexOf("*") // Split the entry into components. - val firstEntry = blocklistEntry.substring(0, wildcardIndex) - val secondEntry = blocklistEntry.substring(wildcardIndex + 1) + val firstEntry = filterListEntry.substring(0, wildcardIndex) + val secondEntry = filterListEntry.substring(wildcardIndex + 1) - if (secondEntry.contains("*")) { // Process a main blacklist triple entry. + // Process the second entry. + if (secondEntry.contains("*")) { // Main block list triple entry. // Get the index of the wildcard. val secondWildcardIndex = secondEntry.indexOf("*") @@ -1364,52 +1416,51 @@ class ParseBlocklistHelper { val thirdEntry = secondEntry.substring(secondWildcardIndex + 1) // Create an entry string array. - val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry) + val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalFilterListEntry) - // Add the entry to the blacklist. - mainBlacklist.add(tripleEntry) + // Add the entry to the block list. + mainBlockList.add(tripleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main blacklist added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + originalBlocklistEntry); - } else { // Process a main blacklist double entry. + //Log.i("FilterLists", headers.get(1)[0] + " main block list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + originalFilterListEntry) + } else { // Main block list double entry. // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - mainBlacklist.add(doubleEntry) + // Add the entry to the block list. + mainBlockList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main blacklist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " main block list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) } - } else { // Process a main blacklist single entry. + } else { // Main block list single entry. // Create an entry string array. - val singleEntry = arrayOf(blocklistEntry, originalBlocklistEntry) + val singleEntry = arrayOf(filterListEntry, originalFilterListEntry) - // Add the entry to the blacklist. - mainBlacklist.add(singleEntry) + // Add the entry to the block list. + mainBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main blacklist added: " + blocklistEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " main block list added: " + filterListEntry + " - " + originalFilterListEntry) } } - } else { // Main blacklist entries + } else { // Main block list entries. // Strip out any initial `||`. These will be treated like any other entry. - if (blocklistEntry.startsWith("||")) { - blocklistEntry = blocklistEntry.substring(2) - } + if (filterListEntry.startsWith("||")) + filterListEntry = filterListEntry.substring(2) // Strip out any initial `*`. - if (blocklistEntry.startsWith("*")) { - blocklistEntry = blocklistEntry.substring(1) - } + if (filterListEntry.startsWith("*")) + filterListEntry = filterListEntry.substring(1) // Strip out any trailing `*`. - if (blocklistEntry.endsWith("*")) { - blocklistEntry = blocklistEntry.substring(0, blocklistEntry.length - 1) - } + if (filterListEntry.endsWith("*")) + filterListEntry = filterListEntry.substring(0, filterListEntry.length - 1) - if (blocklistEntry.startsWith("|")) { // Initial blacklist entries. + // Process the entry. + if (filterListEntry.startsWith("|")) { // Initial block list entries. // Strip the initial `|`. - val entry = blocklistEntry.substring(1) + val entry = filterListEntry.substring(1) - if (entry.contains("*")) { // Process an initial blacklist double entry. + // Process the entry. + if (entry.contains("*")) { // Initial block list double entry. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -1418,25 +1469,26 @@ class ParseBlocklistHelper { val secondEntry = entry.substring(wildcardIndex + 1) // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - initialBlacklist.add(doubleEntry) + // Add the entry to the block list. + initialBlockList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " initial blacklist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); - } else { // Process an initial blacklist single entry. + //Log.i("FilterLists", headers.get(1)[0] + " initial block list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) + } else { // Initial block list single entry. // Create an entry string array. - val singleEntry = arrayOf(entry, originalBlocklistEntry) + val singleEntry = arrayOf(entry, originalFilterListEntry) - // Add the entry to the blacklist. - initialBlacklist.add(singleEntry) + // Add the entry to the block list. + initialBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " initial blacklist added: " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " initial block list added: " + entry + " - " + originalFilterListEntry) } - } else if (blocklistEntry.endsWith("|")) { // Final blacklist entries. + } else if (filterListEntry.endsWith("|")) { // Final block list entries. // Strip the final `|`. - val entry = blocklistEntry.substring(0, blocklistEntry.length - 1) + val entry = filterListEntry.substring(0, filterListEntry.length - 1) + // Process the entry. if (entry.contains("*")) { // There are two or more entries. // Get the index of the wildcard. val wildcardIndex = entry.indexOf("*") @@ -1445,7 +1497,8 @@ class ParseBlocklistHelper { val firstEntry = entry.substring(0, wildcardIndex) val secondEntry = entry.substring(wildcardIndex + 1) - if (secondEntry.contains("*")) { // Process a final blacklist triple entry. + // Process the second entry. + if (secondEntry.contains("*")) { // Final block list triple entry. // Get the index of the wildcard. val secondWildcardIndex = secondEntry.indexOf("*") @@ -1454,39 +1507,40 @@ class ParseBlocklistHelper { val thirdEntry = secondEntry.substring(secondWildcardIndex + 1) // Create an entry string array. - val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry) + val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalFilterListEntry) - // Add the entry to the blacklist. - finalBlacklist.add(tripleEntry) + // Add the entry to the block list. + finalBlockList.add(tripleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " final blacklist added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + originalBlocklistEntry); - } else { // Process a final blacklist double entry. + //Log.i("FilterLists", headers.get(1)[0] + " final block list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + originalFilterListEntry) + } else { // Final block list double entry. // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - finalBlacklist.add(doubleEntry) + // Add the entry to the block list. + finalBlockList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " final blacklist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " final block list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) } - } else { // Process a final blacklist single entry. + } else { // Final block list single entry. // Create an entry string array. - val singleEntry = arrayOf(entry, originalBlocklistEntry) + val singleEntry = arrayOf(entry, originalFilterListEntry) - // Add the entry to the blacklist. - finalBlacklist.add(singleEntry) + // Add the entry to the block list. + finalBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " final blacklist added: " + entry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " final block list added: " + entry + " - " + originalFilterListEntry) } - } else { // Main blacklist entries. - if (blocklistEntry.contains("*")) { // There are two or more entries. + } else { // Main block list entries. + if (filterListEntry.contains("*")) { // There are two or more entries. // Get the index of the wildcard. - val wildcardIndex = blocklistEntry.indexOf("*") + val wildcardIndex = filterListEntry.indexOf("*") // Split the entry into components. - val firstEntry = blocklistEntry.substring(0, wildcardIndex) - val secondEntry = blocklistEntry.substring(wildcardIndex + 1) + val firstEntry = filterListEntry.substring(0, wildcardIndex) + val secondEntry = filterListEntry.substring(wildcardIndex + 1) + // Process the second entry. if (secondEntry.contains("*")) { // There are three or more entries. // Get the index of the wildcard. val secondWildcardIndex = secondEntry.indexOf("*") @@ -1495,6 +1549,7 @@ class ParseBlocklistHelper { val realSecondEntry = secondEntry.substring(0, secondWildcardIndex) val thirdEntry = secondEntry.substring(secondWildcardIndex + 1) + // Process the third entry. if (thirdEntry.contains("*")) { // There are four or more entries. // Get the index of the wildcard. val thirdWildcardIndex = thirdEntry.indexOf("*") @@ -1503,7 +1558,8 @@ class ParseBlocklistHelper { val realThirdEntry = thirdEntry.substring(0, thirdWildcardIndex) val fourthEntry = thirdEntry.substring(thirdWildcardIndex + 1) - if (fourthEntry.contains("*")) { // Process a main blacklist quintuple entry. + // Process the fourth entry. + if (fourthEntry.contains("*")) { // Main block list quintuple entry. // Get the index of the wildcard. val fourthWildcardIndex = fourthEntry.indexOf("*") @@ -1512,57 +1568,57 @@ class ParseBlocklistHelper { val fifthEntry = fourthEntry.substring(fourthWildcardIndex + 1) // Create an entry string array. - val quintupleEntry = arrayOf(firstEntry, realSecondEntry, realThirdEntry, realFourthEntry, fifthEntry, originalBlocklistEntry) + val quintupleEntry = arrayOf(firstEntry, realSecondEntry, realThirdEntry, realFourthEntry, fifthEntry, originalFilterListEntry) - // Add the entry to the blacklist. - mainBlacklist.add(quintupleEntry) + // Add the entry to the block list. + mainBlockList.add(quintupleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main blacklist added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " + realFourthEntry + " , " + - // fifthEntry + " - " + originalBlocklistEntry); - } else { // Process a main blacklist quadruple entry. + //Log.i("FilterLists", headers.get(1)[0] + " main block list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " + realFourthEntry + " , " + + // fifthEntry + " - " + originalFilterListEntry) + } else { // Main block list quadruple entry. // Create an entry string array. - val quadrupleEntry = arrayOf(firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalBlocklistEntry) + val quadrupleEntry = arrayOf(firstEntry, realSecondEntry, realThirdEntry, fourthEntry, originalFilterListEntry) - // Add the entry to the blacklist. - mainBlacklist.add(quadrupleEntry) + // Add the entry to the block list. + mainBlockList.add(quadrupleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main blacklist added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " + fourthEntry + " - " + - // originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " main block list added: " + firstEntry + " , " + realSecondEntry + " , " + realThirdEntry + " , " + fourthEntry + " - " + + // originalFilterListEntry) } - } else { // Process a main blacklist triple entry. + } else { // Main block list triple entry. // Create an entry string array. - val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalBlocklistEntry) + val tripleEntry = arrayOf(firstEntry, realSecondEntry, thirdEntry, originalFilterListEntry) - // Add the entry to the blacklist. - mainBlacklist.add(tripleEntry) + // Add the entry to the block list. + mainBlockList.add(tripleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main blacklist added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " main block list added: " + firstEntry + " , " + realSecondEntry + " , " + thirdEntry + " - " + originalFilterListEntry) } - } else { // Process a main blacklist double entry. + } else { // Main block list double entry. // Create an entry string array. - val doubleEntry = arrayOf(firstEntry, secondEntry, originalBlocklistEntry) + val doubleEntry = arrayOf(firstEntry, secondEntry, originalFilterListEntry) - // Add the entry to the blacklist. - mainBlacklist.add(doubleEntry) + // Add the entry to the block list. + mainBlockList.add(doubleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main blacklist added: " + firstEntry + " , " + secondEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " main block list added: " + firstEntry + " , " + secondEntry + " - " + originalFilterListEntry) } - } else { // Process a main blacklist single entry. + } else { // Main block list single entry. // Create an entry string array. - val singleEntry = arrayOf(blocklistEntry, originalBlocklistEntry) + val singleEntry = arrayOf(filterListEntry, originalFilterListEntry) - // Add the entry to the blacklist. - mainBlacklist.add(singleEntry) + // Add the entry to the block list. + mainBlockList.add(singleEntry) - //Log.i("Blocklists", headers.get(1)[0] + " main blacklist added: " + blocklistEntry + " - " + originalBlocklistEntry); + //Log.i("FilterLists", headers.get(1)[0] + " main block list added: " + filterListEntry + " - " + originalFilterListEntry) } } } } - // Close `bufferedReader`. + // Close the buffered reader. bufferedReader.close() } catch (e: IOException) { - // The asset exists, so the `IOException` will never be thrown. + // Do nothing. } // Initialize the combined list. @@ -1571,31 +1627,31 @@ class ParseBlocklistHelper { // Add the headers (0). combinedLists.add(headers) // 0. - // Add the whitelists (1-8). - combinedLists.add(mainWhitelist) // 1. - combinedLists.add(finalWhitelist) // 2. - combinedLists.add(domainWhitelist) // 3. - combinedLists.add(domainInitialWhitelist) // 4. - combinedLists.add(domainFinalWhitelist) // 5. - combinedLists.add(thirdPartyWhitelist) // 6. - combinedLists.add(thirdPartyDomainWhitelist) // 7. - combinedLists.add(thirdPartyDomainInitialWhitelist) // 8. - - // Add the blacklists (9-22). - combinedLists.add(mainBlacklist) // 9. - combinedLists.add(initialBlacklist) // 10. - combinedLists.add(finalBlacklist) // 11. - combinedLists.add(domainBlacklist) // 12. - combinedLists.add(domainInitialBlacklist) // 13. - combinedLists.add(domainFinalBlacklist) // 14. - combinedLists.add(domainRegularExpressionBlacklist) // 15. - combinedLists.add(thirdPartyBlacklist) // 16. - combinedLists.add(thirdPartyInitialBlacklist) // 17. - combinedLists.add(thirdPartyDomainBlacklist) // 18. - combinedLists.add(thirdPartyDomainInitialBlacklist) // 19. - combinedLists.add(thirdPartyRegularExpressionBlacklist) // 20. - combinedLists.add(thirdPartyDomainRegularExpressionBlacklist) // 21. - combinedLists.add(regularExpressionBlacklist) // 22. + // Add the allow lists (1-8). + combinedLists.add(mainAllowList) // 1. + combinedLists.add(finalAllowList) // 2. + combinedLists.add(domainAllowList) // 3. + combinedLists.add(domainInitialAllowList) // 4. + combinedLists.add(domainFinalAllowList) // 5. + combinedLists.add(thirdPartyAllowList) // 6. + combinedLists.add(thirdPartyDomainAllowList) // 7. + combinedLists.add(thirdPartyDomainInitialAllowList) // 8. + + // Add the block lists (9-22). + combinedLists.add(mainBlockList) // 9. + combinedLists.add(initialBlockList) // 10. + combinedLists.add(finalBlockList) // 11. + combinedLists.add(domainBlockList) // 12. + combinedLists.add(domainInitialBlockList) // 13. + combinedLists.add(domainFinalBlockList) // 14. + combinedLists.add(domainRegularExpressionBlockList) // 15. + combinedLists.add(thirdPartyBlockList) // 16. + combinedLists.add(thirdPartyInitialBlockList) // 17. + combinedLists.add(thirdPartyDomainBlockList) // 18. + combinedLists.add(thirdPartyDomainInitialBlockList) // 19. + combinedLists.add(thirdPartyRegularExpressionBlockList) // 20. + combinedLists.add(thirdPartyDomainRegularExpressionBlockList) // 21. + combinedLists.add(regularExpressionBlockList) // 22. // Return the combined lists. return combinedLists diff --git a/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt b/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt index aa2ea098..ee1d62fe 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.kt @@ -259,9 +259,9 @@ class NestedScrollWebView @JvmOverloads constructor(context: Context, attributeS // Resource request counters. - fun incrementRequestsCount(blocklist: Int) { - // Increment the count of the indicated blocklist. - when (blocklist) { + fun incrementRequestsCount(filterList: Int) { + // Increment the count of the indicated filter list. + when (filterList) { BLOCKED_REQUESTS -> blockedRequests++ EASYLIST -> easyListBlockedRequests++ EASYPRIVACY -> easyPrivacyBlockedRequests++ @@ -273,9 +273,9 @@ class NestedScrollWebView @JvmOverloads constructor(context: Context, attributeS } } - fun getRequestsCount(blocklist: Int): Int { - // Return the count of the indicated blocklist. - return when (blocklist) { + fun getRequestsCount(filterList: Int): Int { + // Return the count of the indicated filter list. + return when (filterList) { BLOCKED_REQUESTS -> blockedRequests EASYLIST -> easyListBlockedRequests EASYPRIVACY -> easyPrivacyBlockedRequests diff --git a/app/src/main/res/layout/about_version_scrollview.xml b/app/src/main/res/layout/about_version_scrollview.xml index 8d5da980..7c2d7d5f 100644 --- a/app/src/main/res/layout/about_version_scrollview.xml +++ b/app/src/main/res/layout/about_version_scrollview.xml @@ -1,7 +1,7 @@ + + @@ -215,7 +215,7 @@ tools:ignore="contentDescription" /> + @@ -218,7 +218,7 @@ tools:ignore="contentDescription" /> + - + - + + Lade EasyList Lade EasyPrivacy Lade Fanboy’s Annoyance Filterliste @@ -292,32 +292,7 @@ blockiert %1$d. blockiert blockiert - Filterliste Unterliste - Haupt-Positivliste - finale Positivliste - Domänen-Positivliste - Domänen-Positivliste (URL-Anfang) - Domänen-Positivliste (URL-Ende) - Drittanbieter-Positivliste - Drittanbieter-Domänen-Positivliste - Drittanbieter-Domänen-Positivliste (URL-Anfang) - Haupt-Negativliste - Negativliste (URL-Anfang) - Negativliste (URL-Ende) - Domänen-Negativliste - Domänen-Negativliste (URL-Anfang) - Domänen-Negativliste (URL-Ende) - Domänen-Negativliste mit regulären Ausdrücken - Drittanbieter-Negativliste - Drittanbieter-Negativliste (URL-Anfang) - Drittanbieter-Domänen-Negativliste - Drittanbieter-Domänen-Negativliste (URL-Anfang) - Drittanbieter-Negativliste mit regulären Ausdrücken - Drittanbieter-Domänen-Negativliste mit regulären Ausdrücken - Negativliste mit regulären Ausdrücken - Negativlisten-Einträge - Negativlisten-Original-Eintrag Domains @@ -507,19 +482,12 @@ Im Incognito-Modus schließt \'Zurück\'-Button den aktive Tab (oder die App, wenn nur ein Tab geöffnet wurde). Screenshots zulassen Screenshots, Bildschirmvideos und Anzeige auf unsicheren Bildschirmen zulassen. Eine Änderung dieser Einstellung startet Privacy Browser neu. - Sperrlisten EasyList - Haupt-Sperrliste gegen Werbung. EasyPrivacy - Haupt-Sperrliste gegen Tracker. Fanboy’s Annoyance Sperrliste - Blockiert nervende PopUps und Links. Enthält Fanboy’s Social Blocking Sperrliste. Fanboy’s Social Blocking Sperrliste - Blockiert Social-Media-Inhalte von Drittanbietern. UltraList - UltraList blockiert Werbung, die von EasyList nicht blockiert wird, da dies Webseiten verunstalten kann. UltraPrivacy - UltraPrivacy blockiert Tracker, die von EasyPrivacy nicht blockiert werden, da dies Webseiten verunstalten kann. Alle Zugriffe auf Dritt-Anbieter-Inhalte blockieren Alle Zugriffe auf Dritt-Anbieter-Inhalte zu blockieren verbessert die Privatsphäre, kann jedoch Webseiten verunstalten. URL-Bereinigung diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index b53b510a..051ab888 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -52,7 +52,7 @@ Error:\u0020 %1$s Aplicar - + Cargando EasyList Cargando EasyPrivacy Cargando la lista molesta de Fanboy @@ -289,32 +289,7 @@ Bloqueada %1$d. Bloqueada Bloqueadas - Lista de bloqueo Sublista - Lista blanca principal - Lista blanca final - Lista blanca de dominios - Lista blanca inicial de dominios - Lista blanca final de dominios - Lista blanca de terceros - Lista blanca de dominios de terceros - Lista blanca inicial de dominios de terceros - Lista negra principal - Lista negra inicial - Lista negra final - Lista negra de dominios - Lista negra inicial de dominios - Lista negra final de dominios - Lista negra de expresiones regulares de dominios - Lista negra de terceros - Lista negra inicial de terceros - Lista negra de dominios de terceros - Lista negra inicial de dominios de terceros - Lista negra de expresiones regulares de terceros - Lista negra de expresiones regulares de dominios de terceros - Lista negra de expresiones regulares - Entradas de la lista de bloqueo - Entrada original de la lista de bloqueo Dominios @@ -504,19 +479,12 @@ En el modo Incógnito, Atrás cierra la pestaña (o la app si hay solo una pestaña). Permitir capturas de pantalla Permitir capturas de pantalla, grabación de vídeo y visualización en pantallas inseguras. Cambiar esta configuración reiniciará Navegador Privado. - Listas de bloqueo EasyList - Lista principal de bloqueo de anuncios. EasyPrivacy - Lista principal de bloqueo de rastreadores. Lista molesta de Fanboy - Bloquear popups y enlaces molestos. Incluye la lista de bloqueo social de Fanboy. Lista de bloqueo social de Fanboy - Bloquear contenidos de medios sociales de terceros. UltraList - UltraList bloquea los anuncios que EasyList no bloquea, porque al hacerlo puede romper páginas web. Ultra Privacidad - Ultra Privacidad bloquea los rastreadores que no bloquea EasyPrivacy, porque al hacerlo puede romper páginas web. Bloquear todas las solicitudes de terceras partes Bloquear todas las solicitudes de terceras partes aumenta la privacidad, pero rompe muchas páginas web. Modificación de URL diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 0a5de44a..b0d7f403 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -52,7 +52,7 @@ Erreur : %1$s Appliquer - + Chargement EasyList Chargement EasyPrivacy Chargement Fanboy’s Annoyance List @@ -288,32 +288,7 @@ Bloquée %1$d. Bloquée Bloquées - Liste noires Sous-listes - Main whitelist - Final whitelist - Domain whitelist - Domain initial whitelist - Domain final whitelist - Third-party whitelist - Third-party domain whitelist - Third-party domain initial whitelist - Main blacklist - Initial blacklist - Final blacklist - Domain blacklist - Domain initial blacklist - Domain final blacklist - Domain regular expression blacklist - Third-party blacklist - Third-party initial blacklist - Third-party domain blacklist - Third-party domain initial blacklist - Third-party regular expression blacklist - Third-party domain regular expression blacklist - Regular expression blacklist - Blocklist entries - Blocklist original entry Domaines @@ -501,19 +476,12 @@ Dans le mode Incognito, le bouton Retour ferme l\'onglet (ou l\'application s\'il n\'y a qu\'un seul onglet). Autoriser captures d\'écrans Autoriser les captures d\'écrans, enregistrements vidéo et affichage sur des écrans non-sécurisés. Changer ce paramètre redémarrera Privacy Browser. - Listes noires EasyList - Liste principale pour les publicités. EasyPrivacy - Liste principale pour les traceurs. Fanboy’s annoyance list - Bloque pop-ups et liens gênants. Inclue Fanboy’s social blocking lists. Fanboy’s social blocking list - Bloque les contenus des médias sociaux tiers. UltraList - Bloque les publicités qu\'EasyList ne bloque pas car cela peut casser les sites Web UltraPrivacy - Bloque les pisteurs qu\'EasyPrivacy ne bloque pas car cela peut casser les sites Web. Bloquer toutes les requêtes tierces Le blocage de toutes les requêtes tierces augmente la vie privée, mais détruit de nombreux sites Web. Modifications d\'URL diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a09f99ee..c6d1976f 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -52,7 +52,7 @@ Errore:\u0020 %1$s Applica - + Caricamento EasyList Caricamento EasyPrivacy Caricamento Fanboy’s Annoyance List @@ -288,32 +288,7 @@ Bloccata %1$d. Bloccata Bloccate - Blocklist Sublist - Whitelist principale - Whitelist finale - Whitelist per i domini - Whitelist iniziale - Whitelist finale - Whitelist di terze parti - Whitelist di terze parti per i domini - Whitelist di terze parti iniziale per i domini - Blacklist principale - Blacklist iniziale - Blacklist finale - Blacklist per i domini - Blacklist iniziale - Blacklist finale - Blacklist per le espressioni regolari - Blacklist di terze parti - Blacklist di terze parti iniziale - Blacklist di terze parti per i domini - Blacklist di terze parti iniziale per i domini - Blacklist di terze parti per le espressioni regolari - Blacklist di terze parti per le espressioni regolari per i domini - Blacklist per le espressioni regolari - Elementi della Blocklist - Elemento originale della Blocklist Domini @@ -504,19 +479,12 @@ Permetti gli screenshot Permette gli screenshot, la registrazione di video, e la possibilità di visualizzare su schermi non sicuri. La modifica di questa impostazione provoca il riavvio di Privacy Browser. - Blocklist EasyList - Blocking list principale. EasyPrivacy - Tracker blocking list principale. Fanboy’s annoyance list - Blocca fastidiosi pop-up e collegamenti. Include le liste Fanboy’s social blocking. Fanboy’s social blocking list - Blocca contenuti di terze parti sui social media . UltraList - UltraList blocca gli annunci che EasyList non blocca per non impedire la visualizzazione dei siti web. UltraPrivacy - L\'UltraPrivacy blocca i tracciamenti che EasyPrivacy ignora perché potrebbero impedire la visualizzazione dei siti web. Blocca tutte le richieste di Terze Parti Il blocco di tutte le richieste di Terze Parti aumenta privacy, ma impedisce la visualizzazione di molti siti web. Modifica delle URL diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 75a04740..7176644e 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -51,7 +51,7 @@ Erro:\u0020 %1$s Aplicar - + Carregando EasyList Carregando EasyPrivacy Carregando Fanboy’s Annoyance List @@ -286,32 +286,7 @@ Bloqueado %1$d. Bloqueado Bloqueados - Lista de bloqueios Sublista - Lista de permissão principal - Lista de permissões final - Lista de permissões de domínio - Lista de permissões inicial do domínio - Lista de permissões final de domínio - Lista de permissões de terceiros - Lista de permissões de domínios de terceiros - Lista de permissões iniciais de domínios de terceiros - Lista de restrições principal - Lista de restrições inicial - Lista de restrições final - Lista de restrições de domínios - Lista de restrições inicial do domínio - Lista de restrições final do domínio - Lista de restrições de expressões regulares de domínio - Lista de restrições de terceiros - Lista de restrições inicial de terceiros - Lista de restrições de domínios de terceiros - Lista de restrições inicial de domínios de terceiros - Lista de restrições de expressões regulares de terceiros - Lista de restrições de expressões regulares de domínios de terceiros - Lista de restrições de expressões regulares - Entradas da lista de bloqueio - Entrada original da lista de bloqueio Domínios @@ -500,19 +475,12 @@ volta para fechar a guia (ou o aplicativo, se houver apenas uma guia). Permitir capturas de tela Permitir capturas de tela, gravação de vídeo e visualização em monitores não seguros. Alterar esta configuração irá reiniciar o Privacy Browser. - Blocklists EasyList - Lista principal de bloqueio de anúncios. EasyPrivacy - Lista de bloqueio do rastreador principal. Lista de importunação Fanboy - Bloqueie popups e links irritantes. Inclui listas de bloqueio social do Fanboy. Lista de bloqueio social do Fanboy - Bloqueia conteúdo de mídia social de terceiros. UltraList - O UltraList bloqueia anúncios que EasyList não bloqueia porque fazer isso pode quebrar sites. UltraPrivacy - O UltraPrivacy bloqueia rastreadores que o EasyPrivacy não bloqueia, pois isso pode corromper sites. Bloquear todas as solicitações de terceiros Bloquear todas as solicitações de terceiros aumenta a privacidade, mas quebra muitos sites. Modificação de URL diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index a76bbdab..d89f32d7 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -50,7 +50,7 @@ Ошибка:\u0020 %1$s Применить - + Загрузка EasyList Загрузка EasyPrivacy Загрузка Fanboy’s Annoyance List @@ -285,32 +285,7 @@ Блокирован %1$d. Блокирован Блокировано - Список блокировки Подсписок - Основной белый список - Конец белого списка - Белый список доменов - Начало белого списка доменов - Конец белого списка доменов - Сторонний белый список - Сторонний белый список доменов - Начало стороннего белого списка доменов - Основной черный список - Начало черного списка - Конец черного списка - Черный список доменов - Начало черного списка доменов - Конец черного списка доменов - Регулярные выражения черного списка доменов - Сторонний черный список - Начало стороннего черного списка доменов - Сторонний черный список доменов - Начало стороннего черного списка доменов - Регулярные выражения стороннего черного списка - Регулярные выражения стороннего черного списка доменов - Регулярные выражения черного списка - Записи списка блокировки - Исходная запись списка блокировки Домены @@ -500,19 +475,12 @@ В режиме инкогнито нажатие кнопки Назад приведет к закрытию вкладки (или приложения, если открыта только одна вкладка). Разрешить скриншоты Разрешить скриншоты, запись видео и просмотр на незащищенных дисплеях. При изменении этого параметра Privacy Browser будет перезапущен. - Списки блокировки EasyList - Основной список блокировки рекламы. EasyPrivacy - Основной список блокировки отслеживания. Fanboy’s annoyance list - Блокирует раздражающие всплывающие окна и ссылки. Включает в себя Fanboy’s social blocking lists. Fanboy’s social blocking list - Блокирует содержимое социальных сетей. UltraList - UltraList блокирует рекламу, которую пропускает EasyList, так как блокировка может сломать сайты. UltraPrivacy - UltraPrivacy блокирует трекеры, которые пропускает EasyPrivacy, чтобы не ломать веб-сайты. Блокировать все сторонние запросы Блокировка всех сторонних запросов повышает конфиденциальность, но ломает многие веб-сайты. Модификация URL diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index ec3e8a1c..8640a159 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -45,7 +45,7 @@ Yükleniyor… Hata:\u0020 %1$s - + EasyList yükleniyor EasyPrivacy yükleniyor Fanboy’s Annoyance List yükleniyor @@ -253,32 +253,7 @@ Engellendi %1$d. Engellendi Engellendi - Engel listesi Alt liste - Ana beyaz listesi - Final beyaz listesi - Domain beyaz listesi - Domain başlangıç beyaz listesi - Domain final beyaz listesi - Üçüncü taraf beyaz listesi - Üçüncü taraf domain beyaz listesi - Üçüncü taraf domain başlangıç beyaz listesi - Ana kara listesi - Başlangıç kara listesi - Final kara listesi - Domain kara listesi - Domain başlangıç kara listesi - Domain son kara listesi - Domain düzenli ifade kara listesi - Üçüncü taraf kara listesi - Üçüncü taraf başlangıç kara listesi - Üçüncü taraf domain kara listesi - Üçüncü taraf domain başlangıç kara listesi - Üçüncü taraf düzenli ifade kara listesi - Üçüncü taraf domain düzenli ifade kara listesi - Düzenli ifade kara listesi - Engel listesi girdileri - Engel listesi orijinal girdisi Domainler @@ -433,19 +408,12 @@ Ekran görüntülerine izin ver Ekran görüntülerine, video kaydına ve güvenli olmayan ekranlarda görüntülenmeye izin verir. Bu ayarı değiştirmek Privacy Browser uygulamasını yeniden başlatır. - Engel listesi EasyList - Ana reklam engelleme listesi. EasyPrivacy - Ana takipçi engelleme listesi. Fanboy’s Annoyance List - Rahatsız eden açılır pencereleri ve linkleri engeller. Fanboy’s Social Blocking listelerini de içerir. Fanboy’s Social Blocking List - Üçüncü taraf sosyal medya içeriklerini engeller. UltraList - UltraList, EasyList\'in engellemediği reklamları da engeller, bunu yapmak web sitelerinin çökmesine sebep olabilir. UltraPrivacy - UltraPrivacy, EasyPrivacy\'de olmayan takipçileri de engeller, fakat bu seçenek bazı web sitelerinin çökmesine sebep olabilir. Tüm üçüncü taraf istekleri engelle Tüm üçüncü taraf istekleri engellemek gizliliği arttırır, fakat çoğu web sitesinin çökmesine sebep olur. URL Modifikasyonu diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index dfb47f1a..95f94bee 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -56,7 +56,7 @@ 错误:\u0020 %1$s 请求 - + 加载 EasyList 加载 EasyPrivacy 加载 Fanboy’s Annoyance List @@ -290,32 +290,7 @@ 不允许 %1$d. 不允许 不允许 - 不允许名单 子表 - 关键词白名单 - 最后的白名单 - 域名白名单 - 域名白名单的开头 - 域名白名单的结尾 - 第三方白名单 - 第三方域名白名单 - 第三方域名白名单的开头 - 屏蔽关键词 - 屏蔽开头 - 屏蔽结尾 - 屏蔽域名 - 屏蔽域名的开头 - 屏蔽域名的结尾 - 域名黑名单正则表达式 - 屏蔽第三方 - 屏蔽第三方的开头 - 屏蔽第三方的域名 - 屏蔽第三方的域名的开头 - 第三方黑名单正则表达式 - 第三方域名黑名单正则表达式 - 黑名单的正则表达式 - 黑名单列表 - 最初的黑名单目录 域名 @@ -502,19 +477,12 @@ 在无痕模式中,关闭当前标签页,会清除所有的记录和网页上的痕迹. 允许截图 允许截图,录视频,在不安全的显示中查看,更改这个设置会重启本浏览器. - 黑名单 EasyList - 主要的广告屏蔽列表. EasyPrivacy - 主跟踪阻止列表. Fanboy’s annoyance list - 阻止弹窗和链接,包括Fanboy’s social 的黑名单 Fanboy’s social 黑名单 - 阻止社交媒体内容 UltraList - UltraList 屏蔽EasyList 不屏蔽的广告。这可能使网页崩溃 UltraPrivacy - UltraPrivacy 阻止EasyPrivacy泄露的跟踪器,这可能使网页崩溃 屏蔽第三方请求 屏蔽所有第三方包括隐私在内的请求,这会使许多网页崩溃。 修改网址 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 34ab9146..37e2554a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -58,7 +58,7 @@ Error:\u0020 %1$s Apply - + Loading EasyList Loading EasyPrivacy Loading Fanboy’s Annoyance List @@ -296,32 +296,32 @@ Blocked %1$d. Blocked Blocked - Blocklist + Filter list Sublist - Main whitelist - Final whitelist - Domain whitelist - Domain initial whitelist - Domain final whitelist - Third-party whitelist - Third-party domain whitelist - Third-party domain initial whitelist - Main blacklist - Initial blacklist - Final blacklist - Domain blacklist - Domain initial blacklist - Domain final blacklist - Domain regular expression blacklist - Third-party blacklist - Third-party initial blacklist - Third-party domain blacklist - Third-party domain initial blacklist - Third-party regular expression blacklist - Third-party domain regular expression blacklist - Regular expression blacklist - Blocklist entries - Blocklist original entry + Main allow list + Final allow list + Domain allow list + Domain initial allow list + Domain final allow list + Third-party allow list + Third-party domain allow list + Third-party domain initial allow list + Main block list + Initial block list + Final block list + Domain block list + Domain initial block list + Domain final block list + Domain regular expression block list + Third-party block list + Third-party initial block list + Third-party domain block list + Third-party domain initial block list + Third-party regular expression block list + Third-party domain regular expression block list + Regular expression block list + Filter list entries + Filter list original entry Domains @@ -540,19 +540,19 @@ Clear the history and cache after each webpage finishes loading. In Incognito Mode, back closes the tab (or the app if there is only one tab). Allow screenshots Allow screenshots, video recording, and viewing on non-secure displays. Changing this setting will restart Privacy Browser. - Blocklists + Filter Lists EasyList - Main ad blocking list. + Main ad filter list. EasyPrivacy - Main tracker blocking list. + Main tracker filter list. Fanboy’s annoyance list - Block annoying popups and links. Includes Fanboy’s social blocking lists. + Filter annoying popups and links. Includes Fanboy’s social blocking lists. Fanboy’s social blocking list - Blocks third-party social media content. + Filters third-party social media content. UltraList - UltraList blocks ads that EasyList doesn’t because doing so can break websites. + UltraList filters ads that EasyList doesn’t because doing so can break websites. UltraPrivacy - UltraPrivacy blocks trackers that EasyPrivacy doesn’t because doing so can break websites. + UltraPrivacy filters trackers that EasyPrivacy doesn’t because doing so can break websites. Block all third-party requests Blocking all third-party requests increases privacy, but it breaks many websites. URL Modification diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 49b346f6..076206bb 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -1,7 +1,7 @@