parent
d514463edd
commit
4c7f8ebf68
@ -3,7 +3,7 @@ ext {
|
|||||||
extClass = '.TempleScanEsp'
|
extClass = '.TempleScanEsp'
|
||||||
themePkg = 'madara'
|
themePkg = 'madara'
|
||||||
baseUrl = 'https://aedexnox.vxviral.xyz'
|
baseUrl = 'https://aedexnox.vxviral.xyz'
|
||||||
overrideVersionCode = 5
|
overrideVersionCode = 6
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@ import eu.kanade.tachiyomi.network.interceptor.rateLimitHost
|
|||||||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import keiyoushi.utils.getPreferences
|
import keiyoushi.utils.getPreferences
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
@ -32,14 +32,13 @@ class TempleScanEsp :
|
|||||||
private val fetchedDomainUrl: String by lazy {
|
private val fetchedDomainUrl: String by lazy {
|
||||||
if (!preferences.fetchDomainPref()) return@lazy preferences.prefBaseUrl
|
if (!preferences.fetchDomainPref()) return@lazy preferences.prefBaseUrl
|
||||||
try {
|
try {
|
||||||
val initClient = network.cloudflareClient.newBuilder()
|
val initClient = network.cloudflareClient
|
||||||
.followRedirects(false)
|
|
||||||
.build()
|
|
||||||
val headers = super.headersBuilder().build()
|
val headers = super.headersBuilder().build()
|
||||||
val response = initClient.newCall(GET(preferences.prefBaseUrl, headers)).execute()
|
val document = initClient.newCall(GET("https://templescanesp.net", headers)).execute().asJsoup()
|
||||||
if (!response.isRedirect) return@lazy preferences.prefBaseUrl
|
val domain = document.selectFirst("main a:has(button)")?.attr("abs:href")
|
||||||
val newHost = response.header("Location")?.toHttpUrlOrNull() ?: return@lazy preferences.prefBaseUrl
|
?: return@lazy preferences.prefBaseUrl
|
||||||
val newDomain = "https://${newHost.host}"
|
val host = initClient.newCall(GET(domain, headers)).execute().request.url.host
|
||||||
|
val newDomain = "https://$host"
|
||||||
preferences.prefBaseUrl = newDomain
|
preferences.prefBaseUrl = newDomain
|
||||||
newDomain
|
newDomain
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user