Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/build.gradle
This commit is contained in:
JFronny 2022-10-25 14:15:56 +02:00
commit eaae3fa782
No known key found for this signature in database
GPG key ID: E76429612C2929F4
4 changed files with 30 additions and 15 deletions

View file

@ -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:

View file

@ -47,8 +47,8 @@ android {
minSdk = 21
targetSdk = 30
versionCode = 51
versionName = "3.1.5"
versionCode = 52
versionName = "3.1.6"
resValue("string", "app_version", "${defaultConfig.versionName}${versionNameSuffix ?: ""}")

View file

@ -26,6 +26,7 @@
<package android:name="is.xyz.mpv" />
</queries>
<!-- Without the large heap Exoplayer buffering gets reset due to OOM. -->
<!--TODO https://stackoverflow.com/questions/41799732/chromecast-button-not-visible-in-android-->
<application
android:name=".AcraApplication"
@ -35,6 +36,7 @@
android:fullBackupContent="@xml/backup_descriptor"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"

View file

@ -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<Request?, List<Request>> {
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 {