From f761383fc4e5880360cd873c800d234a842d2c17 Mon Sep 17 00:00:00 2001 From: Anthony Restaino Date: Mon, 28 Sep 2015 20:36:04 -0400 Subject: [PATCH 1/7] Up version number, fix build error. --- .travis.yml | 2 +- app/build.gradle | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f769e4..b226663 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false android: components: - build-tools-22.0.1 - - build-tools-23.0.0 + - build-tools-23.0.1 - android-23 - android-22 - extra-android-support diff --git a/app/build.gradle b/app/build.gradle index 8453c1a..aaf4c35 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,7 +7,7 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 23 - versionName "4.2.0a" + versionName "4.2.1a" } sourceSets { lightningPlus.setRoot('src/LightningPlus') @@ -30,12 +30,12 @@ android { lightningPlus { buildConfigField "boolean", "FULL_VERSION", "true" applicationId "acr.browser.lightning" - versionCode 81 + versionCode 82 } lightningLite { buildConfigField "boolean", "FULL_VERSION", "false" applicationId "acr.browser.barebones" - versionCode 82 + versionCode 83 } } lintOptions { From a015d810ea527f72fb2aca3a398b26b42b05643c Mon Sep 17 00:00:00 2001 From: Anthony Restaino Date: Tue, 29 Sep 2015 07:42:56 -0400 Subject: [PATCH 2/7] Fix UI bug caused by obfuscation --- app/build.gradle | 6 +++--- app/proguard-project.txt | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index aaf4c35..070918d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,7 +7,7 @@ android { defaultConfig { minSdkVersion 14 targetSdkVersion 23 - versionName "4.2.1a" + versionName "4.2.2a" } sourceSets { lightningPlus.setRoot('src/LightningPlus') @@ -30,12 +30,12 @@ android { lightningPlus { buildConfigField "boolean", "FULL_VERSION", "true" applicationId "acr.browser.lightning" - versionCode 82 + versionCode 83 } lightningLite { buildConfigField "boolean", "FULL_VERSION", "false" applicationId "acr.browser.barebones" - versionCode 83 + versionCode 84 } } lintOptions { diff --git a/app/proguard-project.txt b/app/proguard-project.txt index edc15dc..40cddda 100644 --- a/app/proguard-project.txt +++ b/app/proguard-project.txt @@ -50,6 +50,18 @@ public static *** i(...); } +-keep class butterknife.** { *; } +-dontwarn butterknife.internal.** +-keep class **$$ViewBinder { *; } + +-keepclasseswithmembernames class * { + @butterknife.* ; +} + +-keepclasseswithmembernames class * { + @butterknife.* ; +} + # this will fix a force close in ReadingActivity -keep public class org.jsoup.** { public *; From 06e80ad5418a04871aea024b09714ae33d74bd3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=82osz=20Sieradzki?= Date: Wed, 30 Sep 2015 21:56:14 +0200 Subject: [PATCH 3/7] Fixes #297: properly implement onReceivedSslError() method Validation of SSL certificates is still not ideal, as https://badssl.com/ shows, but further improvements require more investigation. --- .../browser/lightning/view/LightningView.java | 48 +++++++++++++++---- app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-es/strings.xml | 1 - app/src/main/res/values-gr/strings.xml | 1 - app/src/main/res/values-hu/strings.xml | 1 - app/src/main/res/values-it/strings.xml | 5 +- app/src/main/res/values-ja/strings.xml | 1 - app/src/main/res/values-ko/strings.xml | 3 +- app/src/main/res/values-pl/strings.xml | 1 - app/src/main/res/values-pt/strings.xml | 1 - app/src/main/res/values-ru/strings.xml | 1 - app/src/main/res/values-sr/strings.xml | 1 - app/src/main/res/values-tr/strings.xml | 1 - app/src/main/res/values-zh-rCN/strings.xml | 1 - app/src/main/res/values/strings.xml | 8 +++- 15 files changed, 50 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/acr/browser/lightning/view/LightningView.java b/app/src/main/java/acr/browser/lightning/view/LightningView.java index 2c9a9e1..a14f65d 100644 --- a/app/src/main/java/acr/browser/lightning/view/LightningView.java +++ b/app/src/main/java/acr/browser/lightning/view/LightningView.java @@ -54,6 +54,8 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.List; import acr.browser.lightning.R; import acr.browser.lightning.app.BrowserApp; @@ -774,11 +776,47 @@ public class LightningView { } } + private List getAllSslErrorMessageCodes(SslError error) { + + List errorCodeMessageCodes = new ArrayList<>(); + + if (error.hasError(SslError.SSL_DATE_INVALID)) { + errorCodeMessageCodes.add(R.string.message_certificate_date_invalid); + } + if (error.hasError(SslError.SSL_EXPIRED)) { + errorCodeMessageCodes.add(R.string.message_certificate_expired); + } + if (error.hasError(SslError.SSL_IDMISMATCH)) { + errorCodeMessageCodes.add(R.string.message_certificate_domain_mismatch); + } + if (error.hasError(SslError.SSL_NOTYETVALID)) { + errorCodeMessageCodes.add(R.string.message_certificate_not_yet_valid); + } + if (error.hasError(SslError.SSL_UNTRUSTED)) { + errorCodeMessageCodes.add(R.string.message_certificate_untrusted); + } + if (error.hasError(SslError.SSL_INVALID)) { + errorCodeMessageCodes.add(R.string.message_certificate_invalid); + } + + return errorCodeMessageCodes; + } + @Override public void onReceivedSslError(WebView view, @NonNull final SslErrorHandler handler, SslError error) { + + List errorCodeMessageCodes = getAllSslErrorMessageCodes(error); + + StringBuilder stringBuilder = new StringBuilder(); + for (Integer messageCode : errorCodeMessageCodes) { + stringBuilder.append(" - ").append(mActivity.getString(messageCode)).append('\n'); + } + String alertMessage = + mActivity.getString(R.string.message_insecure_connection, stringBuilder.toString()); + AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); builder.setTitle(mActivity.getString(R.string.title_warning)); - builder.setMessage(mActivity.getString(R.string.message_untrusted_certificate)) + builder.setMessage(alertMessage) .setCancelable(true) .setPositiveButton(mActivity.getString(R.string.action_yes), new DialogInterface.OnClickListener() { @@ -794,13 +832,7 @@ public class LightningView { handler.cancel(); } }); - AlertDialog alert = builder.create(); - if (error.getPrimaryError() == SslError.SSL_UNTRUSTED) { - alert.show(); - } else { - handler.proceed(); - } - + builder.create().show(); } @Override diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index f30e7d9..c332fc1 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -123,7 +123,6 @@ Open Source-Lizenzen Suche nach Werbung blockieren - Das Zertifikat dieser Webseite ist nicht vertrauenswürdig. Trotzdem fortsetzen? Formularneuzustellung Daten erneut senden? \nMeine Position verwenden? diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index b6c61a0..1503551 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -106,7 +106,6 @@ Licencias de código abierto (open source) Buscar Bloquear anuncios - El certificado del sitio no es de fiar. ¿Continuar de todas maneras? Resubir el formulario ¿Quieres mandar los datos de nuevo? \n¿Quieres usar tu geolocalización? diff --git a/app/src/main/res/values-gr/strings.xml b/app/src/main/res/values-gr/strings.xml index 55ab54d..fc5a410 100644 --- a/app/src/main/res/values-gr/strings.xml +++ b/app/src/main/res/values-gr/strings.xml @@ -107,7 +107,6 @@ Άδειες ανοιχτού κώδικα Αναζήτηση για Μπλοκάρισμα διαφημίσεων - Το πιστοποιητικό δεν είναι αξιόπιστο. Συνέχεια παρ\'όλα αυτά; Επαναυποβολή φόρμας Θα θέλατε να ξαναστείλετε τα στοιχεία; \nΘα θέλατε να χρησιμοποιήσετε την τοποθεσία σας; diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 5c03fb8..39d13db 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -123,7 +123,6 @@ Nyílt forráskódú licencek Keresés Reklámok blokkolása - Az oldal tanusítványa nem megfelelő.Folytatja mindenképpen? Űrlap újraküldése Szeretnél újból elküldi az adatokat? \nSzeretné használni a saját helyét? diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a547cea..f8d4205 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -1,10 +1,10 @@