From 9ec48833ea119c910136d3c6a878f2e01a20f4a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Wed, 30 Aug 2023 13:12:43 +0200 Subject: [PATCH 1/4] Remove Android code dealing with forwarded ports --- .../compose/dialog/DeviceRemovalDialog.kt | 13 +++---------- .../mullvadvpn/compose/screen/DeviceListScreen.kt | 1 - .../mullvadvpn/viewmodel/AccountViewModelTest.kt | 1 - .../kotlin/net/mullvad/mullvadvpn/model/Device.kt | 11 ++--------- .../lib/resource/src/main/res/values-da/strings.xml | 1 - .../lib/resource/src/main/res/values-de/strings.xml | 1 - .../lib/resource/src/main/res/values-es/strings.xml | 1 - .../lib/resource/src/main/res/values-fi/strings.xml | 1 - .../lib/resource/src/main/res/values-fr/strings.xml | 1 - .../lib/resource/src/main/res/values-it/strings.xml | 1 - .../lib/resource/src/main/res/values-ja/strings.xml | 1 - .../lib/resource/src/main/res/values-ko/strings.xml | 1 - .../lib/resource/src/main/res/values-my/strings.xml | 1 - .../lib/resource/src/main/res/values-nb/strings.xml | 1 - .../lib/resource/src/main/res/values-nl/strings.xml | 1 - .../lib/resource/src/main/res/values-pl/strings.xml | 1 - .../lib/resource/src/main/res/values-pt/strings.xml | 1 - .../lib/resource/src/main/res/values-ru/strings.xml | 1 - .../lib/resource/src/main/res/values-sv/strings.xml | 1 - .../lib/resource/src/main/res/values-th/strings.xml | 1 - .../lib/resource/src/main/res/values-tr/strings.xml | 1 - .../resource/src/main/res/values-zh-rCN/strings.xml | 1 - .../resource/src/main/res/values-zh-rTW/strings.xml | 1 - .../lib/resource/src/main/res/values/strings.xml | 1 - .../mullvadvpn/test/mockapi/util/JsonUtils.kt | 4 ---- 25 files changed, 5 insertions(+), 45 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceRemovalDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceRemovalDialog.kt index 80ffa2d1cd49..e7564d248f06 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceRemovalDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceRemovalDialog.kt @@ -50,16 +50,9 @@ fun ShowDeviceRemovalDialog(onDismiss: () -> Unit, onConfirm: () -> Unit, device text = { val htmlFormattedDialogText = textResource( - id = R.string.max_devices_confirm_removal_description, - device.name.capitalizeFirstCharOfEachWord() - ) - .let { introText -> - if (device.ports.isNotEmpty()) { - introText.plus(" " + stringResource(id = R.string.port_removal_notice)) - } else { - introText - } - } + id = R.string.max_devices_confirm_removal_description, + device.name.capitalizeFirstCharOfEachWord() + ) HtmlText(htmlFormattedString = htmlFormattedDialogText, textSize = 16.sp.value) }, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceListScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceListScreen.kt index 48e7ef2a0b32..7bbd7a7cd5f4 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceListScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceListScreen.kt @@ -59,7 +59,6 @@ fun PreviewDeviceListScreen() { id = "ID", name = "Name", pubkey = ByteArray(10), - ports = ArrayList(), created = "2002-12-12" ), isLoading = false diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModelTest.kt index e5a3f2b39719..9d93912a2895 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/AccountViewModelTest.kt @@ -42,7 +42,6 @@ class AccountViewModelTest { id = "fake_id", name = "fake_name", pubkey = byteArrayOf(), - ports = ArrayList(), created = "mock_date" ) ) diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/Device.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/Device.kt index a9ad4ec874b3..92f0621e6e30 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/Device.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/Device.kt @@ -4,13 +4,8 @@ import android.os.Parcelable import kotlinx.parcelize.Parcelize @Parcelize -data class Device( - val id: String, - val name: String, - val pubkey: ByteArray, - val ports: ArrayList, - val created: String -) : Parcelable { +data class Device(val id: String, val name: String, val pubkey: ByteArray, val created: String) : + Parcelable { // Generated by Android Studio override fun equals(other: Any?): Boolean { if (this === other) return true @@ -21,7 +16,6 @@ data class Device( if (id != other.id) return false if (name != other.name) return false if (!pubkey.contentEquals(other.pubkey)) return false - if (ports != other.ports) return false return true } @@ -31,7 +25,6 @@ data class Device( var result = id.hashCode() result = 31 * result + name.hashCode() result = 31 * result + pubkey.contentHashCode() - result = 31 * result + ports.hashCode() return result } } diff --git a/android/lib/resource/src/main/res/values-da/strings.xml b/android/lib/resource/src/main/res/values-da/strings.xml index bcfaa59ac026..5dbc34f1a5c9 100644 --- a/android/lib/resource/src/main/res/values-da/strings.xml +++ b/android/lib/resource/src/main/res/values-da/strings.xml @@ -123,7 +123,6 @@ Betalt indtil For at begynde at bruge appen skal du først føje tid til din konto. Port - Dette vil slette alle videresendte porte. Lokale indstillinger vil blive gemt. Privatliv Fortrolighedspolitik For at vi bedre kan hjælpe dig, bedes du vedhæfte din apps logfil til denne meddelelse. Dine data vil forblive sikre og private, da de anonymiseres, før de sendes via en krypteret kanal. diff --git a/android/lib/resource/src/main/res/values-de/strings.xml b/android/lib/resource/src/main/res/values-de/strings.xml index 911b145b3ca3..623c53e56632 100644 --- a/android/lib/resource/src/main/res/values-de/strings.xml +++ b/android/lib/resource/src/main/res/values-de/strings.xml @@ -123,7 +123,6 @@ Bezahlt bis Um mit der Nutzung dieser App zu beginnen, müssen Sie erst einmal Zeit zu Ihrem Konto hinzufügen. Port - Dadurch werden alle weitergeleiteten Ports gelöscht. Die lokalen Einstellungen werden gespeichert. Datenschutz Datenschutzrichtlinie Damit wir Ihnen besser helfen können, wird die Protokolldatei Ihrer App an diese Nachricht angehängt. Ihre Daten bleiben sicher und privat, da sie vor dem Senden über einen verschlüsselten Kanal anonymisiert werden. diff --git a/android/lib/resource/src/main/res/values-es/strings.xml b/android/lib/resource/src/main/res/values-es/strings.xml index 49c9ee6fcee8..697be6ea2bb2 100644 --- a/android/lib/resource/src/main/res/values-es/strings.xml +++ b/android/lib/resource/src/main/res/values-es/strings.xml @@ -123,7 +123,6 @@ Pagado hasta Para empezar a usar la aplicación, primero necesita agregar tiempo a su cuenta. Puerto - Se eliminarán todos los puertos reenviados. La configuración local se guardará. Privacidad Política de privacidad Para ayudarle de una forma más eficiente, se adjuntará el archivo de registro de la aplicación a este mensaje. Sus datos permanecerán protegidos y privados, ya que se anonimizan antes de enviarse a través de un canal cifrado. diff --git a/android/lib/resource/src/main/res/values-fi/strings.xml b/android/lib/resource/src/main/res/values-fi/strings.xml index a681bd43116e..aefe9b75495f 100644 --- a/android/lib/resource/src/main/res/values-fi/strings.xml +++ b/android/lib/resource/src/main/res/values-fi/strings.xml @@ -123,7 +123,6 @@ Maksu ennen Voit aloittaa sovelluksen käyttämisen lisäämällä ensin aikaa tilillesi. Portti - Toiminto poistaa kaikki välitetyt portit. Paikalliset asetukset tallennetaan. Tietosuoja Tietosuojakäytäntö Jotta voimme olla avuksi parhaamme mukaan, sovelluksesi lokitiedosto liitetään tähän viestiin. Tietosi pysyvät suojattuina ja yksityisinä, ja ne anonymisoidaan salatun kanavan kautta ennen lähetystä. diff --git a/android/lib/resource/src/main/res/values-fr/strings.xml b/android/lib/resource/src/main/res/values-fr/strings.xml index 0a6a8489690e..af87786af8ba 100644 --- a/android/lib/resource/src/main/res/values-fr/strings.xml +++ b/android/lib/resource/src/main/res/values-fr/strings.xml @@ -123,7 +123,6 @@ Payé jusqu\'au Pour commencer à utiliser l\'application, vous devez d\'abord ajouter du temps à votre compte. Port - Ceci supprimera tous les ports transférés. Les paramètres locaux seront enregistrés. Confidentialité Politique de confidentialité Pour mieux vous aider, le fichier journal de l\'application est joint à ce message. Vos données restent privées et en sécurité dans la mesure où elles sont rendues anonymes avant d\'être envoyées via un canal chiffré. diff --git a/android/lib/resource/src/main/res/values-it/strings.xml b/android/lib/resource/src/main/res/values-it/strings.xml index 4040af912e1e..672f1c27866f 100644 --- a/android/lib/resource/src/main/res/values-it/strings.xml +++ b/android/lib/resource/src/main/res/values-it/strings.xml @@ -123,7 +123,6 @@ Pagato fino al Per iniziare a utilizzare l\'app, devi prima aggiungere tempo al tuo account. Porta - Questa operazione eliminerà tutte le porte inoltrate. Le impostazioni locali verranno salvate. Privacy Informativa sulla privacy Per aiutarti in modo più efficace, il file di registro della tua app sarà allegato a questo messaggio. I tuoi dati rimarranno protetti e privati, e saranno anonimizzati prima di essere inviati tramite un canale crittografato. diff --git a/android/lib/resource/src/main/res/values-ja/strings.xml b/android/lib/resource/src/main/res/values-ja/strings.xml index 0b261161fcd8..8ec5d4282857 100644 --- a/android/lib/resource/src/main/res/values-ja/strings.xml +++ b/android/lib/resource/src/main/res/values-ja/strings.xml @@ -123,7 +123,6 @@ 次の日時まで支払い済み アプリを使い始めるには、まずはアカウントに時間を追加する必要があります。 ポート - これにより、転送されたポートがすべて削除されます。ローカル設定は保存されます。 プライバシー プライバシーポリシー さらに効率よく問題解決できるよう、お使いのアプリのログファイルがこのメッセージに添付されます。個人データは匿名化された後に暗号化されたチャネルで送信されるため、その安全は確保され、公開されることはありません。 diff --git a/android/lib/resource/src/main/res/values-ko/strings.xml b/android/lib/resource/src/main/res/values-ko/strings.xml index 90f3d04b38bd..fd7e303ae65c 100644 --- a/android/lib/resource/src/main/res/values-ko/strings.xml +++ b/android/lib/resource/src/main/res/values-ko/strings.xml @@ -123,7 +123,6 @@ 유효 기간 앱 사용을 시작하려면, 먼저 계정에 시간을 추가해야 합니다. 포트 - 전달된 모든 포트가 삭제됩니다. 로컬 설정이 저장됩니다. 개인 정보 보호 개인정보 보호정책 보다 효과적인 문제 해결을 위해 앱의 로그 파일이 이 메시지에 첨부됩니다. 사용자 데이터는 암호화된 채널을 통해 전송되기 전에 익명 처리되므로 안전하고 비공개로 유지됩니다. diff --git a/android/lib/resource/src/main/res/values-my/strings.xml b/android/lib/resource/src/main/res/values-my/strings.xml index bc4728751f95..fdd79b9e347e 100644 --- a/android/lib/resource/src/main/res/values-my/strings.xml +++ b/android/lib/resource/src/main/res/values-my/strings.xml @@ -123,7 +123,6 @@ ဖော်ပြပါအထိ ပေးချေထားပြီး အက်ပ်ကို စသုံးရန်အတွက် ဦးစွာ သင့်အကောင့်တွင် အချိန်ပေါင်းထည့်ပေးရန် လိုအပ်ပါသည်။ ပေါ့တ် - ၎င်းသည် ပေးပို့ထားသော ports ကို ဖျက်ပါမည်။ စက်တွင်းဆက်တင်ကို သိမ်းထားပါမည်။ ကိုယ်ရေးအချက်အလက် လုံခြုံရေး ကိုယ်ပိုင်အချက်အလက် မူဝါဒ သင့်အား ပိုမိုထိရောက်စွာ ကူညီနိုင်ရန် သင့်အက်ပ်၏ မှတ်တမ်းဖိုင်ကို ဤမက်ဆေ့ချ်နှင့်အတူ တွဲပေးသွားပါမည်။ ကုဒ်ပြောင်းဝှက်ထားသည့် ချန်နယ်မှတစ်ဆင့် မပေးပို့မီ သင့်ဒေတာများကို အမည်မဖော်ဘဲ ထားမည်ဖြစ်သောကြောင့် လျှို့ဝှက်လုံခြုံလျက် ရှိနေပါမည်။ diff --git a/android/lib/resource/src/main/res/values-nb/strings.xml b/android/lib/resource/src/main/res/values-nb/strings.xml index 375d7c012c4c..330004a4ba7d 100644 --- a/android/lib/resource/src/main/res/values-nb/strings.xml +++ b/android/lib/resource/src/main/res/values-nb/strings.xml @@ -123,7 +123,6 @@ Betalt fram til For å starte bruken av appen, må du først legge til tid til kontoen. Port - Dette vil slette alle formidlede porter. Lokale innstillinger blir lagret. Personvern Retningslinjer for personvern For å kunne gi deg god nok hjelp vil loggfilen til appen ligge som vedlegg til meldingen. All data forblir beskyttet og privat gjennom anonymisering før det sendes gjennom en kryptert kanal. diff --git a/android/lib/resource/src/main/res/values-nl/strings.xml b/android/lib/resource/src/main/res/values-nl/strings.xml index 5d8124537f0b..c684abaf5bda 100644 --- a/android/lib/resource/src/main/res/values-nl/strings.xml +++ b/android/lib/resource/src/main/res/values-nl/strings.xml @@ -123,7 +123,6 @@ Betaald tot Om de app te gebruiken, moet u eerst tijd toevoegen aan uw account. Poort - Hiermee worden alle doorgestuurde poorten verwijderd. De lokale instellingen worden opgeslagen. Privacy Privacybeleid Het logboekbestand van uw app wordt aan dit bericht gekoppeld zodat we u beter kunnen helpen. Uw gegevens blijven veilig en privé, omdat ze worden geanonimiseerd voordat ze over een versleuteld kanaal worden verzonden. diff --git a/android/lib/resource/src/main/res/values-pl/strings.xml b/android/lib/resource/src/main/res/values-pl/strings.xml index d38f5a7c3942..341e628be474 100644 --- a/android/lib/resource/src/main/res/values-pl/strings.xml +++ b/android/lib/resource/src/main/res/values-pl/strings.xml @@ -123,7 +123,6 @@ Płatne do Aby rozpocząć korzystanie z aplikacji, musisz najpierw dodać czas do swojego konta. Port - Spowoduje to usunięcie wszystkich przekierowanych portów. Ustawienia lokalne zostaną zapisane. Prywatność Polityka prywatności Aby można było pomóc Ci skuteczniej, do tej wiadomości dołączony zostanie plik dziennika aplikacji. Twoje dane pozostaną bezpieczne i prywatne, ponieważ przed wysłaniem zaszyfrowanym kanałem zostają one zanonimizowane. diff --git a/android/lib/resource/src/main/res/values-pt/strings.xml b/android/lib/resource/src/main/res/values-pt/strings.xml index 29e3e5df2505..15c52b550d7e 100644 --- a/android/lib/resource/src/main/res/values-pt/strings.xml +++ b/android/lib/resource/src/main/res/values-pt/strings.xml @@ -123,7 +123,6 @@ Pago até Para começar a utilizar a aplicação, primeiro tem de adicionar tempo à sua conta. Porta - Esta ação irá apagar todas as portas reencaminhadas. As definições locais serão guardadas. Privacidade Política de privacidade Para ajudarmos de forma mais eficaz, o ficheiro de registo da sua aplicação será anexado a esta mensagem. Os seus dados permanecerão seguros e privados, pois são tornados anónimos antes de serem enviados através de um canal encriptado. diff --git a/android/lib/resource/src/main/res/values-ru/strings.xml b/android/lib/resource/src/main/res/values-ru/strings.xml index 3fdc285af649..220b5949a342 100644 --- a/android/lib/resource/src/main/res/values-ru/strings.xml +++ b/android/lib/resource/src/main/res/values-ru/strings.xml @@ -123,7 +123,6 @@ Оплачено до Чтобы пользоваться приложением, нужно добавить время на учетную запись. Порт - Будут удалены все перенаправленные порты. Локальные настройки сохранятся. Конфиденциальность Политика конфиденциальности Чтобы помощь была эффективнее, к этому сообщению будет прикреплен файл журнала из приложения. Ваши данные останутся защищенными и конфиденциальными: они обезличиваются и отправляются по зашифрованному каналу. diff --git a/android/lib/resource/src/main/res/values-sv/strings.xml b/android/lib/resource/src/main/res/values-sv/strings.xml index e85a4d2a200c..07277b36cda0 100644 --- a/android/lib/resource/src/main/res/values-sv/strings.xml +++ b/android/lib/resource/src/main/res/values-sv/strings.xml @@ -123,7 +123,6 @@ Betalat till Om du vill börja använda appen måste du först lägga till tid i ditt konto. Port - Detta tar bort alla vidarebefordrade portar. Lokala inställningar sparas. Sekretess Sekretesspolicy För att hjälpa dig mer effektivt kommer appens loggfil att bifogas i detta meddelande. Dina uppgifter förblir säkra och privata, eftersom de anonymiseras innan de skickas över en krypterad kanal. diff --git a/android/lib/resource/src/main/res/values-th/strings.xml b/android/lib/resource/src/main/res/values-th/strings.xml index fefb659b8472..fd48845e4d27 100644 --- a/android/lib/resource/src/main/res/values-th/strings.xml +++ b/android/lib/resource/src/main/res/values-th/strings.xml @@ -123,7 +123,6 @@ ชำระเงินแล้วจนถึง คุณจำเป็นต้องเพิ่มเวลาไปยังบัญชีของคุณก่อน เพื่อที่จะเริ่มใช้งานแอป พอร์ต - นี่จะเป็นการลบพอร์ตที่ส่งต่อทั้งหมด และการตั้งค่าบนอุปกรณ์จะได้รับการบันทึกไว้ ความเป็นส่วนตัว นโยบายความเป็นส่วนตัว ไฟล์บันทึกล็อกของแอปของคุณจะถูกแนบไปกับข้อความนี้ เพื่อที่เราจะช่วยเหลือคุณได้อย่างมีประสิทธิภาพมากขึ้น ข้อมูลของคุณจะยังคงมีความปลอดภัยและเป็นส่วนตัว เนื่องจากจะไม่มีการระบุตัวตนก่อนส่งข้อมูลผ่านช่องทางที่มีการเข้ารหัส diff --git a/android/lib/resource/src/main/res/values-tr/strings.xml b/android/lib/resource/src/main/res/values-tr/strings.xml index 387db9c9901b..9fd317939ead 100644 --- a/android/lib/resource/src/main/res/values-tr/strings.xml +++ b/android/lib/resource/src/main/res/values-tr/strings.xml @@ -123,7 +123,6 @@ Şu tarihe kadar ödendi: Uygulamayı kullanmaya başlamak için önce hesabınıza süre eklemeniz gerekir. Port - Bu işlem, yönlendirilen tüm portları silecek. Yerel ayarlar kaydedilecektir. Gizlilik Gizlilik politikası Size daha etkili bir şekilde yardımcı olmak için uygulamanızın günlük dosyası bu mesaja eklenecektir. Verileriniz şifrelenmiş bir kanal üzerinden gönderilmeden önce anonimleştirildiği için güvenli ve gizli kalacaktır. diff --git a/android/lib/resource/src/main/res/values-zh-rCN/strings.xml b/android/lib/resource/src/main/res/values-zh-rCN/strings.xml index 2362f35b97d1..4b526fbc8c05 100644 --- a/android/lib/resource/src/main/res/values-zh-rCN/strings.xml +++ b/android/lib/resource/src/main/res/values-zh-rCN/strings.xml @@ -123,7 +123,6 @@ 到期时间 要开始使用本应用,您首先需要向帐户中充入时间。 端口 - 这将删除所有转发的端口。将保存本地设置。 隐私 隐私政策 为了更有效地帮助您,您应用的日志文件将被附加到此消息。您的数据将保持安全和私密,因为所有数据在发送之前都将通过加密通道进行匿名处理。 diff --git a/android/lib/resource/src/main/res/values-zh-rTW/strings.xml b/android/lib/resource/src/main/res/values-zh-rTW/strings.xml index 7b3b65a5fd26..e2ca1e6494cd 100644 --- a/android/lib/resource/src/main/res/values-zh-rTW/strings.xml +++ b/android/lib/resource/src/main/res/values-zh-rTW/strings.xml @@ -123,7 +123,6 @@ 支付至 需先在帳戶中加時,才能開始使用本應用程式。 連接埠 - 這將刪除所有轉送的連接埠。將儲存本機設定。 隱私權 隱私權政策 為了更有效協助您,會將應用程式的日誌檔將附加到此郵件。您的資料會保持安全和私密性,因為這些資料會先經過匿名處理,再透過加密通道傳送。 diff --git a/android/lib/resource/src/main/res/values/strings.xml b/android/lib/resource/src/main/res/values/strings.xml index 05e516c362d3..ac979ed2106c 100644 --- a/android/lib/resource/src/main/res/values/strings.xml +++ b/android/lib/resource/src/main/res/values/strings.xml @@ -143,7 +143,6 @@ Yes, log out device Continue with login Failed to fetch list of devices - This will delete all forwarded ports. Local settings will be saved. Copy account number Hide account number Show account number diff --git a/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/util/JsonUtils.kt b/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/util/JsonUtils.kt index b76c4d4278aa..62320a07e6ff 100644 --- a/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/util/JsonUtils.kt +++ b/android/test/mockapi/src/main/kotlin/net/mullvad/mullvadvpn/test/mockapi/util/JsonUtils.kt @@ -2,15 +2,12 @@ package net.mullvad.mullvadvpn.test.mockapi import net.mullvad.mullvadvpn.test.mockapi.util.formatStrictlyAccordingToIso8601AndRfc3339 import org.joda.time.DateTime -import org.json.JSONArray import org.json.JSONObject fun accountInfoJson(id: String, expiry: DateTime) = JSONObject().apply { put("id", id) put("expiry", expiry.formatStrictlyAccordingToIso8601AndRfc3339()) - put("max_ports", 5) - put("can_add_ports", true) put("max_devices", 5) put("can_add_devices", true) } @@ -24,7 +21,6 @@ fun deviceJson(id: String, name: String, publicKey: String, creationDate: DateTi put("created", creationDate.formatStrictlyAccordingToIso8601AndRfc3339()) put("ipv4_address", "127.0.0.1/32") put("ipv6_address", "fc00::1/128") - put("ports", JSONArray()) } fun accessTokenJsonResponse(accessToken: String, expiry: DateTime) = From ed8eac75a4c3c66c63d7214362f59538a35ce391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Wed, 30 Aug 2023 13:43:19 +0200 Subject: [PATCH 2/4] Remove forwarded ports messages from GUI frontend --- gui/src/main/account.ts | 9 -- gui/src/main/daemon-rpc.ts | 1 - gui/src/renderer/app.tsx | 10 +- gui/src/renderer/components/Account.tsx | 149 ++---------------- gui/src/renderer/components/AccountStyles.tsx | 7 - .../renderer/components/TooManyDevices.tsx | 11 -- gui/src/renderer/redux/account/actions.ts | 24 --- gui/src/renderer/redux/account/reducers.ts | 13 -- gui/src/shared/daemon-rpc-types.ts | 1 - gui/src/shared/ipc-schema.ts | 1 - gui/test/e2e/setup/main.ts | 1 - 11 files changed, 10 insertions(+), 217 deletions(-) diff --git a/gui/src/main/account.ts b/gui/src/main/account.ts index 1690445fb202..acad9697e5f2 100644 --- a/gui/src/main/account.ts +++ b/gui/src/main/account.ts @@ -91,15 +91,6 @@ export default class Account { void this.updateAccountHistory(); }); - IpcMainEventChannel.account.handleGetDeviceState(async () => { - try { - await this.daemonRpc.updateDevice(); - } catch (e) { - const error = e as Error; - log.warn(`Failed to update device info: ${error.message}`); - } - return this.daemonRpc.getDevice(); - }); IpcMainEventChannel.account.handleListDevices((accountToken: AccountToken) => { return this.daemonRpc.listDevices(accountToken); }); diff --git a/gui/src/main/daemon-rpc.ts b/gui/src/main/daemon-rpc.ts index f4d47c7916d8..ed9fb77b486b 100644 --- a/gui/src/main/daemon-rpc.ts +++ b/gui/src/main/daemon-rpc.ts @@ -1612,7 +1612,6 @@ function convertFromDevice(device: grpcTypes.Device): IDevice { return { ...asObject, - ports: asObject.portsList.map((port) => port.id), created: created, }; } diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx index 0dfda5d68863..79163af67bd6 100644 --- a/gui/src/renderer/app.tsx +++ b/gui/src/renderer/app.tsx @@ -295,7 +295,6 @@ export default class AppRenderer { public submitVoucher = (code: string) => IpcRendererEventChannel.account.submitVoucher(code); public updateAccountData = () => IpcRendererEventChannel.account.updateData(); - public getDeviceState = () => IpcRendererEventChannel.account.getDeviceState(); public removeDevice = (device: IDeviceRemoval) => IpcRendererEventChannel.account.removeDevice(device); public connectTunnel = () => IpcRendererEventChannel.tunnel.connect(); @@ -850,14 +849,7 @@ export default class AppRenderer { break; case 'revoked': { this.loginScheduler.cancel(); - - const oldAccountState = this.reduxStore.getState().account; - if (oldAccountState.loggingOut) { - reduxAccount.loggedOut(); - } else { - reduxAccount.deviceRevoked(); - } - + reduxAccount.deviceRevoked(); this.resetNavigation(); break; } diff --git a/gui/src/renderer/components/Account.tsx b/gui/src/renderer/components/Account.tsx index bd3bafbafc9d..431ace286533 100644 --- a/gui/src/renderer/components/Account.tsx +++ b/gui/src/renderer/components/Account.tsx @@ -1,21 +1,10 @@ -import { - createContext, - ReactNode, - useCallback, - useContext, - useEffect, - useMemo, - useState, -} from 'react'; +import { useCallback, useEffect } from 'react'; import { links } from '../../config.json'; import { formatDate, hasExpired } from '../../shared/account-expiry'; import { messages } from '../../shared/gettext'; import { useAppContext } from '../context'; -import useActions from '../lib/actionsHook'; import { useHistory } from '../lib/history'; -import { useBoolean } from '../lib/utilityHooks'; -import account from '../redux/account/actions'; import { useSelector } from '../redux/store'; import { AccountContainer, @@ -26,36 +15,21 @@ import { AccountRowValue, DeviceRowValue, StyledDeviceNameRow, - StyledSpinnerContainer, } from './AccountStyles'; import AccountTokenLabel from './AccountTokenLabel'; import * as AppButton from './AppButton'; import { AriaDescribed, AriaDescription, AriaDescriptionGroup } from './AriaGroup'; import DeviceInfoButton from './DeviceInfoButton'; -import ImageView from './ImageView'; import { BackAction } from './KeyboardNavigation'; import { Footer, Layout, SettingsContainer } from './Layout'; -import { ModalAlert, ModalAlertType, ModalMessage } from './Modal'; import { NavigationBar, NavigationItems, TitleBarItem } from './NavigationBar'; import { RedeemVoucherButton } from './RedeemVoucher'; import SettingsHeader, { HeaderTitle } from './SettingsHeader'; -type DialogStage = 'checking-ports' | 'confirm' | undefined; - export default function Account() { - return ( - - - - ); -} - -function AccountComponent() { const history = useHistory(); const isOffline = useSelector((state) => state.connection.isBlocked); - const { updateAccountData, openLinkWithAuth } = useAppContext(); - - const { onTryLogout } = useLogoutContext(); + const { updateAccountData, openLinkWithAuth, logout } = useAppContext(); const onBuyMore = useCallback(async () => { await openLinkWithAuth(links.purchase); @@ -65,6 +39,12 @@ function AccountComponent() { updateAccountData(); }, []); + // Hack needed because if we just call `logout` directly in `onClick` + // then it is run with the wrong `this`. + const doLogout = useCallback(async () => { + await logout(); + }, [logout]); + return ( @@ -128,63 +108,18 @@ function AccountComponent() { - + {messages.pgettext('account-view', 'Log out')} - - ); } -function LogoutDialog() { - const { dialogStage, dialogVisible, onConfirmLogout, onCancelLogout } = useLogoutContext(); - - const modalType = dialogStage === 'checking-ports' ? undefined : ModalAlertType.warning; - - const message = - dialogStage === 'checking-ports' ? ( - - - - ) : ( - - { - // TRANSLATORS: This is is a further explanation of what happens when logging out. - messages.pgettext( - 'device-management', - 'The ports forwarded to this device will be deleted if you log out.', - ) - } - - ); - - const buttons = - dialogStage === 'checking-ports' - ? [] - : [ - - { - // TRANSLATORS: Confirmation button when logging out - messages.pgettext('device-management', 'Log out anyway') - } - , - - {messages.gettext('Back')} - , - ]; - return ( - - {message} - - ); -} - function DeviceNameRow() { const deviceName = useSelector((state) => state.account.deviceName); return ( @@ -223,69 +158,3 @@ function FormattedAccountExpiry(props: { expiry?: string; locale: string }) { ); } } - -type LogoutContextType = { - dialogStage: DialogStage; - dialogVisible: boolean; - onConfirmLogout: () => void; - onCancelLogout: () => void; - onTryLogout: () => Promise; -}; - -const LogoutContext = createContext(undefined); - -const LogoutContextProvider = ({ children }: { children: ReactNode }) => { - const { cancelLogout, prepareLogout } = useActions(account); - const { logout, getDeviceState } = useAppContext(); - - const [dialogStage, setDialogStage] = useState(); - const [dialogVisible, showDialog, hideDialog] = useBoolean(false); - - const onConfirmLogout = useCallback(async () => { - hideDialog(); - await logout(); - }, []); - - const onTryLogout = useCallback(async () => { - showDialog(); - setDialogStage('checking-ports'); - prepareLogout(); - - const deviceState = await getDeviceState(); - - if ( - deviceState?.type === 'logged in' && - deviceState.accountAndDevice.device?.ports !== undefined && - deviceState.accountAndDevice.device.ports.length > 0 - ) { - setDialogStage('confirm'); - } else { - await onConfirmLogout(); - } - }, [onConfirmLogout, prepareLogout]); - - const onCancelLogout = useCallback(() => { - cancelLogout(); - hideDialog(); - }, [cancelLogout]); - - const value: LogoutContextType = useMemo( - () => ({ - dialogStage, - dialogVisible, - onConfirmLogout, - onCancelLogout, - onTryLogout, - }), - [dialogVisible, dialogStage, onConfirmLogout, onCancelLogout, onTryLogout], - ); - return {children}; -}; - -const useLogoutContext = () => { - const context = useContext(LogoutContext); - if (!context) { - throw new Error('useAccount must be used within an LogoutContextProvider'); - } - return context; -}; diff --git a/gui/src/renderer/components/AccountStyles.tsx b/gui/src/renderer/components/AccountStyles.tsx index 706abb1bdf04..f3ba25c86a11 100644 --- a/gui/src/renderer/components/AccountStyles.tsx +++ b/gui/src/renderer/components/AccountStyles.tsx @@ -44,13 +44,6 @@ export const AccountOutOfTime = styled(AccountRowValue)({ color: colors.red, }); -export const StyledSpinnerContainer = styled.div({ - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - padding: '8px 0', -}); - export const StyledDeviceNameRow = styled.div({ display: 'flex', flexDirection: 'row', diff --git a/gui/src/renderer/components/TooManyDevices.tsx b/gui/src/renderer/components/TooManyDevices.tsx index 28de71b9c6be..5f5858b65100 100644 --- a/gui/src/renderer/components/TooManyDevices.tsx +++ b/gui/src/renderer/components/TooManyDevices.tsx @@ -298,17 +298,6 @@ function Device(props: IDeviceProps) { ), )} - {props.device.ports && props.device.ports.length > 0 && ( - - { - // TRANSLATORS: Further information about consequences of logging out device. - messages.pgettext( - 'device-management', - 'This will delete all forwarded ports. Local settings will be saved.', - ) - } - - )} ; created: Date; } diff --git a/gui/src/shared/ipc-schema.ts b/gui/src/shared/ipc-schema.ts index 5a50fa315a36..265d546b5dd0 100644 --- a/gui/src/shared/ipc-schema.ts +++ b/gui/src/shared/ipc-schema.ts @@ -189,7 +189,6 @@ export const ipcSchema = { getWwwAuthToken: invoke(), submitVoucher: invoke(), updateData: send(), - getDeviceState: invoke(), listDevices: invoke>(), removeDevice: invoke(), }, diff --git a/gui/test/e2e/setup/main.ts b/gui/test/e2e/setup/main.ts index c2ae998c9f32..430dfdb70d56 100644 --- a/gui/test/e2e/setup/main.ts +++ b/gui/test/e2e/setup/main.ts @@ -48,7 +48,6 @@ class ApplicationMain { device: { id: '1234', name: 'Testing Mole', - ports: [], created: new Date(), }, }, From 3bc982a60577b526901b2246a49a29ae633aa374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Wed, 30 Aug 2023 13:41:43 +0200 Subject: [PATCH 3/4] Remove forwarded port from devices in Rust code --- mullvad-api/src/device.rs | 5 +---- mullvad-cli/src/cmds/account.rs | 6 ----- mullvad-daemon/src/device/mod.rs | 7 +----- .../proto/management_interface.proto | 3 --- .../src/types/conversions/device.rs | 22 ------------------- mullvad-types/src/device.rs | 17 -------------- 6 files changed, 2 insertions(+), 58 deletions(-) diff --git a/mullvad-api/src/device.rs b/mullvad-api/src/device.rs index d48e1245b615..585e863ccf7d 100644 --- a/mullvad-api/src/device.rs +++ b/mullvad-api/src/device.rs @@ -2,7 +2,7 @@ use chrono::{DateTime, Utc}; use http::{Method, StatusCode}; use mullvad_types::{ account::AccountToken, - device::{Device, DeviceId, DeviceName, DevicePort}, + device::{Device, DeviceId, DeviceName}, }; use std::future::Future; use talpid_types::net::wireguard; @@ -23,7 +23,6 @@ struct DeviceResponse { pubkey: wireguard::PublicKey, ipv4_address: ipnetwork::Ipv4Network, ipv6_address: ipnetwork::Ipv6Network, - ports: Vec, hijack_dns: bool, created: DateTime, } @@ -73,7 +72,6 @@ impl DevicesProxy { pubkey, ipv4_address, ipv6_address, - ports, hijack_dns, created, .. @@ -84,7 +82,6 @@ impl DevicesProxy { id, name, pubkey, - ports, hijack_dns, created, }, diff --git a/mullvad-cli/src/cmds/account.rs b/mullvad-cli/src/cmds/account.rs index d0da9165fc55..3b3d12b153a7 100644 --- a/mullvad-cli/src/cmds/account.rs +++ b/mullvad-cli/src/cmds/account.rs @@ -112,9 +112,6 @@ impl Account { println!("Device id : {}", device.device.id); println!("Device pubkey : {}", device.device.pubkey); println!("Device created : {}", device.device.created,); - for port in device.device.ports { - println!("Device port : {port}"); - } } let expiry = rpc.get_account_data(device.account_token).await?; println!( @@ -156,9 +153,6 @@ impl Account { "Created : {}", device.created.with_timezone(&chrono::Local) ); - for port in device.ports { - println!("Port : {port}"); - } } else { println!("{}", device.pretty_name()); } diff --git a/mullvad-daemon/src/device/mod.rs b/mullvad-daemon/src/device/mod.rs index b220e1e009bf..b54638f1404e 100644 --- a/mullvad-daemon/src/device/mod.rs +++ b/mullvad-daemon/src/device/mod.rs @@ -8,8 +8,7 @@ use mullvad_api::rest; use mullvad_types::{ account::{AccountToken, VoucherSubmission}, device::{ - AccountAndDevice, Device, DeviceEvent, DeviceEventCause, DeviceId, DeviceName, DevicePort, - DeviceState, + AccountAndDevice, Device, DeviceEvent, DeviceEventCause, DeviceId, DeviceName, DeviceState, }, wireguard::{self, RotationInterval, WireguardData}, }; @@ -160,7 +159,6 @@ pub struct PrivateDevice { pub id: DeviceId, pub name: DeviceName, pub wg_data: wireguard::WireguardData, - pub ports: Vec, // FIXME: Reasonable default to avoid migration code for the field, // as it was previously missing. // This attribute may be removed once upgrades from `2022.2-beta1` @@ -190,7 +188,6 @@ impl PrivateDevice { id: device.id, name: device.name, wg_data, - ports: device.ports, hijack_dns: device.hijack_dns, created: device.created, }) @@ -203,7 +200,6 @@ impl PrivateDevice { return Err(Error::InvalidDevice); } self.id = device.id; - self.ports = device.ports; self.name = device.name; self.hijack_dns = device.hijack_dns; self.created = device.created; @@ -215,7 +211,6 @@ impl From for Device { fn from(device: PrivateDevice) -> Self { Device { id: device.id, - ports: device.ports, pubkey: device.wg_data.private_key.public_key(), name: device.name, hijack_dns: device.hijack_dns, diff --git a/mullvad-management-interface/proto/management_interface.proto b/mullvad-management-interface/proto/management_interface.proto index 4fdff3e75c07..7b0f5144ff5a 100644 --- a/mullvad-management-interface/proto/management_interface.proto +++ b/mullvad-management-interface/proto/management_interface.proto @@ -622,13 +622,10 @@ message Device { string id = 1; string name = 2; bytes pubkey = 3; - repeated DevicePort ports = 4; bool hijack_dns = 5; google.protobuf.Timestamp created = 6; } -message DevicePort { string id = 1; } - message DeviceList { repeated Device devices = 1; } message DeviceRemoval { diff --git a/mullvad-management-interface/src/types/conversions/device.rs b/mullvad-management-interface/src/types/conversions/device.rs index 12ae5b0434d0..faa97b8ab080 100644 --- a/mullvad-management-interface/src/types/conversions/device.rs +++ b/mullvad-management-interface/src/types/conversions/device.rs @@ -9,11 +9,6 @@ impl TryFrom for mullvad_types::device::Device { id: device.id, name: device.name, pubkey: bytes_to_pubkey(&device.pubkey)?, - ports: device - .ports - .into_iter() - .map(mullvad_types::device::DevicePort::from) - .collect(), hijack_dns: device.hijack_dns, created: chrono::DateTime::from_utc( chrono::NaiveDateTime::from_timestamp_opt( @@ -38,11 +33,6 @@ impl From for proto::Device { id: device.id, name: device.name, pubkey: device.pubkey.as_bytes().to_vec(), - ports: device - .ports - .into_iter() - .map(proto::DevicePort::from) - .collect(), hijack_dns: device.hijack_dns, created: Some(Timestamp { seconds: device.created.timestamp(), @@ -86,12 +76,6 @@ impl TryFrom for mullvad_types::device::DeviceState { } } -impl From for proto::DevicePort { - fn from(port: mullvad_types::device::DevicePort) -> Self { - proto::DevicePort { id: port.id } - } -} - impl From for proto::DeviceState { fn from(state: mullvad_types::device::DeviceState) -> Self { proto::DeviceState { @@ -211,9 +195,3 @@ impl From> for proto::DeviceList { } } } - -impl From for mullvad_types::device::DevicePort { - fn from(port: proto::DevicePort) -> Self { - mullvad_types::device::DevicePort { id: port.id } - } -} diff --git a/mullvad-types/src/device.rs b/mullvad-types/src/device.rs index f21d890eca1c..bc066ecf2215 100644 --- a/mullvad-types/src/device.rs +++ b/mullvad-types/src/device.rs @@ -3,7 +3,6 @@ use chrono::{DateTime, Utc}; #[cfg(target_os = "android")] use jnix::IntoJava; use serde::{Deserialize, Serialize}; -use std::fmt; use talpid_types::net::wireguard::PublicKey; /// UUID for a device. @@ -21,7 +20,6 @@ pub struct Device { pub name: DeviceName, #[cfg_attr(target_os = "android", jnix(map = "|key| *key.as_bytes()"))] pub pubkey: PublicKey, - pub ports: Vec, #[cfg_attr(target_os = "android", jnix(skip))] pub hijack_dns: bool, #[cfg_attr(target_os = "android", jnix(map = "|expiry| expiry.to_string()"))] @@ -49,21 +47,6 @@ impl Device { } } -/// Ports associated with a device. -#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)] -#[cfg_attr(target_os = "android", derive(IntoJava))] -#[cfg_attr(target_os = "android", jnix(package = "net.mullvad.mullvadvpn.model"))] -pub struct DevicePort { - /// Port identifier. - pub id: String, -} - -impl fmt::Display for DevicePort { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", self.id) - } -} - /// Contains a device state. #[derive(Debug, Clone, Deserialize, Serialize)] #[serde(rename_all = "snake_case")] From 057c2e9c9cf1561fb9db3c7c560ef0144b545a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Fri, 1 Sep 2023 13:36:24 +0200 Subject: [PATCH 4/4] Remove unused translations --- gui/locales/messages.pot | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/gui/locales/messages.pot b/gui/locales/messages.pot index 632f1ef4ad5b..b8b5552ecd92 100644 --- a/gui/locales/messages.pot +++ b/gui/locales/messages.pot @@ -481,11 +481,6 @@ msgctxt "device-management" msgid "If you log out, the device and the device name is removed. When you log back in again, the device will get a new name." msgstr "" -#. Confirmation button when logging out -msgctxt "device-management" -msgid "Log out anyway" -msgstr "" - msgctxt "device-management" msgid "Please log out of at least one by removing it from the list below. You can find the corresponding device name under the device’s Account settings." msgstr "" @@ -496,20 +491,10 @@ msgctxt "device-management" msgid "Super!" msgstr "" -#. This is is a further explanation of what happens when logging out. -msgctxt "device-management" -msgid "The ports forwarded to this device will be deleted if you log out." -msgstr "" - msgctxt "device-management" msgid "This is the name assigned to the device. Each device logged in on a Mullvad account gets a unique name that helps you identify it when you manage your devices in the app or on the website." msgstr "" -#. Further information about consequences of logging out device. -msgctxt "device-management" -msgid "This will delete all forwarded ports. Local settings will be saved." -msgstr "" - msgctxt "device-management" msgid "Time left: %(timeLeft)s" msgstr ""