This commit is contained in:
jack 2023-12-01 17:27:44 +07:00
parent 9f81efb652
commit cb0d83a5de

View file

@ -208,14 +208,15 @@ class KuramanimeProvider : MainAPI() {
headers = mapOf( headers = mapOf(
"Accept" to "application/json, text/javascript, */*; q=0.01", "Accept" to "application/json, text/javascript, */*; q=0.01",
"Authorization" to "${auth.authHeader}", "Authorization" to "${auth.authHeader}",
"X-Fuck-ID" to "${auth.fidHeader}",
"X-Requested-With" to "XMLHttpRequest", "X-Requested-With" to "XMLHttpRequest",
"X-CSRF-TOKEN" to token "X-CSRF-TOKEN" to token
) ).filter { !it.value.isNullOrEmpty() }
cookies = req.cookies cookies = req.cookies
res.select("select#changeServer option").apmap { source -> res.select("select#changeServer option").apmap { source ->
val server = source.attr("value") val server = source.attr("value")
val query = auth.serverUrl?.queryParameterNames val query = auth.serverUrl?.queryParameterNames?.map { it } ?: return@apmap
val link = "$data?${query?.first()}=${getMisc(auth.authUrl)}&${query?.last()}=$server" val link = "$data?${query[0]}=${getMisc(auth.authUrl)}&${query[1]}=$server"
if (server.contains(Regex("(?i)kuramadrive|archive"))) { if (server.contains(Regex("(?i)kuramadrive|archive"))) {
invokeLocalSource(link, server, data, callback) invokeLocalSource(link, server, data, callback)
} else { } else {
@ -250,8 +251,8 @@ class KuramanimeProvider : MainAPI() {
"GET", url "GET", url
) )
) )
val addition = found.second.find { !it.headers["Authorization"].isNullOrBlank() } val addition = found.second.find { !it.headers["Authorization"].isNullOrBlank() || !it.headers["X-Fuck-ID"].isNullOrBlank() }
return AuthParams(found.first?.url, addition?.url.toString(), addition?.headers?.get("Authorization")) return AuthParams(found.first?.url, addition?.url.toString(), addition?.headers?.get("Authorization"), addition?.headers?.get("X-Fuck-ID"))
} }
private suspend fun getAuth(url: String) = params ?: fetchAuth(url).also { params = it } private suspend fun getAuth(url: String) = params ?: fetchAuth(url).also { params = it }
@ -277,6 +278,7 @@ class KuramanimeProvider : MainAPI() {
val serverUrl: HttpUrl?, val serverUrl: HttpUrl?,
val authUrl: String?, val authUrl: String?,
val authHeader: String?, val authHeader: String?,
val fidHeader: String?,
) )
} }