diff --git a/application/vlc-android/build.gradle b/application/vlc-android/build.gradle index 7b62a53ae7a8906902876583b2486b37ee7023a0..e37071da8aa9fe1c01b33cfd7a6efd381351dd29 100644 --- a/application/vlc-android/build.gradle +++ b/application/vlc-android/build.gradle @@ -22,8 +22,6 @@ android { resValue "string", "build_revision", revision() resValue "string", "changelog", changelog() resValue "string", "dav1d_version", dav1dVersion() - resValue "string", "remote_access_version", remoteAccessVersion() - resValue "string", "build_remote_access_revision", remoteAccessRevision() resValue 'string', 'tv_provider_authority', "${rootProject.ext.appId}.tv" buildConfigField 'String', 'LIBVLC_VERSION', "\"${rootProject.ext.libvlcVersion}\"" buildConfigField 'String', 'ML_VERSION', "\"${rootProject.ext.medialibraryVersion}\"" @@ -263,34 +261,6 @@ def dav1dVersion() { return "0.0.0" } -def remoteAccessVersion() { - def code = new ByteArrayOutputStream() - if (file("../../remoteaccess/package.json").exists()) { - try { - exec { - commandLine = ['bash', '-c', 'grep -m1 "version" ../../remoteaccess/package.json'] - standardOutput = code - } - return code.toString().split("\"")[3] - } catch (Exception e) { - } - } - return "unknown" -} - -def remoteAccessRevision() { - try { - def hash = new ByteArrayOutputStream() - exec { - commandLine = ['bash', '-c', 'git -C ../../remoteaccess rev-parse --short HEAD'] - standardOutput = hash - } - return hash.toString() - } catch (Exception e) { - } - return "unknown" -} - /** * Generate a changelog string from the NEWS file * @return a string containing the latest changelog entry diff --git a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AboutVersionDialog.kt b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AboutVersionDialog.kt index 712ca7c99028852f877f2a50437e53032ceb7db2..7096aa0c99ce773ecff705c9e0d17057f06c3e20 100644 --- a/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AboutVersionDialog.kt +++ b/application/vlc-android/src/org/videolan/vlc/gui/dialogs/AboutVersionDialog.kt @@ -22,6 +22,7 @@ package org.videolan.vlc.gui.dialogs import android.content.pm.PackageManager +import android.content.res.Resources import android.os.Build import android.os.Bundle import android.util.Log @@ -29,6 +30,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED +import org.videolan.tools.resIdByName import org.videolan.vlc.BuildConfig import org.videolan.vlc.R import org.videolan.vlc.databinding.DialogAboutVersionBinding @@ -74,8 +76,16 @@ class AboutVersionDialog : VLCBottomSheetDialogFragment() { binding.vlcRevision.text = getString(R.string.build_vlc_revision) binding.libvlcRevision.text = getString(R.string.build_libvlc_revision) binding.libvlcVersion.text = BuildConfig.LIBVLC_VERSION - binding.remoteAccessVersion.text = getString(R.string.remote_access_version) - binding.remoteAccessRevision.text = getString(R.string.build_remote_access_revision) + binding.remoteAccessVersion.text = try { + getString(requireActivity().resIdByName("remote_access_version", "string")) + } catch (e: Resources.NotFoundException) { + "unknown" + } + binding.remoteAccessRevision.text = try { + getString(requireActivity().resIdByName("build_remote_access_revision", "string")) + } catch (e: Resources.NotFoundException) { + "unknown" + } binding.compiledBy.text = getString(R.string.build_host) binding.moreButton.setOnClickListener { val whatsNewDialog = WhatsNewDialog() diff --git a/application/webserver/build.gradle b/application/webserver/build.gradle index 1820f7425a4366c12acef91a27f6287a60148949..589bf321459158d129856a31cd86d1cd85aef737 100644 --- a/application/webserver/build.gradle +++ b/application/webserver/build.gradle @@ -23,6 +23,8 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" buildConfigField 'Boolean', 'VLC_REMOTE_ACCESS_DEBUG', project.hasProperty("vlc_remote_access_debug") ? vlc_remote_access_debug : "false" + resValue "string", "build_remote_access_revision", remoteAccessRevision() + resValue "string", "remote_access_version", remoteAccessVersion() } @@ -77,6 +79,36 @@ android { } } +def remoteAccessVersion() { + def code = new ByteArrayOutputStream() + try { + if (file("../../remoteaccess/package.json").exists()) { + + exec { + commandLine = ['bash', '-c', 'grep -m1 "version" ../../remoteaccess/package.json'] + standardOutput = code + } + return code.toString().split("\"")[3] + + } + } catch (Exception e) { + } + return "unknown" +} + +def remoteAccessRevision() { + try { + def hash = new ByteArrayOutputStream() + exec { + commandLine = ['bash', '-c', 'git -C ../../remoteaccess rev-parse --short HEAD'] + standardOutput = hash + } + return hash.toString() + } catch (Exception e) { + } + return "unknown" +} + preBuild.dependsOn(webCopy) dependencies { diff --git a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt index 832def5b8be0d3f5c1212ce41317dc99a33a89cd..61f64bae5f220bc6f65300f6904ddd34982287c6 100644 --- a/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt +++ b/application/webserver/src/main/java/org/videolan/vlc/webserver/RemoteAccessRouting.kt @@ -758,6 +758,10 @@ fun Route.setupRouting(appContext: Context, scope: CoroutineScope) { call.respond(HttpStatusCode.Forbidden) return@get } + if (!Permissions.canReadStorage(appContext)) { + call.respond(HttpStatusCode.Forbidden) + return@get + } //Get content synchronously val dataset = LiveDataset<MediaLibraryItem>() val provider = withContext(Dispatchers.Main) { diff --git a/build.gradle b/build.gradle index d14851c07c14b9a674dedacc52ce1f0f6c506888..7088746577f1b4ad2d7c5c1c26d734addabdae84 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,7 @@ ext { versionCode = 3060100 versionName = project.hasProperty('forceVlc4') && project.getProperty('forceVlc4') ? '4.0.0-preview - ' + versionCode : '3.6.1' vlcMajorVersion = project.hasProperty('forceVlc4') && project.getProperty('forceVlc4') ? 4 : 3 - remoteAccessVersion = '0.1.2' + remoteAccessVersion = '0.1.3' libvlcVersion = vlcMajorVersion == 3 ? '3.6.0-eap14' :'4.0.0-eap17' medialibraryVersion = vlcMajorVersion == 3 ? '0.13.13-rc14' : '0.13.13-vlc4-rc14' minSdkVersion = 17