diff options
Diffstat (limited to 'app')
35 files changed, 176 insertions, 111 deletions
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java index 90b8b839..12e88af8 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/TestConfigurationWizard.java @@ -14,7 +14,6 @@ import se.leap.bitmaskclient.R; public class TestConfigurationWizard extends ActivityInstrumentationTestCase2<ConfigurationWizard> { private Solo solo; - private static int added_providers; public TestConfigurationWizard() { super(ConfigurationWizard.class); @@ -34,11 +33,14 @@ public class TestConfigurationWizard extends ActivityInstrumentationTestCase2<Co super.tearDown(); } - public void testListProviders() { + /** + * Tests should run independently from each other. We need a better approach to test the amount of providers added + */ + /*public void testListProviders() { assertEquals(solo.getCurrentViews(ListView.class).size(), 1); assertEquals("Number of available providers differ", predefinedProviders() + added_providers, shownProviders()); - } + }*/ private int shownProviders() { return solo.getCurrentViews(ListView.class).get(0).getCount(); @@ -76,24 +78,40 @@ public class TestConfigurationWizard extends ActivityInstrumentationTestCase2<Co public void testAddNewProvider() { //addProvider("calyx.net"); - addProvider("riseup.net"); + addProvider("riseup.net", true); + } + + public void testAddFalseProviderReturning404() { + //addProvider("calyx.net"); + addProvider("startpage.com", false); + } + + public void testAddFalseProviderReturning200() { + //addProvider("calyx.net"); + addProvider("test.com", false); } - private void addProvider(String url) { - boolean is_new_provider = !solo.searchText(url); + private void addProvider(String url, boolean expectSuccess) { - if (is_new_provider) - added_providers = added_providers + 1; solo.clickOnActionBarItem(R.id.new_provider); solo.enterText(0, url); if ( BuildConfig.FLAVOR.equals("insecure")) { solo.clickOnCheckBox(0); } solo.clickOnText(solo.getString(R.string.save)); - waitForProviderDetails(); + if (expectSuccess) { + waitForProviderDetails(); + } else { + waitForNoValidProviderError(); + } solo.goBack(); } + private void waitForNoValidProviderError() { + String text = solo.getString(R.string.malformed_url); + assertTrue("Provider details dialog did not appear", solo.waitForText(text, 1, 60*1000)); + } + public void testShowAbout() { showAbout(); } diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java index f76ba93b..4c6a6370 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/VpnTestController.java @@ -7,10 +7,10 @@ import com.robotium.solo.Condition; import com.robotium.solo.Solo; import de.blinkt.openvpn.activities.DisconnectVPN; -import mbanje.kurt.fabbutton.FabButton; import mbanje.kurt.fabbutton.ProgressRingView; import se.leap.bitmaskclient.Dashboard; import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.userstatus.FabButton; import static junit.framework.Assert.assertTrue; diff --git a/app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java index 588ff7e2..87fff283 100644 --- a/app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/insecure/java/se/leap/bitmaskclient/ProviderAPI.java @@ -125,6 +125,12 @@ public class ProviderAPI extends ProviderApiBase { else provider_dot_json_string = downloadWithCommercialCA(provider_main_url + "/provider.json", danger_on, provider_ca_cert_fingerprint); + if (!isValidJson(provider_dot_json_string)) { + result.putString(ERRORS, getString(malformed_url)); + result.putBoolean(RESULT_KEY, false); + return result; + } + try { JSONObject provider_json = new JSONObject(provider_dot_json_string); provider_api_url = provider_json.getString(Provider.API_URL) + "/" + provider_json.getString(Provider.API_VERSION); @@ -165,7 +171,7 @@ public class ProviderAPI extends ProviderApiBase { preferences.edit().putString(Constants.KEY, eip_service_json.toString()).commit(); result.putBoolean(RESULT_KEY, true); - } catch (JSONException e) { + } catch (NullPointerException | JSONException e) { String reason_to_fail = pickErrorMessage(eip_service_json_string); result.putString(ERRORS, reason_to_fail); result.putBoolean(RESULT_KEY, false); @@ -189,7 +195,7 @@ public class ProviderAPI extends ProviderApiBase { String cert_string = downloadWithProviderCA(new_cert_string_url.toString(), last_danger_on); - if (cert_string.isEmpty() || ConfigHelper.checkErroneousDownload(cert_string)) + if (cert_string == null || cert_string.isEmpty() || ConfigHelper.checkErroneousDownload(cert_string)) return false; else return loadCertificate(cert_string); @@ -274,7 +280,7 @@ public class ProviderAPI extends ProviderApiBase { responseString = sendGetStringToServer(string_url, headerArgs, okHttpClient); - if (responseString.contains(ERRORS)) { + if (responseString != null && responseString.contains(ERRORS)) { try { // try to download with provider CA on certificate error JSONObject responseErrorJson = new JSONObject(responseString); diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java index 232a00e9..fd1e2080 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java @@ -47,7 +47,7 @@ public class ConfigHelper { } else { return false; } - } catch (JSONException e) { + } catch (NullPointerException | JSONException e) { return false; } } diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java b/app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java index 15440330..acac607c 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderApiBase.java @@ -687,6 +687,17 @@ public abstract class ProviderApiBase extends IntentService { return CA_CERT_DOWNLOADED; } + protected boolean isValidJson(String jsonString) { + try { + new JSONObject(jsonString); + return true; + } catch(JSONException e) { + return false; + } catch(NullPointerException e) { + return false; + } + } + protected boolean validCertificate(String cert_string) { boolean result = false; if (!ConfigHelper.checkErroneousDownload(cert_string)) { diff --git a/app/src/main/res/drawable-hdpi/ic_account_circle.png b/app/src/main/res/drawable-hdpi/ic_account_circle.png Binary files differdeleted file mode 100644 index db02b319..00000000 --- a/app/src/main/res/drawable-hdpi/ic_account_circle.png +++ /dev/null diff --git a/app/src/main/res/drawable-hdpi/icon_user.png b/app/src/main/res/drawable-hdpi/icon_user.png Binary files differnew file mode 100644 index 00000000..8e19c37d --- /dev/null +++ b/app/src/main/res/drawable-hdpi/icon_user.png diff --git a/app/src/main/res/drawable-mdpi/ic_account_circle.png b/app/src/main/res/drawable-mdpi/ic_account_circle.png Binary files differdeleted file mode 100644 index 2489c703..00000000 --- a/app/src/main/res/drawable-mdpi/ic_account_circle.png +++ /dev/null diff --git a/app/src/main/res/drawable-mdpi/icon_user.png b/app/src/main/res/drawable-mdpi/icon_user.png Binary files differnew file mode 100644 index 00000000..f64923d1 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/icon_user.png diff --git a/app/src/main/res/drawable-xhdpi/ic_account_circle.png b/app/src/main/res/drawable-xhdpi/ic_account_circle.png Binary files differdeleted file mode 100644 index 848a4fda..00000000 --- a/app/src/main/res/drawable-xhdpi/ic_account_circle.png +++ /dev/null diff --git a/app/src/main/res/drawable-xhdpi/icon_user.png b/app/src/main/res/drawable-xhdpi/icon_user.png Binary files differnew file mode 100644 index 00000000..81d54eaf --- /dev/null +++ b/app/src/main/res/drawable-xhdpi/icon_user.png diff --git a/app/src/main/res/drawable-xxhdpi/ic_account_circle.png b/app/src/main/res/drawable-xxhdpi/ic_account_circle.png Binary files differdeleted file mode 100644 index a886b553..00000000 --- a/app/src/main/res/drawable-xxhdpi/ic_account_circle.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxhdpi/icon_user.png b/app/src/main/res/drawable-xxhdpi/icon_user.png Binary files differnew file mode 100644 index 00000000..b9280300 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/icon_user.png diff --git a/app/src/main/res/drawable-xxxhdpi/ic_account_circle.png b/app/src/main/res/drawable-xxxhdpi/ic_account_circle.png Binary files differdeleted file mode 100644 index c8feac66..00000000 --- a/app/src/main/res/drawable-xxxhdpi/ic_account_circle.png +++ /dev/null diff --git a/app/src/main/res/drawable-xxxhdpi/icon_user.png b/app/src/main/res/drawable-xxxhdpi/icon_user.png Binary files differnew file mode 100644 index 00000000..81e17780 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/icon_user.png diff --git a/app/src/main/res/layout-xlarge/about.xml b/app/src/main/res/layout-xlarge/about.xml index 6ab88737..227da8b0 100644 --- a/app/src/main/res/layout-xlarge/about.xml +++ b/app/src/main/res/layout-xlarge/about.xml @@ -16,7 +16,7 @@ android:id="@+id/version" android:layout_width="match_parent" android:layout_height="wrap_content" - android:textSize="18sp" /> + android:textSize="24sp" /> <Space android:layout_width="match_parent" @@ -40,9 +40,16 @@ android:autoLink="all" android:text="@string/repository_url_text" /> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textSize="18sp" + android:autoLink="all" + android:text="@string/leap_tracker" /> + <Space android:layout_width="match_parent" - android:layout_height="12sp" /> + android:layout_height="18sp" /> <TextView android:layout_width="match_parent" @@ -74,12 +81,12 @@ <Space android:layout_width="match_parent" - android:layout_height="12sp" /> + android:layout_height="20sp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" - android:textSize="18sp" + android:textSize="24sp" android:text="@string/openvpn" android:textAppearance="?android:attr/textAppearanceMedium" /> <!-- @@ -103,7 +110,7 @@ <TextView android:layout_width="match_parent" android:layout_height="wrap_content" - android:textSize="18sp" + android:textSize="24sp" android:text="@string/lzo" android:textAppearance="?android:attr/textAppearanceMedium" /> @@ -120,7 +127,7 @@ <TextView android:layout_width="match_parent" android:layout_height="wrap_content" - android:textSize="18sp" + android:textSize="24sp" android:text="@string/openssl" android:textAppearance="?android:attr/textAppearanceMedium" /> @@ -129,6 +136,22 @@ android:layout_height="wrap_content" android:textSize="18sp" android:text="@string/copyright_openssl" /> + <Space + android:layout_width="match_parent" + android:layout_height="20sp" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:text="@string/okhttp" + android:textSize="24sp" + android:textAppearance="?android:attr/textAppearanceMedium" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:textSize="18sp" + android:text="@string/copyright_okhttp" /> </LinearLayout> </ScrollView> diff --git a/app/src/main/res/layout-xlarge/dashboard.xml b/app/src/main/res/layout-xlarge/dashboard.xml index 3c93a04c..b9c78b68 100644 --- a/app/src/main/res/layout-xlarge/dashboard.xml +++ b/app/src/main/res/layout-xlarge/dashboard.xml @@ -22,28 +22,10 @@ android:textAppearance="?android:attr/textAppearanceMedium" /> <LinearLayout + android:id="@+id/user.status.fragment" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginLeft="32dp" - android:layout_marginStart="32dp"> - <ProgressBar - android:id="@+id/user_session_status_progress" - android:layout_width="wrap_content" - android:layout_height="fill_parent" - android:indeterminate="true" - android:visibility="gone"/> - <TextView - android:id="@+id/user_session_status" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textSize="18sp" - android:layout_marginLeft="10dp" - android:layout_marginStart="10dp" - android:ellipsize="marquee" - android:singleLine="true" - android:textAppearance="?android:attr/textAppearanceMedium" - /> - </LinearLayout> + android:orientation="horizontal"/> <LinearLayout android:id="@+id/servicesCollection" diff --git a/app/src/main/res/layout-xlarge/eip_service_fragment.xml b/app/src/main/res/layout-xlarge/eip_service_fragment.xml index 2b3c4f2e..28ac3b9a 100644 --- a/app/src/main/res/layout-xlarge/eip_service_fragment.xml +++ b/app/src/main/res/layout-xlarge/eip_service_fragment.xml @@ -8,15 +8,17 @@ <TextView android:id="@+id/eipLabel" + android:layout_centerHorizontal="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginStart="10dp" android:layout_marginTop="12dp" - android:layout_marginBottom="12dp" + android:layout_marginBottom="30dp" android:text="@string/eip_service_label" - android:textAppearance="?android:attr/textAppearanceLarge" - android:textSize="24sp"/> + android:textSize="46sp" + android:textAppearance="?android:attr/textAppearanceMedium" + /> <LinearLayout @@ -35,10 +37,10 @@ android:textSize="32sp" /> - <mbanje.kurt.fabbutton.FabButton + <se.leap.bitmaskclient.userstatus.FabButton android:id="@+id/vpn_status_image" - android:layout_width="48dp" - android:layout_height="48dp" + android:layout_width="56dp" + android:layout_height="56dp" android:color="@android:color/holo_blue_dark" android:layout_gravity="center" android:visibility="visible" @@ -46,7 +48,7 @@ android:max="100" fbb_autoStart="true" fbb_progressColor="#ff170aff" - fbb_progressWidthRatio="0.1" + fbb_progressWidthRatio="0.2" android:layout_marginStart="24dp" android:layout_marginLeft="24dp" /> diff --git a/app/src/main/res/layout-xlarge/logwindow.xml b/app/src/main/res/layout-xlarge/logwindow.xml deleted file mode 100644 index 4051c92c..00000000 --- a/app/src/main/res/layout-xlarge/logwindow.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" > - - <TextView android:text="@string/speed_waiting" - android:singleLine="true" - android:id="@+id/speed" - android:layout_width="match_parent" - android:layout_height="wrap_content"/> - <ListView - android:id="@android:id/list" - android:layout_width="fill_parent" - android:layout_height="fill_parent" /> - -</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/user_session_fragment.xml b/app/src/main/res/layout-xlarge/user_session_fragment.xml index 30969219..df72f615 100644 --- a/app/src/main/res/layout-xlarge/user_session_fragment.xml +++ b/app/src/main/res/layout-xlarge/user_session_fragment.xml @@ -1,5 +1,6 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="30dp" @@ -13,8 +14,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="30dp" - android:layout_marginRight="60dp" - android:layout_marginEnd="60dp" android:layout_gravity="center" android:textSize="46sp" android:text="@string/default_username" @@ -30,25 +29,25 @@ android:id="@+id/user.status.button" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textSize="24sp" + android:textSize="32sp" /> - <view + <se.leap.bitmaskclient.userstatus.FabButton android:id="@+id/user.status.icon" android:layout_width="56dp" android:layout_height="56dp" - android:layout_marginLeft="26dp" - android:layout_marginStart="26dp" - android:background="@android:color/transparent" + android:layout_marginStart="24dp" + android:layout_marginLeft="24dp" + android:shadowRadius="0" + android:src="@drawable/icon_user" android:color="@android:color/holo_blue_dark" - class="mbanje.kurt.fabbutton.FabButton" android:layout_gravity="center" android:visibility="visible" android:indeterminate="true" android:max="100" fbb_autoStart="true" - fbb_progressColor="#ff170aff" - fbb_progressWidthRatio="0.3" + app:fbb_progressColor="@android:color/holo_green_dark" + app:fbb_progressWidthRatio="0.2" /> </LinearLayout> diff --git a/app/src/main/res/layout-xlarge/vpnstatus.xml b/app/src/main/res/layout-xlarge/vpnstatus.xml new file mode 100644 index 00000000..3b464b62 --- /dev/null +++ b/app/src/main/res/layout-xlarge/vpnstatus.xml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (c) 2012-2016 Arne Schwabe + ~ Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt + --> + +<merge xmlns:tools="http://schemas.android.com/tools" + xmlns:android="http://schemas.android.com/apk/res/android"> + + <Space + android:layout_weight="1" + android:layout_width="wrap_content" + android:layout_height="wrap_content"/> + + + <TextView + android:text="@string/uploaded_data" + style="@style/logWindowStatusTitle"/> + + <TextView + style="@style/logWindowStatusText" + android:id="@+id/speedUp" + tools:text="4 Mbit/s 6.7 GB"/> + + <TextView + android:text="@string/downloaded_data" + style="@style/logWindowStatusTitle"/> + + <TextView + style="@style/logWindowStatusText" + android:id="@+id/speedDown" + tools:text="2 Mbit/s 4.7 GB"/> + + + <Space + android:layout_weight="1" + android:layout_width="wrap_content" + android:layout_height="wrap_content"/> + + + <TextView + android:text="@string/vpn_status" + style="@style/logWindowStatusTitle"/> + + <TextView + + android:id="@+id/speedStatus" + tools:text="Connected to a very long ipv4 and 3483489348238824829482384928" + style="@style/logWindowStatusText"/> + + +</merge>
\ No newline at end of file diff --git a/app/src/main/res/layout/about.xml b/app/src/main/res/layout/about.xml index 3188d16f..62e858cb 100644 --- a/app/src/main/res/layout/about.xml +++ b/app/src/main/res/layout/about.xml @@ -15,7 +15,8 @@ <TextView android:id="@+id/version" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceMedium" /> <Space android:layout_width="match_parent" diff --git a/app/src/main/res/layout/dashboard.xml b/app/src/main/res/layout/dashboard.xml index 6a9bbe97..1b294fb1 100644 --- a/app/src/main/res/layout/dashboard.xml +++ b/app/src/main/res/layout/dashboard.xml @@ -15,7 +15,7 @@ android:textSize="26sp" android:ellipsize="marquee" android:gravity="center_vertical" - android:singleLine="true" + android:maxLines="1" android:text="@string/provider_label_none" android:textAppearance="?android:attr/textAppearanceMedium" /> diff --git a/app/src/main/res/layout/eip_service_fragment.xml b/app/src/main/res/layout/eip_service_fragment.xml index c8370cf1..cef01c18 100644 --- a/app/src/main/res/layout/eip_service_fragment.xml +++ b/app/src/main/res/layout/eip_service_fragment.xml @@ -30,7 +30,7 @@ android:textSize="12sp" /> - <mbanje.kurt.fabbutton.FabButton + <se.leap.bitmaskclient.userstatus.FabButton android:id="@+id/vpn_status_image" android:layout_width="32dp" android:layout_height="32dp" diff --git a/app/src/main/res/layout/logwindow.xml b/app/src/main/res/layout/logwindow.xml deleted file mode 100644 index 4051c92c..00000000 --- a/app/src/main/res/layout/logwindow.xml +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" > - - <TextView android:text="@string/speed_waiting" - android:singleLine="true" - android:id="@+id/speed" - android:layout_width="match_parent" - android:layout_height="wrap_content"/> - <ListView - android:id="@android:id/list" - android:layout_width="fill_parent" - android:layout_height="fill_parent" /> - -</LinearLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/user_session_fragment.xml b/app/src/main/res/layout/user_session_fragment.xml index d33f9b9a..2d38d140 100644 --- a/app/src/main/res/layout/user_session_fragment.xml +++ b/app/src/main/res/layout/user_session_fragment.xml @@ -26,16 +26,15 @@ android:textSize="14sp" /> - <view + <se.leap.bitmaskclient.userstatus.FabButton android:id="@+id/user.status.icon" android:layout_width="32dp" android:layout_height="32dp" android:layout_marginLeft="9dp" android:layout_marginStart="9dp" android:shadowRadius="0" - android:src="@drawable/ic_account_circle" - android:color="@android:color/transparent" - class="se.leap.bitmaskclient.userstatus.FabButton" + android:src="@drawable/icon_user" + android:color="@android:color/holo_blue_dark" android:layout_gravity="center" android:indeterminate="true" app:fbb_progressColor="@android:color/holo_green_dark" diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 09bac1ef..b7daea7d 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -11,8 +11,8 @@ <string name="routes_info6">Rutas IPv6: %s</string> <string name="error_empty_username">El usuario no puede estar vacío.</string> <string name="cert_from_keystore">Certificado de \'%s\' obtenido de almacén de claves</string> - <string name="repository_url_text">Código fuente disponible en https://github.com/leapcode/bitmask_android/</string> - <string name="leap_tracker">Tracker disponible en https://leap.se/code</string> + <string name="repository_url_text">Código fuente disponible en https://0xacab.org/leap/bitmask_android</string> + <string name="leap_tracker">Tracker disponible en https://0xacab.org/leap/bitmask_android/issues</string> <string name="title_activity_dashboard">Bitmask</string> <string name="provider_label">Proveedor:</string> <string name="provider_label_none">Ningún proveedor configurado</string> diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 486c2e4c..da33cab1 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <string name="repository_url_text">소스 코드와 문제 추적기는 https://github.com/leapcode/bitmask_android/에서 사용할 수 있습니다</string> + <string name="repository_url_text">소스 코드와 문제 추적기는 https://0xacab.org/leap/bitmask_android 에서 사용할 수 있습니다</string> <string name="info">정보</string> <string name="show_connection_details">연결 세부 정보 보기</string> <string name="routes_info">라우트: %s</string> diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 09a8047f..736956a3 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <string name="repository_url_text">Cod sursă şi tracker probleme disponibile la https://github.com/leapcode/bitmask_android/</string> + <string name="repository_url_text">Cod sursă şi tracker probleme disponibile la https://0xacab.org/leap/bitmask_android</string> <string name="info">info</string> <string name="show_connection_details">Arată detaliile conexiunii</string> <string name="routes_info">Rute: %s</string> diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 28e966a6..05eca5ec 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <string name="repository_url_text">Початковий код і відстеження проблем доступні по https://github.com/leapcode/bitmask_android/</string> + <string name="repository_url_text">Початковий код і відстеження проблем доступні по https://0xacab.org/leap/bitmask_android</string> <string name="info">Інформація</string> <string name="show_connection_details">Показати відомості про підключення</string> <string name="routes_info">Маршрути: %s</string> diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index de61c057..6713f001 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <string name="repository_url_text">请前往 https://github.com/leapcode/bitmask_android/ 源码或提供问题反馈</string> + <string name="repository_url_text">请前往 https://0xacab.org/leap/bitmask_android 源码或提供问题反馈</string> <string name="show_connection_details">显示连接信息</string> <string name="routes_info">IPv4 路由: %s</string> <string name="routes_info6">IPv6 路由: %s</string> diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 411b5381..c20408f7 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <string name="repository_url_text">取得原始碼與個案追蹤,可上 https://github.com/leapcode/bitmask_android/</string> + <string name="repository_url_text">取得原始碼與個案追蹤,可上 https://0xacab.org/leap/bitmask_android</string> <string name="show_connection_details">顯示連線的詳細資訊</string> <string name="dns_domain_info">DNS網域: %s</string> <string name="routes_info">路徑: %s</string> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b1fce0ad..12bd4a30 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -2,8 +2,8 @@ <resources> <string name="retry">Retry</string> - <string name="repository_url_text">Source code available at https://github.com/leapcode/bitmask_android/</string> - <string name="leap_tracker">Tracker available at https://leap.se/code</string> + <string name="repository_url_text">Source code available at https://0xacab.org/leap/bitmask_android</string> + <string name="leap_tracker">Tracker available at https://0xacab.org/leap/bitmask_android/issues</string> <string name="translation_project_text">Translations welcome and appreciated. See our Transifex project at https://www.transifex.com/projects/p/bitmask-android/</string> <string name="switch_provider_menu_option">Switch provider</string> <string name="info">info</string> diff --git a/app/src/main/res/values/untranslatable.xml b/app/src/main/res/values/untranslatable.xml index 39d0de36..6e4472af 100644 --- a/app/src/main/res/values/untranslatable.xml +++ b/app/src/main/res/values/untranslatable.xml @@ -12,7 +12,7 @@ Copyright © 1998-2008 The OpenSSL Project. All rights reserved.\n\n This product includes cryptographic software written by Eric Young (eay@cryptsoft.com)\n Copyright © 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved.</string> - <string name="copyright_okhttp" translatable="false">Copyright Copyright 2016 Square, Inc.</string> + <string name="copyright_okhttp" translatable="false">Copyright © 2016 Square, Inc.</string> <string name="okhttp" translatable="false">OkHttp</string> <string name="openvpn" translatable="false">OpenVPN</string> <string name="lzo" translatable="false">LZO</string> diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java b/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java index 982080de..70a2c27c 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java +++ b/app/src/production/java/se/leap/bitmaskclient/ProviderAPI.java @@ -107,6 +107,12 @@ public class ProviderAPI extends ProviderApiBase { else provider_dot_json_string = downloadWithCommercialCA(provider_main_url + "/provider.json", provider_ca_cert_fingerprint); + if (!isValidJson(provider_dot_json_string)) { + result.putString(ERRORS, getString(malformed_url)); + result.putBoolean(RESULT_KEY, false); + return result; + } + try { JSONObject provider_json = new JSONObject(provider_dot_json_string); provider_api_url = provider_json.getString(Provider.API_URL) + "/" + provider_json.getString(Provider.API_VERSION); @@ -147,7 +153,7 @@ public class ProviderAPI extends ProviderApiBase { preferences.edit().putString(Constants.KEY, eip_service_json.toString()).commit(); result.putBoolean(RESULT_KEY, true); - } catch (JSONException e) { + } catch (NullPointerException | JSONException e) { String reason_to_fail = pickErrorMessage(eip_service_json_string); result.putString(ERRORS, reason_to_fail); result.putBoolean(RESULT_KEY, false); @@ -171,7 +177,7 @@ public class ProviderAPI extends ProviderApiBase { String cert_string = downloadWithProviderCA(new_cert_string_url.toString()); - if (cert_string.isEmpty() || ConfigHelper.checkErroneousDownload(cert_string)) + if (cert_string == null || cert_string.isEmpty() || ConfigHelper.checkErroneousDownload(cert_string)) return false; else return loadCertificate(cert_string); @@ -253,7 +259,7 @@ public class ProviderAPI extends ProviderApiBase { responseString = sendGetStringToServer(string_url, headerArgs, okHttpClient); - if (responseString.contains(ERRORS)) { + if (responseString != null && responseString.contains(ERRORS)) { try { // try to download with provider CA on certificate error JSONObject responseErrorJson = new JSONObject(responseString); |