From 034bad289f0b742c881d87e243e06e9cd449df6d Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Sun, 23 Oct 2022 18:59:01 +0200 Subject: [PATCH 1/3] Crashfix + version bump --- app/build.gradle | 4 +- .../cloudstream3/network/WebViewResolver.kt | 37 +++++++++++++------ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index cdc5e652..9df01079 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -35,8 +35,8 @@ android { minSdkVersion 21 targetSdkVersion 30 - versionCode 51 - versionName "3.1.5" + versionCode 52 + versionName "3.1.6" resValue "string", "app_version", "${defaultConfig.versionName}${versionNameSuffix ?: ""}" diff --git a/app/src/main/java/com/lagradost/cloudstream3/network/WebViewResolver.kt b/app/src/main/java/com/lagradost/cloudstream3/network/WebViewResolver.kt index 7b4343d9..9171aed9 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/network/WebViewResolver.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/network/WebViewResolver.kt @@ -7,7 +7,9 @@ import com.lagradost.cloudstream3.AcraApplication import com.lagradost.cloudstream3.AcraApplication.Companion.context import com.lagradost.cloudstream3.USER_AGENT import com.lagradost.cloudstream3.app +import com.lagradost.cloudstream3.mvvm.debugException import com.lagradost.cloudstream3.mvvm.logError +import com.lagradost.cloudstream3.mvvm.normalSafeApiCall import com.lagradost.cloudstream3.utils.Coroutines.main import com.lagradost.cloudstream3.utils.Coroutines.mainWork import com.lagradost.cloudstream3.utils.Coroutines.threadSafeListOf @@ -65,9 +67,15 @@ class WebViewResolver( method: String = "GET", requestCallBack: (Request) -> Boolean = { false }, ): Pair> { - return resolveUsingWebView( - requestCreator(method, url, referer = referer), requestCallBack - ) + return try { + resolveUsingWebView( + requestCreator(method, url, referer = referer), requestCallBack + ) + } catch (e: java.lang.IllegalArgumentException) { + logError(e) + debugException { "ILLEGAL URL IN resolveUsingWebView!" } + return null to emptyList() + } } /** @@ -129,7 +137,7 @@ class WebViewResolver( println("Loading WebView URL: $webViewUrl") if (interceptUrl.containsMatchIn(webViewUrl)) { - fixedRequest = request.toRequest().also { + fixedRequest = request.toRequest()?.also { requestCallBack(it) } println("Web-view request finished: $webViewUrl") @@ -138,9 +146,9 @@ class WebViewResolver( } if (additionalUrls.any { it.containsMatchIn(webViewUrl) }) { - extraRequestList.add(request.toRequest().also { + request.toRequest()?.also { if (requestCallBack(it)) destroyWebView() - }) + }?.let(extraRequestList::add) } // Suppress image requests as we don't display them anywhere @@ -251,14 +259,19 @@ class WebViewResolver( } -fun WebResourceRequest.toRequest(): Request { +fun WebResourceRequest.toRequest(): Request? { val webViewUrl = this.url.toString() - return requestCreator( - this.method, - webViewUrl, - this.requestHeaders, - ) + // If invalid url then it can crash with + // java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but was 'data' + // At Request.Builder().url(addParamsToUrl(url, params)) + return normalSafeApiCall { + requestCreator( + this.method, + webViewUrl, + this.requestHeaders, + ) + } } fun Response.toWebResourceResponse(): WebResourceResponse { From 544f277d0cb87cb2601086286e34aa75c9bfce67 Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Mon, 24 Oct 2022 15:31:35 +0200 Subject: [PATCH 2/3] Fixed player caching being invalidated by OOM --- app/src/main/AndroidManifest.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 216a5f21..d22e95c0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -27,6 +27,7 @@ + Date: Tue, 25 Oct 2022 10:41:12 +0200 Subject: [PATCH 3/3] [skip ci] increase issue analysis threshold --- .github/workflows/issue_action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/issue_action.yml b/.github/workflows/issue_action.yml index 79e7766c..a81c4b42 100644 --- a/.github/workflows/issue_action.yml +++ b/.github/workflows/issue_action.yml @@ -18,7 +18,7 @@ jobs: uses: actions-cool/issues-similarity-analysis@v1 with: token: ${{ steps.generate_token.outputs.token }} - filter-threshold: 0.5 + filter-threshold: 0.60 title-excludes: '' comment-title: | ### Your issue looks similar to these issues: