mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	Fixed DdosGuardKiller, SSL on android 9 and some OpenSubtitles fixes
This commit is contained in:
		
							parent
							
								
									263f74fb9c
								
							
						
					
					
						commit
						e21c8f8038
					
				
					 4 changed files with 13 additions and 5 deletions
				
			
		|  | @ -2,7 +2,7 @@ package com.lagradost.cloudstream3.network | |||
| 
 | ||||
| import androidx.annotation.AnyThread | ||||
| import com.lagradost.cloudstream3.app | ||||
| import com.lagradost.nicehttp.Requests.Companion.await | ||||
| import com.lagradost.nicehttp.Requests | ||||
| import com.lagradost.nicehttp.cookies | ||||
| import kotlinx.coroutines.runBlocking | ||||
| import okhttp3.Interceptor | ||||
|  | @ -41,7 +41,8 @@ class DdosGuardKiller(private val alwaysBypass: Boolean) : Interceptor { | |||
|             savedCookiesMap[request.url.host] | ||||
|             // If no cookies are found fetch and save em. | ||||
|                 ?: (request.url.scheme + "://" + request.url.host + (ddosBypassPath ?: "")).let { | ||||
|                     app.get(it, cacheTime = 0).cookies.also { cookies -> | ||||
|                     // Somehow app.get fails | ||||
|                     Requests().get(it).cookies.also { cookies -> | ||||
|                         savedCookiesMap[request.url.host] = cookies | ||||
|                     } | ||||
|                 } | ||||
|  | @ -51,6 +52,6 @@ class DdosGuardKiller(private val alwaysBypass: Boolean) : Interceptor { | |||
|             request.newBuilder() | ||||
|                 .headers(headers) | ||||
|                 .build() | ||||
|         ).await() | ||||
|         ).execute() | ||||
|     } | ||||
| } | ||||
|  | @ -4,15 +4,19 @@ import android.content.Context | |||
| import androidx.preference.PreferenceManager | ||||
| import com.lagradost.cloudstream3.R | ||||
| import com.lagradost.cloudstream3.USER_AGENT | ||||
| import com.lagradost.cloudstream3.mvvm.normalSafeApiCall | ||||
| import com.lagradost.nicehttp.Requests | ||||
| import com.lagradost.nicehttp.ignoreAllSSLErrors | ||||
| import okhttp3.Cache | ||||
| import okhttp3.Headers | ||||
| import okhttp3.Headers.Companion.toHeaders | ||||
| import okhttp3.OkHttpClient | ||||
| import org.conscrypt.Conscrypt | ||||
| import java.io.File | ||||
| import java.security.Security | ||||
| 
 | ||||
| fun Requests.initClient(context: Context): OkHttpClient { | ||||
|     normalSafeApiCall { Security.insertProviderAt(Conscrypt.newProvider(), 1) } | ||||
|     val settingsManager = PreferenceManager.getDefaultSharedPreferences(context) | ||||
|     val dns = settingsManager.getInt(context.getString(R.string.dns_pref), 0) | ||||
|     baseClient = OkHttpClient.Builder() | ||||
|  |  | |||
|  | @ -15,6 +15,8 @@ import com.lagradost.cloudstream3.syncproviders.AuthAPI | |||
| import com.lagradost.cloudstream3.syncproviders.InAppAuthAPI | ||||
| import com.lagradost.cloudstream3.syncproviders.InAppAuthAPIManager | ||||
| import com.lagradost.cloudstream3.utils.AppUtils | ||||
| import java.net.URLEncoder | ||||
| import java.nio.charset.StandardCharsets | ||||
| 
 | ||||
| class OpenSubtitlesApi(index: Int) : InAppAuthAPIManager(index), AbstractSubApi { | ||||
|     override val idPrefix = "opensubtitles" | ||||
|  | @ -175,7 +177,7 @@ class OpenSubtitlesApi(index: Int) : InAppAuthAPIManager(index), AbstractSubApi | |||
|         val searchQueryUrl = when (imdbId > 0) { | ||||
|             //Use imdb_id to search if its valid | ||||
|             true -> "$host/subtitles?imdb_id=$imdbId&languages=${fixedLang}$yearQuery$epQuery$seasonQuery" | ||||
|             false -> "$host/subtitles?query=$queryText&languages=${fixedLang}$yearQuery$epQuery$seasonQuery" | ||||
|             false -> "$host/subtitles?query=${URLEncoder.encode(queryText.lowercase(), StandardCharsets.UTF_8.toString())}&languages=${fixedLang}$yearQuery$epQuery$seasonQuery" | ||||
|         } | ||||
| 
 | ||||
|         val req = app.get( | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue