mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
fix request
This commit is contained in:
parent
ef2717c0a7
commit
a07f323fb2
1 changed files with 11 additions and 11 deletions
|
@ -50,17 +50,17 @@ class CloudflareKiller : Interceptor {
|
||||||
|
|
||||||
override fun intercept(chain: Interceptor.Chain): Response = runBlocking {
|
override fun intercept(chain: Interceptor.Chain): Response = runBlocking {
|
||||||
val request = chain.request()
|
val request = chain.request()
|
||||||
val response = chain.proceed(request)
|
|
||||||
val cookies = savedCookies[request.url.host]
|
|
||||||
|
|
||||||
when {
|
when (val cookies = savedCookies[request.url.host]) {
|
||||||
!(response.header("Server") in CLOUDFLARE_SERVERS && response.code in ERROR_CODES) -> {
|
null -> {
|
||||||
return@runBlocking response
|
val response = chain.proceed(request)
|
||||||
}
|
if(!(response.header("Server") in CLOUDFLARE_SERVERS && response.code in ERROR_CODES)) {
|
||||||
cookies == null -> {
|
return@runBlocking response
|
||||||
bypassCloudflare(request)?.let {
|
} else {
|
||||||
Log.d(TAG, "Succeeded bypassing cloudflare: ${request.url}")
|
bypassCloudflare(request)?.let {
|
||||||
return@runBlocking it
|
Log.d(TAG, "Succeeded bypassing cloudflare: ${request.url}")
|
||||||
|
return@runBlocking it
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
|
@ -69,7 +69,7 @@ class CloudflareKiller : Interceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
debugWarning({ true }) { "Failed cloudflare at: ${request.url}" }
|
debugWarning({ true }) { "Failed cloudflare at: ${request.url}" }
|
||||||
return@runBlocking response
|
return@runBlocking chain.proceed(request)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getWebViewCookie(url: String): String? {
|
private fun getWebViewCookie(url: String): String? {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue