forked from recloudstream/cloudstream
fixed crashing
This commit is contained in:
parent
917ff0ac4a
commit
40c454aed9
1 changed files with 9 additions and 2 deletions
|
@ -12,6 +12,7 @@ import org.jsoup.nodes.Document
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import kotlin.concurrent.thread
|
||||||
|
|
||||||
class TenshiProvider : MainAPI() {
|
class TenshiProvider : MainAPI() {
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -30,8 +31,14 @@ class TenshiProvider : MainAPI() {
|
||||||
override val hasQuickSearch = false
|
override val hasQuickSearch = false
|
||||||
override val hasMainPage = true
|
override val hasMainPage = true
|
||||||
override val supportedTypes = setOf(TvType.Anime, TvType.AnimeMovie, TvType.ONA)
|
override val supportedTypes = setOf(TvType.Anime, TvType.AnimeMovie, TvType.ONA)
|
||||||
|
private var ddosGuardKiller: DdosGuardKiller? = null
|
||||||
|
|
||||||
private val ddosGuardKiller = DdosGuardKiller(true)
|
// Because otherwise Network on main thread when just initializing the provider
|
||||||
|
init {
|
||||||
|
thread {
|
||||||
|
ddosGuardKiller = DdosGuardKiller(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*private fun loadToken(): Boolean {
|
/*private fun loadToken(): Boolean {
|
||||||
return try {
|
return try {
|
||||||
|
@ -345,7 +352,7 @@ class TenshiProvider : MainAPI() {
|
||||||
headers = getHeaders(
|
headers = getHeaders(
|
||||||
mapOf(),
|
mapOf(),
|
||||||
null,
|
null,
|
||||||
ddosGuardKiller.savedCookiesMap[URI(this.mainUrl).host] ?: mapOf()
|
ddosGuardKiller?.savedCookiesMap?.get(URI(this.mainUrl).host) ?: mapOf()
|
||||||
).toMap()
|
).toMap()
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue