[Android] Enable explicit FTP over SSL/TLS support

Ihor Sofiichenko git at videolan.org
Tue Apr 9 12:20:41 UTC 2024


vlc-android | branch: master | Ihor Sofiichenko <asoluter at gmail.com> | Wed Jan 17 08:36:47 2024 +0200| [f5c94285f61c0705c068fdf54cb50020228bec54] | committer: Nicolas Pomepuy

Enable explicit FTP over SSL/TLS support

> https://code.videolan.org/videolan/vlc-android/commit/f5c94285f61c0705c068fdf54cb50020228bec54
---

 application/resources/src/main/res/values/arrays.xml                | 1 +
 application/vlc-android/AndroidManifest.xml                         | 1 +
 .../src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt         | 2 ++
 .../src/org/videolan/vlc/repository/BrowserFavRepository.kt         | 2 +-
 application/vlc-android/src/org/videolan/vlc/util/Browserutils.kt   | 6 +++---
 application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt      | 2 +-
 6 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/application/resources/src/main/res/values/arrays.xml b/application/resources/src/main/res/values/arrays.xml
index 2368c5454d..fbbe4bfdab 100644
--- a/application/resources/src/main/res/values/arrays.xml
+++ b/application/resources/src/main/res/values/arrays.xml
@@ -3,6 +3,7 @@
     <string-array name="server_protocols">
         <item>FTP</item>
         <item>FTPS</item>
+        <item>FTPES</item>
         <item>SFTP</item>
         <!--<item>HTTP</item>-->
         <!--<item>HTTPS</item>-->
diff --git a/application/vlc-android/AndroidManifest.xml b/application/vlc-android/AndroidManifest.xml
index ded55e531d..bf9a8672a2 100644
--- a/application/vlc-android/AndroidManifest.xml
+++ b/application/vlc-android/AndroidManifest.xml
@@ -158,6 +158,7 @@
                 <data android:scheme="file"/>
                 <data android:scheme="ftp"/>
                 <data android:scheme="ftps"/>
+                <data android:scheme="ftpes"/>
                 <data android:scheme="sftp"/>
                 <data android:scheme="content"/>
                 <data android:scheme="http"/>
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt
index 03313f537c..bc3e35a6fb 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/NetworkServerDialog.kt
@@ -171,6 +171,7 @@ class NetworkServerDialog : VLCBottomSheetDialogFragment(), AdapterView.OnItemSe
         return when (protocols[position]) {
             "FTP" -> FTP_DEFAULT_PORT
             "FTPS" -> FTPS_DEFAULT_PORT
+            "FTPES" -> FTPES_DEFAULT_PORT
             "SFTP" -> SFTP_DEFAULT_PORT
             "HTTP" -> HTTP_DEFAULT_PORT
             "HTTPS" -> HTTPS_DEFAULT_PORT
@@ -249,6 +250,7 @@ class NetworkServerDialog : VLCBottomSheetDialogFragment(), AdapterView.OnItemSe
 
         const val FTP_DEFAULT_PORT = "21"
         const val FTPS_DEFAULT_PORT = "990"
+        const val FTPES_DEFAULT_PORT = "21"
         const val SFTP_DEFAULT_PORT = "22"
         const val HTTP_DEFAULT_PORT = "80"
         const val HTTPS_DEFAULT_PORT = "443"
diff --git a/application/vlc-android/src/org/videolan/vlc/repository/BrowserFavRepository.kt b/application/vlc-android/src/org/videolan/vlc/repository/BrowserFavRepository.kt
index 260980c372..611aaf7111 100644
--- a/application/vlc-android/src/org/videolan/vlc/repository/BrowserFavRepository.kt
+++ b/application/vlc-android/src/org/videolan/vlc/repository/BrowserFavRepository.kt
@@ -86,7 +86,7 @@ class BrowserFavRepository(private val browserFavDao: BrowserFavDao) {
             isEmpty() -> this
             !networkMonitor.connected -> emptyList()
             !NetworkMonitor.getInstance(AppContextProvider.appContext).lanAllowed -> {
-                val schemes = Arrays.asList("ftp", "sftp", "ftps", "http", "https")
+                val schemes = Arrays.asList("ftp", "sftp", "ftps", "ftpes", "http", "https")
                 mutableListOf<MediaWrapper>().apply { this at filterNetworkFavs.filterTo(this) { schemes.contains(it.uri.scheme) } }
             }
             else -> this
diff --git a/application/vlc-android/src/org/videolan/vlc/util/Browserutils.kt b/application/vlc-android/src/org/videolan/vlc/util/Browserutils.kt
index 3385767c6a..8ca50edcaf 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/Browserutils.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/Browserutils.kt
@@ -39,15 +39,15 @@ fun isSchemeStreaming(scheme: String?): Boolean = when {
 fun isSchemeHttpOrHttps(scheme: String?): Boolean = scheme?.startsWith("http") == true
 
 fun isSchemeSupported(scheme: String?) = when(scheme) {
-    "file", "smb", "ssh", "nfs", "ftp", "ftps", "content" -> true
+    "file", "smb", "ssh", "nfs", "ftp", "ftps", "ftpes", "content" -> true
     else -> false
 }
 fun String?.isSchemeNetwork() = when(this) {
-    "smb", "ssh", "nfs", "ftp", "ftps", "upnp" -> true
+    "smb", "ssh", "nfs", "ftp", "ftps", "ftpes", "upnp" -> true
     else -> false
 }
 
-fun String?.isSchemeFavoriteEditable() = this in arrayOf("ftp", "ftps", "sftp", "smb", "nfs")
+fun String?.isSchemeFavoriteEditable() = this in arrayOf("ftp", "ftps", "ftpes", "sftp", "smb", "nfs")
 
 fun String?.isSchemeFile() = when(this) {
     "file", null -> true
diff --git a/application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt b/application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt
index 33026d5290..3c9e2cd662 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/FileUtils.kt
@@ -294,7 +294,7 @@ object FileUtils {
     fun canSave(mw: MediaWrapper?): Boolean {
         if (mw == null || mw.uri == null) return false
         val scheme = mw.uri.scheme
-        return scheme in arrayOf("file", "smb", "nfs", "ftp", "ftps", "sftp", "upnp")
+        return scheme in arrayOf("file", "smb", "nfs", "ftp", "ftps", "ftpes", "sftp", "upnp")
     }
 
     @WorkerThread



More information about the Android mailing list