From 3128b17e47cbbe24bd4463a1582b074f189908ab Mon Sep 17 00:00:00 2001 From: nextcloud-android-bot Date: Thu, 18 Jan 2024 02:27:20 +0000 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=94=84=20synced=20local=20'.github/wo?= =?UTF-8?q?rkflows/'=20with=20remote=20'config/workflows/'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nextcloud-android-bot --- .github/workflows/codeql.yml | 4 ++-- .github/workflows/scorecard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index de8060c6e2..47d2832678 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -32,7 +32,7 @@ jobs: with: swap-size-gb: 10 - name: Initialize CodeQL - uses: github/codeql-action/init@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3.23.0 + uses: github/codeql-action/init@0b21cf2492b6b02c465a3e5d7c473717ad7721ba # v3.23.1 with: languages: ${{ matrix.language }} - name: Set up JDK 17 @@ -46,4 +46,4 @@ jobs: echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties" ./gradlew assembleDebug - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3.23.0 + uses: github/codeql-action/analyze@0b21cf2492b6b02c465a3e5d7c473717ad7721ba # v3.23.1 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 88ac8e9e6a..227cf22f04 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -37,6 +37,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@e5f05b81d5b6ff8cfa111c80c22c5fd02a384118 # v3.23.0 + uses: github/codeql-action/upload-sarif@0b21cf2492b6b02c465a3e5d7c473717ad7721ba # v3.23.1 with: sarif_file: results.sarif From 03b31ea6a249f29c6063228770c25ea74a89eb0f Mon Sep 17 00:00:00 2001 From: Nextcloud bot Date: Thu, 18 Jan 2024 02:37:47 +0000 Subject: [PATCH 2/5] Fix(l10n): Update translations from Transifex Signed-off-by: Nextcloud bot --- app/src/main/res/values-ar/strings.xml | 3 +++ app/src/main/res/values-b+en+001/strings.xml | 3 +++ app/src/main/res/values-de/strings.xml | 3 +++ app/src/main/res/values-es/strings.xml | 3 +++ app/src/main/res/values-nb-rNO/strings.xml | 5 +++++ app/src/main/res/values-sr/strings.xml | 3 +++ app/src/main/res/values-sv/strings.xml | 3 +++ app/src/main/res/values-zh-rHK/strings.xml | 3 +++ app/src/main/res/values-zh-rTW/strings.xml | 3 +++ 9 files changed, 29 insertions(+) diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index bdc98ff133..7c31b45c99 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -691,6 +691,8 @@ التقويم & جهات الاتصال مزامنة مع DAVx5 خطاء في الحصول على نتائج البحث + المشاركة الآمنة لم يتم إعدادها بالنسبة لهذا المستخدِم + المشاركة الآمنة ... تحديد الكل تعيين مجلد الوسائط الرجاء تحديد قالب واحد @@ -725,6 +727,7 @@ مشاركة الرابط (%1$s) تعيين تاريخ إنتهاء الصلاحية تعيين كلمة سرية + إعادة المشاركة غير مسموح بها خلال الإفلات الآمن للملف محمي بكلمة مرور يمكن تعديله اسقاط الملف diff --git a/app/src/main/res/values-b+en+001/strings.xml b/app/src/main/res/values-b+en+001/strings.xml index 3506ffa21a..7c8cc14f80 100644 --- a/app/src/main/res/values-b+en+001/strings.xml +++ b/app/src/main/res/values-b+en+001/strings.xml @@ -686,6 +686,8 @@ Calendar & contacts Sync with DAVx5 Error getting search results + Secure sharing is not set up for this user + Secure share … Select all Set media folder Please select one template @@ -720,6 +722,7 @@ Share link (%1$s) Set expiration date Set password + Resharing is not allowed during secure file drop Password-protected Can edit File drop diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index f51ee6dd02..1ff290870f 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -686,6 +686,8 @@ Kalender & Kontakte Synchronisiere mit DAVx5 Fehler beim Abrufen der Suchergebnisse + Sicheres teilen ist für diesen Benutzer nicht eingerichtet + Sicheres teilen … Alle auswählen Medien-Ordner auswählen Bitte eine Vorlage auswählen @@ -720,6 +722,7 @@ Teile Link (%1$s) Ablaufdatum setzen Passwort setzen + Erneutes teilen ist für die sichere Dateiablage nicht zugelassen Passwortgeschützt Kann bearbeiten Dateiablage diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 6de3c5f44d..7f1bb6a063 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -686,6 +686,8 @@ Calendario y contactos Sincronizar con DAVx5 Error al cargar resultados de búsqueda + Compartir en modo seguro no está configurado para este usuario + Compartir en modo seguro … Seleccionar todo Establece la carpeta multimedia Por favor, selecciona una plantilla @@ -720,6 +722,7 @@ Link para compartir (%1$s) Fijar fecha de caducidad Establecer contraseña + No se permite volver a compartir durante la entrega segura de archivos Protegido con contraseña Puede editar Entrega de archivos diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index 62bba033bd..702565cf4c 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -345,6 +345,7 @@ Ingenting delt enda Ingen resultat for søk mappe + LIVE Laster… Ingen app er satt opp til å håndtere denne filtypen. for få sekunder siden @@ -414,6 +415,7 @@ Alle filene ble flyttet Fremover 4 timer + Dette ikonet indikerer tilgjengeligheten av live photo Navn gir skjult fil Navn Melding @@ -684,6 +686,8 @@ Kalender & kontakter Synkroniser med DAVx5 Feil ved henting av søke resultat + Sikker deling er ikke konfigurert for denne brukeren + Sikker deling... Velg alle Velg mediamappe Velg en mal @@ -718,6 +722,7 @@ Del lenke (%1$s) Sett utløpsdato Velg passord + Videredeling er ikke tillatt under sikker filslipp Passordbeskyttet Kan endre Filkasse diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index 560062303d..c5f00eeb1e 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -686,6 +686,8 @@ Календар и контакти Синхронизација помоћу DAVx5 Грешка приликом добијања резултата претраге + За овог корисника није подешено безбедно дељење + Безбедно дељење Означи све Поставите фолдер са медијима Молимо вас да изаберете један шаблон @@ -720,6 +722,7 @@ Подели везу (%1$s) Постави датум истека Постави лозинку + Током безбедног упуштања фајла, није дозвољено поновно дељење Заштићено лозинком Може да уређује Место за упуштање фајлова diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index b579887fb1..4af98cc4f3 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -685,6 +685,8 @@ Kalender & kontakter Synka med DAVx5 Ett fel uppstod vid sökning + Säker delning är inte konfigurerad för denna användare + Säker delning ... Välj alla Ställ in mapp för media Vänligen välj en mall @@ -719,6 +721,7 @@ Dela länk (%1$s) Välj utgångsdatum Sätt lösenord + Återdelning är inte tillåtet under säker gömd fillista Lösenordsskyddad Kan ändra Göm fillista diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index d89a148aae..7d0b3c714b 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -686,6 +686,8 @@ 日曆 & 通訊錄 跟 DAVx5 同步 獲取搜索結果時出錯 + 尚未為此用戶設定安全分享功能。 + 安全分享 ... 全選 設置媒體資料夾 請選擇一個模板 @@ -720,6 +722,7 @@ 分享連結﹙%1$s﹚ 設定屆滿日期 設定密碼 + 在安全檔案傳輸期間不允許重新分享。 受密碼保護 可編輯 檔案拖放 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 0ab0b9ae82..8ce08ee3a2 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -686,6 +686,8 @@ 日曆與通訊錄 使用 DAVx5 同步 取得搜尋結果時發生錯誤 + 尚未為此使用者設定安全分享 + 安全分享…… 全選 設定媒體資料夾 請選取一個範本 @@ -720,6 +722,7 @@ 分享連結 (%1$s) 設定到期日 設定密碼 + 在安全檔案投遞時不允許轉分享 受密碼保護 可以編輯 檔案投放 From 2264d9dd124e1ecc0b66ed88e68ceb8d45f8a0aa Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 17 Jan 2024 09:21:47 -0500 Subject: [PATCH 3/5] chore: update devContainer JDK (11->17) Signed-off-by: Josh --- .devcontainer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 961ee064dc..344000b7f5 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -4,7 +4,7 @@ ARG DEBIAN_FRONTEND=noninteractive ENV ANDROID_HOME=/usr/lib/android-sdk RUN apt-get update -y -RUN apt-get install -y unzip wget openjdk-11-jdk vim +RUN apt-get install -y unzip wget openjdk-17-jdk vim RUN wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip -O /tmp/commandlinetools.zip RUN cd /tmp && unzip commandlinetools.zip From e72ce49371565c30be85dcf7abddc981131319e9 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Thu, 18 Jan 2024 09:12:50 +0100 Subject: [PATCH 4/5] Bump androidPluginVersion to match library Signed-off-by: tobiasKaminsky --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index c761c2cff1..ce9052a034 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ buildscript { ext { - androidPluginVersion = '8.2.0' + androidPluginVersion = '8.2.1' appCompatVersion = '1.6.1' jacoco_version = '0.8.10' kotlin_version = '1.8.22' From 3d1265d6aa9581c38b031818c68c158ec93df610 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Mon, 2 Mar 2020 12:33:48 +0100 Subject: [PATCH 5/5] Optional proxy support Signed-off-by: tobiasKaminsky --- .../java/com/owncloud/android/MainApp.java | 8 +++ .../authentication/AuthenticatorActivity.java | 2 + .../android/ui/activity/EditorWebView.java | 6 ++ .../ui/activity/ExternalSiteWebView.java | 2 + .../com/owncloud/android/utils/WebViewUtil.kt | 69 +++++++++++++++++++ app/src/main/res/values/setup.xml | 4 ++ 6 files changed, 91 insertions(+) diff --git a/app/src/main/java/com/owncloud/android/MainApp.java b/app/src/main/java/com/owncloud/android/MainApp.java index 63f23b3f51..243402b7cd 100644 --- a/app/src/main/java/com/owncloud/android/MainApp.java +++ b/app/src/main/java/com/owncloud/android/MainApp.java @@ -35,6 +35,7 @@ import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.content.res.Resources; import android.os.Build; import android.os.Bundle; import android.os.Environment; @@ -316,6 +317,13 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector { OwnCloudClientManagerFactory.setUserAgent(getUserAgent()); + try { + OwnCloudClientManagerFactory.setProxyHost(getResources().getString(R.string.proxy_host)); + OwnCloudClientManagerFactory.setProxyPort(getResources().getInteger(R.integer.proxy_port)); + } catch (Resources.NotFoundException e) { + // no proxy set + } + // initialise thumbnails cache on background thread new ThumbnailsCacheManager.InitDiskCacheTask().execute(); diff --git a/app/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java b/app/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java index f54db13671..0a65682937 100644 --- a/app/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/app/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -366,6 +366,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity private void initWebViewLogin(String baseURL, boolean useGenericUserAgent) { viewThemeUtils.platform.colorCircularProgressBar(accountSetupWebviewBinding.loginWebviewProgressBar, ColorRole.ON_PRIMARY_CONTAINER); accountSetupWebviewBinding.loginWebview.setVisibility(View.GONE); + new WebViewUtil(this).setProxyKKPlus(accountSetupWebviewBinding.loginWebview); accountSetupWebviewBinding.loginWebview.getSettings().setAllowFileAccess(false); accountSetupWebviewBinding.loginWebview.getSettings().setJavaScriptEnabled(true); @@ -402,6 +403,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity url = getResources().getString(R.string.webview_login_url); } + new WebViewUtil(this).setProxyKKPlus(accountSetupWebviewBinding.loginWebview); if (url.startsWith(HTTPS_PROTOCOL)) { strictMode = true; } diff --git a/app/src/main/java/com/owncloud/android/ui/activity/EditorWebView.java b/app/src/main/java/com/owncloud/android/ui/activity/EditorWebView.java index d3a5367a27..4170e6141e 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/EditorWebView.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/EditorWebView.java @@ -49,6 +49,7 @@ import com.owncloud.android.datamodel.SyncedFolderProvider; import com.owncloud.android.datamodel.ThumbnailsCacheManager; import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.MimeTypeUtil; +import com.owncloud.android.utils.WebViewUtil; import javax.inject.Inject; @@ -82,6 +83,11 @@ public abstract class EditorWebView extends ExternalSiteWebView { this.url = loadedUrl; if (!url.isEmpty()) { + new WebViewUtil(getApplicationContext()).setProxyKKPlus(this.getWebView()); + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + } this.getWebView().loadUrl(url); new Handler().postDelayed(() -> { diff --git a/app/src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java b/app/src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java index 69a17f2235..1282e96f0d 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/ExternalSiteWebView.java @@ -41,6 +41,7 @@ import com.owncloud.android.databinding.ExternalsiteWebviewBinding; import com.owncloud.android.lib.common.utils.Log_OC; import com.owncloud.android.ui.NextcloudWebViewClient; import com.owncloud.android.utils.DisplayUtils; +import com.owncloud.android.utils.WebViewUtil; import java.io.InputStream; @@ -160,6 +161,7 @@ public class ExternalSiteWebView extends FileActivity { } }); + new WebViewUtil(getApplicationContext()).setProxyKKPlus(getWebView()); getWebView().loadUrl(url); } diff --git a/app/src/main/java/com/owncloud/android/utils/WebViewUtil.kt b/app/src/main/java/com/owncloud/android/utils/WebViewUtil.kt index 93dde6c9d3..deb2f998ad 100644 --- a/app/src/main/java/com/owncloud/android/utils/WebViewUtil.kt +++ b/app/src/main/java/com/owncloud/android/utils/WebViewUtil.kt @@ -21,12 +21,21 @@ package com.owncloud.android.utils +import android.annotation.SuppressLint import android.content.Context import android.content.Intent import android.content.pm.PackageManager +import android.net.Proxy import android.net.Uri +import android.text.TextUtils +import android.util.ArrayMap +import android.util.Log +import android.webkit.WebView import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.owncloud.android.R +import com.owncloud.android.lib.common.OwnCloudClientManagerFactory +import java.io.PrintWriter +import java.io.StringWriter class WebViewUtil(private val context: Context) { @@ -107,4 +116,64 @@ class WebViewUtil(private val context: Context) { private fun getMinimumSupportedMajorWebViewVersion(): String { return "118" } + + /** + * From https://stackoverflow.com/a/18453384 + * + * @return + */ + @SuppressLint("PrivateApi", "DiscouragedPrivateApi") + fun setProxyKKPlus(webView: WebView) { + val proxyHost = OwnCloudClientManagerFactory.getProxyHost() + val proxyPort = OwnCloudClientManagerFactory.getProxyPort() + + if (TextUtils.isEmpty(proxyHost) || proxyPort <= 0) { + return + } + + val applicationClassName = "android.app.Application" + Log.d(PROXY_TAG, "Setting proxy with >= 4.4 API.") + + val appContext = webView.context.applicationContext + + System.setProperty("http.proxyHost", proxyHost) + System.setProperty("http.proxyPort", proxyPort.toString()) + System.setProperty("https.proxyHost", proxyHost) + System.setProperty("https.proxyPort", proxyPort.toString()) + try { + val applicationClass = Class.forName(applicationClassName) + val loadedApkField = applicationClass.getField("mLoadedApk") + loadedApkField.isAccessible = true + val loadedApk = loadedApkField[appContext] + val loadedApkCls = Class.forName("android.app.LoadedApk") + val receiversField = loadedApkCls.getDeclaredField("mReceivers") + receiversField.isAccessible = true + val receivers = receiversField[loadedApk] as ArrayMap<*, *> + for (receiverMap in receivers.values) { + for (rec in (receiverMap as ArrayMap<*, *>).keys) { + val clazz: Class<*> = rec.javaClass + if (clazz.name.contains("ProxyChangeListener")) { + val onReceiveMethod = clazz.getDeclaredMethod( + "onReceive", + Context::class.java, + Intent::class.java + ) + val intent = Intent(Proxy.PROXY_CHANGE_ACTION) + onReceiveMethod.invoke(rec, appContext, intent) + } + } + } + Log.d(PROXY_TAG, "Setting proxy with >= 4.4 API successful!") + } catch (e: Exception) { + val sw = StringWriter() + e.printStackTrace(PrintWriter(sw)) + val exceptionAsString = sw.toString() + e.message?.let { Log.v(PROXY_TAG, it) } + Log.v(PROXY_TAG, exceptionAsString) + } + } + + companion object { + private const val PROXY_TAG = "PROXY" + } } diff --git a/app/src/main/res/values/setup.xml b/app/src/main/res/values/setup.xml index 6786cf27db..52acffa65d 100644 --- a/app/src/main/res/values/setup.xml +++ b/app/src/main/res/values/setup.xml @@ -25,6 +25,10 @@ true https://www.nextcloud.com/register + + + -1 + on true