From 5c4e12762b18b0c850bd7c9a751bb966d1889d89 Mon Sep 17 00:00:00 2001 From: Nicolas Pomepuy <nicolas@videolabs.io> Date: Wed, 22 Jan 2025 07:33:17 +0100 Subject: [PATCH 1/2] Fix the release CI to make the remote access version available --- application/vlc-android/build.gradle | 30 ----------------- .../vlc/gui/dialogs/AboutVersionDialog.kt | 14 ++++++-- application/webserver/build.gradle | 32 +++++++++++++++++++ 3 files changed, 44 insertions(+), 32 deletions(-) diff --git a/application/vlc-android/build.gradle b/application/vlc-android/build.gradle index 7b62a53ae7..e37071da8a 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 712ca7c990..7096aa0c99 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 1820f7425a..589bf32145 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 { -- GitLab From 9c2d2c687da53e8a2e85246fedfcfac7c83f50fd Mon Sep 17 00:00:00 2001 From: Nicolas Pomepuy <nicolas@videolabs.io> Date: Wed, 22 Jan 2025 11:46:52 +0100 Subject: [PATCH 2/2] Bump the remote access version to 0.1.3 --- .../java/org/videolan/vlc/webserver/RemoteAccessRouting.kt | 4 ++++ build.gradle | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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 832def5b8b..61f64bae5f 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 d14851c07c..7088746577 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 -- GitLab