From: Soren Stoutner Date: Fri, 12 Jul 2019 00:02:12 +0000 (-0700) Subject: Never block the resource request for the main URL. https://redmine.stoutner.com... X-Git-Tag: v3.2~9 X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=commitdiff_plain;h=de4e15cd445f2659165676e524a99f3c0f42033c Never block the resource request for the main URL. https://redmine.stoutner.com/issues/444 --- diff --git a/app/src/main/assets/tr/guide_requests_dark.html b/app/src/main/assets/tr/guide_requests_dark.html index 533a4199..41839b39 100644 --- a/app/src/main/assets/tr/guide_requests_dark.html +++ b/app/src/main/assets/tr/guide_requests_dark.html @@ -71,9 +71,9 @@ 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.

-

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'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. diff --git a/app/src/main/assets/tr/guide_requests_light.html b/app/src/main/assets/tr/guide_requests_light.html index 3039f39c..0331c508 100644 --- a/app/src/main/assets/tr/guide_requests_light.html +++ b/app/src/main/assets/tr/guide_requests_light.html @@ -71,9 +71,9 @@ 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.

-

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'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. diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index 097c8af9..d13c4d27 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -3591,6 +3591,9 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Store a copy of the current user agent to track changes for the return boolean. String initialUserAgent = nestedScrollWebView.getSettings().getUserAgentString(); + // Store the current URL. + nestedScrollWebView.setCurrentUrl(url); + // Parse the URL into a URI. Uri uri = Uri.parse(url); @@ -5344,6 +5347,12 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Check requests against the block lists. The deprecated `shouldInterceptRequest()` must be used until minimum API >= 21. @Override public WebResourceResponse shouldInterceptRequest(WebView view, String url) { + // Check to see if the resource request is for the main URL. + if (url.equals(nestedScrollWebView.getCurrentUrl())) { + // `return null` loads the resource request, which should never be blocked if it is the main URL. + 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. while (ultraPrivacy == null) { // The wait must be synchronized, which only lets one thread run on it at a time, or `java.lang.IllegalMonitorStateException` is thrown. diff --git a/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.java b/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.java index c7a22278..c7122cb8 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.java +++ b/app/src/main/java/com/stoutner/privacybrowser/views/NestedScrollWebView.java @@ -65,6 +65,9 @@ public class NestedScrollWebView extends WebView implements NestedScrollingChild private boolean domainSettingsApplied; private int domainSettingsDatabaseId; + // Keep track of the current URL. This is used to not block resource requests to the main URL. + private String currentUrl; + // Keep track of when the domain name changes so that domain settings can be reapplied. This should never be null. private String currentDomainName = ""; @@ -230,6 +233,18 @@ public class NestedScrollWebView extends WebView implements NestedScrollingChild } + // Current URL. + public void setCurrentUrl(String url) { + // Store the current URL. + currentUrl = url; + } + + public String getCurrentUrl() { + // Return the current URL. + return currentUrl; + } + + // Current domain name. To function well when called, the domain name should never be allowed to be null. public void setCurrentDomainName(@NonNull String domainName) { // Store the current domain name. diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index a429ebbe..219ecd2e 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -48,12 +48,14 @@ Sekmeyi kapa Yeni sekme Yükleniyor… + Hata: EasyList yükleniyor EasyPrivacy yükleniyor Fanboy’s Annoyance List yükleniyor Fanboy’s Social Blocking List yükleniyor + UltraList yükleniyor UltraPrivacy yükleniyor @@ -416,6 +418,7 @@ EasyPrivacy: Fanboy’s Annoyance List: Fanboy’s Social Blocking List: + UltraList: UltraPrivacy: Paket İmzası Yayınlayan DN: @@ -494,6 +497,8 @@ 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