From cb0d83a5de3318b1ce272f3d5f34442108ce7782 Mon Sep 17 00:00:00 2001 From: jack Date: Fri, 1 Dec 2023 17:27:44 +0700 Subject: [PATCH] update --- .../main/kotlin/com/hexated/KuramanimeProvider.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProvider.kt b/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProvider.kt index a6ea620e..0d588554 100644 --- a/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProvider.kt +++ b/KuramanimeProvider/src/main/kotlin/com/hexated/KuramanimeProvider.kt @@ -208,14 +208,15 @@ class KuramanimeProvider : MainAPI() { headers = mapOf( "Accept" to "application/json, text/javascript, */*; q=0.01", "Authorization" to "${auth.authHeader}", + "X-Fuck-ID" to "${auth.fidHeader}", "X-Requested-With" to "XMLHttpRequest", "X-CSRF-TOKEN" to token - ) + ).filter { !it.value.isNullOrEmpty() } cookies = req.cookies res.select("select#changeServer option").apmap { source -> val server = source.attr("value") - val query = auth.serverUrl?.queryParameterNames - val link = "$data?${query?.first()}=${getMisc(auth.authUrl)}&${query?.last()}=$server" + val query = auth.serverUrl?.queryParameterNames?.map { it } ?: return@apmap + val link = "$data?${query[0]}=${getMisc(auth.authUrl)}&${query[1]}=$server" if (server.contains(Regex("(?i)kuramadrive|archive"))) { invokeLocalSource(link, server, data, callback) } else { @@ -250,8 +251,8 @@ class KuramanimeProvider : MainAPI() { "GET", url ) ) - val addition = found.second.find { !it.headers["Authorization"].isNullOrBlank() } - return AuthParams(found.first?.url, addition?.url.toString(), addition?.headers?.get("Authorization")) + 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"), addition?.headers?.get("X-Fuck-ID")) } private suspend fun getAuth(url: String) = params ?: fetchAuth(url).also { params = it } @@ -277,6 +278,7 @@ class KuramanimeProvider : MainAPI() { val serverUrl: HttpUrl?, val authUrl: String?, val authHeader: String?, + val fidHeader: String?, ) } \ No newline at end of file