From: Soren Stoutner Date: Tue, 24 Jan 2017 22:45:43 +0000 (-0700) Subject: Pass cookies (if enabled) to download manager. This allows downloading of files... X-Git-Tag: v1.15~17 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=3326976f52dfb9ab06530128c8ef6bb4027b0391;p=PrivacyBrowserAndroid.git Pass cookies (if enabled) to download manager. This allows downloading of files from websites that require a login. Code submitted by Hendrik Knackstedt. Fixes https://redmine.stoutner.com/issues/73. --- diff --git a/.idea/dictionaries/soren.xml b/.idea/dictionaries/soren.xml index a3bba35f..b7560311 100644 --- a/.idea/dictionaries/soren.xml +++ b/.idea/dictionaries/soren.xml @@ -44,6 +44,7 @@ ipleak isfolder khtml + knackstedt konqueror linearlayout listview diff --git a/app/src/free/assets/es/about_privacy_policy.html b/app/src/free/assets/es/about_privacy_policy.html new file mode 100644 index 00000000..dfb197a7 --- /dev/null +++ b/app/src/free/assets/es/about_privacy_policy.html @@ -0,0 +1,122 @@ + + + + + + + + +

Privacy Browser Free

+

Privacy Browser Free does not collect any user information.

+ + +

Google Play

+

Google Play has its own privacy policy. + Google provides anonymized summary installation information to developers, including the number of + installs organized by the following categories. Stoutner may use this information for any purpose. + Reasonable effort is made to not use this information in a way that would make users uncomfortable.

+ + + +

Google Play Ratings

+

Google Play has its own privacy policy. + Google provides developers with anonymized summaries of the following information related to user ratings. + Stoutner may use this information for any purpose. Reasonable effort is made + to not use this information in a way that would make users uncomfortable.

+ + + +

Google Play Reviews

+

Google Play has its own privacy policy. + In addition to the name of the reviewer, the rating, and the text of the review (which are all available publicly), + Google provides some or all of the following information to the developer. Stoutner may + use this information for any purpose. Reasonable effort is made to not use this + information in a way that would make the reviewer uncomfortable.

+ + + +

Advertisements

+

Privacy Browser Free displays a banner ad across the bottom of the screen using Google's AdMob network, + which has its own privacy policy. + Note that unless you have opted out of interest-based ads, + the advertiser will receive a copy of your unique device advertising ID, which allows them to track your device across apps. + AdMob reports anonymized summaries of the following information to developers. + Stoutner may use this information for any purpose. Reasonable effort is made to + not use this information in a way that would make users uncomfortable.

+ + + +

Direct Communications

+

Users may choose to send direct communications to Stoutner, like email messages and comments on + stoutner.com. Stoutner may use this information + for any purpose. Reasonable effort is made to not use this information in a way that + would make the author uncomfortable.

+ +
+

Revision 1.3, 14 November 2016

+ + \ No newline at end of file diff --git a/app/src/free/assets/it/about_permissions.html b/app/src/free/assets/it/about_permissions.html new file mode 100644 index 00000000..fe278900 --- /dev/null +++ b/app/src/free/assets/it/about_permissions.html @@ -0,0 +1,59 @@ + + + + + + + + +

Have full network access

+

android.permission.INTERNET

+

Required for the WebView to access the internet. Without this permission, Privacy Browser would be “No Browser: Protecting Your Privacy by Staying Completely Off the Internet”.

+ +

Install shortcuts

+

com.android.launcher.permission.INSTALL_SHORTCUT

+

Required to add shortcuts for websites to the launcher desktop.

+ +
+
+
+ +

In addition, Privacy Browser Free displays ads from Google's AdMob network using the Firebase backend. For the free flavor, Firebase adds the following permissions even though they are not listed in the manifest file.

+ +

View network connections

+

android.permission.ACCESS_NETWORK_STATE

+

Allows the ads to tell when you are connected to the internet and when you aren't (presumably so they don't try to reload an ad when you are disconnected). They can also tell if you are connected via Wi-Fi, 2G, 3G, 4G, etc.

+ +

Prevent phone from sleeping

+

android.permission.WAKE_LOCK

+

Allows the ads to keep the processor from sleeping and the screen from dimming, although in my testing I don't think the ads actually do this.

+ +

Receive data from Internet

+

com.google.android.c2dm.permission.RECEIVE

+

Allows Google to send information directly to the AdView without having to receive a request first (cloud-to-device messaging).

+ +

Receive data from Internet

+

com.stoutner.privacybrowser.free.permission.C2D_MESSAGE

+

Secures the cloud-to-device messages so that only Privacy Browser Free can receive them.

+ + \ No newline at end of file diff --git a/app/src/free/assets/it/about_privacy_policy.html b/app/src/free/assets/it/about_privacy_policy.html new file mode 100644 index 00000000..54aba7b3 --- /dev/null +++ b/app/src/free/assets/it/about_privacy_policy.html @@ -0,0 +1,122 @@ + + + + + + + + +

Privacy Browser Free

+

Privacy Browser Free does not collect any user information.

+ + +

Google Play

+

Google Play has its own privacy policy. + Google provides anonymized summary installation information to developers, including the number of + installs organized by the following categories. Stoutner may use this information for any purpose. + Reasonable effort is made to not use this information in a way that would make users uncomfortable.

+ + + +

Google Play Ratings

+

Google Play has its own privacy policy. + Google provides developers with anonymized summaries of the following information related to user ratings. + Stoutner may use this information for any purpose. Reasonable effort is made + to not use this information in a way that would make users uncomfortable.

+ + + +

Google Play Reviews

+

Google Play has its own privacy policy. + In addition to the name of the reviewer, the rating, and the text of the review (which are all available publicly), + Google provides some or all of the following information to the developer. Stoutner may + use this information for any purpose. Reasonable effort is made to not use this + information in a way that would make the reviewer uncomfortable.

+ + + +

Advertisements

+

Privacy Browser Free displays a banner ad across the bottom of the screen using Google's AdMob network, + which has its own privacy policy. + Note that unless you have opted out of interest-based ads, + the advertiser will receive a copy of your unique device advertising ID, which allows them to track your device across apps. + AdMob reports anonymized summaries of the following information to developers. + Stoutner may use this information for any purpose. Reasonable effort is made to + not use this information in a way that would make users uncomfortable.

+ + + +

Direct Communications

+

Users may choose to send direct communications to Stoutner, like email messages and comments on + stoutner.com. Stoutner may use this information + for any purpose. Reasonable effort is made to not use this information in a way that + would make the author uncomfortable.

+ +
+

Revision 1.3, 14 November 2016

+ + \ No newline at end of file diff --git a/app/src/main/assets/de/about_contributors.html b/app/src/main/assets/de/about_contributors.html index 1cdf170c..059e90cd 100644 --- a/app/src/main/assets/de/about_contributors.html +++ b/app/src/main/assets/de/about_contributors.html @@ -22,27 +22,27 @@ . --> - - - - - -

Leitende Entwickler

- -

Privacy Browser ist primär entwickelt von Soren Stoutner.

- - -

Mitwirkende

- -

Aaron Gerlach: Deutsche Übersetzung

-

Jose A. León Becerra: Spanisch Übersetzung

-

Francesco Buratti: Italienisch Übersetzung

- -
-

Mitwirkung ist willkommen in Form von Code und Übersetzung.

- + + + + + +

Leitende Entwickler

+

Privacy Browser ist primär entwickelt von Soren Stoutner.

+ +

Coders

+ Hendrik Knackstedt + +

Mitwirkende

+

Aaron Gerlach: Deutsche Übersetzung

+

Jose A. León Becerra: Spanisch Übersetzung

+

Francesco Buratti: Italienisch Übersetzung

+ +
+

Mitwirkung ist willkommen in Form von Code und Übersetzung.

+ \ No newline at end of file diff --git a/app/src/main/assets/en/about_contributors.html b/app/src/main/assets/en/about_contributors.html index e8891020..afca9360 100644 --- a/app/src/main/assets/en/about_contributors.html +++ b/app/src/main/assets/en/about_contributors.html @@ -29,6 +29,8 @@

Principal Developer

Privacy Browser is primarily developed by Soren Stoutner.

+

Coders

+ Hendrik Knackstedt

Translators

Aaron Gerlach: German Translation
diff --git a/app/src/main/assets/es/about_contributors.html b/app/src/main/assets/es/about_contributors.html index 1d0074b4..2a3b29f0 100644 --- a/app/src/main/assets/es/about_contributors.html +++ b/app/src/main/assets/es/about_contributors.html @@ -27,12 +27,12 @@

Principle Developers

-

Privacy Browser is primarily developed by Soren Stoutner.

+

Coders

+ Hendrik Knackstedt

Contributors

-

Aaron Gerlach: German Translation

Jose A. León Becerra: Spanish Translation

Francesco Buratti: Italian Translation

diff --git a/app/src/main/assets/it/about_contributors.html b/app/src/main/assets/it/about_contributors.html index df5e4e28..e6635c13 100644 --- a/app/src/main/assets/it/about_contributors.html +++ b/app/src/main/assets/it/about_contributors.html @@ -31,6 +31,8 @@

Sviluppatori

Privacy Browser è sviluppato da Soren Stoutner.

+

Coders

+ Hendrik Knackstedt

Traduttori

Aaron Gerlach: Traduzione in Tedesco
diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebView.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebView.java index 26237d75..542a1baf 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebView.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebView.java @@ -1,6 +1,8 @@ /** * Copyright 2015-2017 Soren Stoutner . * + * Download cookie code contributed 2017 Hendrik Knackstedt. Copyright assigned to Soren Stoutner . + * * This file is part of Privacy Browser . * * Privacy Browser is free software: you can redistribute it and/or modify @@ -152,10 +154,10 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN // It is `Boolean` instead of `boolean` because `applySettings()` needs to know if it is `null`. private Boolean javaScriptEnabled; - // `firstPartyCookiesEnabled` is used in `onCreate()`, `onCreateOptionsMenu()`, `onPrepareOptionsMenu()`, `onOptionsItemSelected()`, and `applySettings()`. + // `firstPartyCookiesEnabled` is used in `onCreate()`, `onCreateOptionsMenu()`, `onPrepareOptionsMenu()`, `onOptionsItemSelected()`, `onDownloadImage()`, `onDownloadFile()`, and `applySettings()`. private boolean firstPartyCookiesEnabled; - // `thirdPartyCookiesEnabled` used in `onCreate()`, `onCreateOptionsMenu()`, `onPrepareOptionsMenu()`, `onOptionsItemSelected()`, and `applySettings()`. + // `thirdPartyCookiesEnabled` used in `onCreate()`, `onCreateOptionsMenu()`, `onPrepareOptionsMenu()`, `onOptionsItemSelected()`, `onDownloadImage()`, `onDownloadFile()`, and `applySettings()`. private boolean thirdPartyCookiesEnabled; // `domStorageEnabled` is used in `onCreate()`, `onCreateOptionsMenu()`, `onOptionsItemSelected()`, and `applySettings()`. @@ -1482,6 +1484,13 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN // Parse `imageUrl`. DownloadManager.Request downloadRequest = new DownloadManager.Request(Uri.parse(imageUrl)); + // Pass cookies to download manager if cookies are enabled. This is required to download item from websites that require a login. + if (firstPartyCookiesEnabled) { + String cookies = cookieManager.getCookie(imageUrl); + // In the HTTP request header, cookies are named `Cookie`. + downloadRequest.addRequestHeader("Cookie", cookies); + } + // Get the file name from `dialogFragment`. EditText downloadImageNameEditText = (EditText) dialogFragment.getDialog().findViewById(R.id.download_image_name); String imageName = downloadImageNameEditText.getText().toString(); @@ -1514,6 +1523,13 @@ public class MainWebView extends AppCompatActivity implements NavigationView.OnN // Parse `downloadUrl`. DownloadManager.Request downloadRequest = new DownloadManager.Request(Uri.parse(downloadUrl)); + // Pass cookies to download manager if cookies are enabled. This is required to download item from websites that require a login. + if (firstPartyCookiesEnabled) { + String cookies = cookieManager.getCookie(downloadUrl); + // In the HTTP request header, cookies are named `Cookie`. + downloadRequest.addRequestHeader("Cookie", cookies); + } + // Get the file name from `dialogFragment`. EditText downloadFileNameEditText = (EditText) dialogFragment.getDialog().findViewById(R.id.download_file_name); String fileName = downloadFileNameEditText.getText().toString();