From 301980ab1439605a69c47a04425d34e1c07cfffd Mon Sep 17 00:00:00 2001 From: Antoine Aflalo <197810+Belphemur@users.noreply.github.com> Date: Sat, 31 Aug 2024 18:55:02 -0400 Subject: [PATCH] fix(flaresolverr): support possible rewrite flaresolverr (#1020) This PR: https://github.com/FlareSolverr/FlareSolverr/pull/1300 Solve a lot of issue with not solving challenge, however, the cookie don't have path, httpOnly, secure and sameSite. By making them optional that should work for both version of flaresolverr. --- .../network/interceptor/CloudflareInterceptor.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/src/main/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt b/server/src/main/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt index ff0860fc..6a3ba45e 100644 --- a/server/src/main/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt +++ b/server/src/main/kotlin/eu/kanade/tachiyomi/network/interceptor/CloudflareInterceptor.kt @@ -153,13 +153,13 @@ object CFClearance { val name: String, val value: String, val domain: String, - val path: String, + val path: String? = null, val expires: Double? = null, val size: Int? = null, - val httpOnly: Boolean, - val secure: Boolean, + val httpOnly: Boolean? = null, + val secure: Boolean? = null, val session: Boolean? = null, - val sameSite: String, + val sameSite: String? = null, ) @Serializable @@ -228,11 +228,11 @@ object CFClearance { .name(cookie.name) .value(cookie.value) .domain(cookie.domain.removePrefix(".")) - .path(cookie.path) .expiresAt(cookie.expires?.takeUnless { it < 0.0 }?.toLong() ?: Long.MAX_VALUE) .also { - if (cookie.httpOnly) it.httpOnly() - if (cookie.secure) it.secure() + if (cookie.httpOnly != null && cookie.httpOnly) it.httpOnly() + if (cookie.secure != null && cookie.secure) it.secure() + if (!cookie.path.isNullOrEmpty()) it.path(cookie.path) } .build() }