forked from az4521/TachiyomiAZ
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add FlareSolverr to bypass cloudflare #1124
Open
kaiserbh
wants to merge
14
commits into
jobobby04:master
Choose a base branch
from
kaiserbh:feat/add-flare-solverr-bypass-cf
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+372
−8
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d72d9ca
feat: added FlareSolverr to bypass CF anti-bot.
kaiserbh dbaedcd
Merge branch 'master' of https://github.com/jobobby04/TachiyomiSY int…
kaiserbh dd7c874
chore: add summary to Test FlareSolverr button.
kaiserbh aab8b6e
refactor: move the check into the ShouldIntercept.
kaiserbh 15db7c5
refactor: add the option to only add cf_clearance cookie.
kaiserbh 51896bf
refactor: update summary.
kaiserbh 299cdd8
refactor: Improved cookie handling.
kaiserbh ead9079
chore: detekt stuff.
kaiserbh 8305100
Merge branch 'master' of https://github.com/jobobby04/TachiyomiSY int…
kaiserbh 9552544
refactor: use kotlinx, and avoid using org.JSON
kaiserbh 15126f0
Merge remote-tracking branch 'refs/remotes/upstream/master' into feat…
kaiserbh 8902355
chore: fix?
kaiserbh edf35a0
fix: working version.
kaiserbh 022f2a4
chore: optimize imports.
kaiserbh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package eu.kanade.tachiyomi.network | ||
|
||
import android.util.Log | ||
import android.webkit.CookieManager | ||
import okhttp3.Cookie | ||
import okhttp3.CookieJar | ||
|
@@ -51,4 +52,40 @@ class AndroidCookieJar : CookieJar { | |
fun removeAll() { | ||
manager.removeAllCookies {} | ||
} | ||
|
||
fun addAll(url: HttpUrl, cookies: List<Cookie>) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove debug logs if you are done with them, cookies shouldn't be logged if possible |
||
val urlString = url.toString() | ||
Log.d("AndroidCookieJar", "Adding cookies to URL: $urlString") | ||
|
||
// Log incoming cookies to add | ||
cookies.forEach { newCookie -> | ||
Log.d("AndroidCookieJar", "Incoming cookie: ${newCookie.name}=${newCookie.value}") | ||
} | ||
|
||
// Get existing cookies for the URL | ||
val existingCookies = manager.getCookie(urlString)?.split("; ")?.associate { | ||
val (name, value) = it.split('=', limit = 2) | ||
name to value | ||
}?.toMutableMap() ?: mutableMapOf() | ||
|
||
Log.d("AndroidCookieJar", "Existing cookies: $existingCookies") | ||
|
||
// Add or update the cookies | ||
cookies.forEach { newCookie -> | ||
Log.d("AndroidCookieJar", "Adding/updating cookie: ${newCookie.name}=${newCookie.value}") | ||
existingCookies[newCookie.name] = newCookie.value | ||
} | ||
|
||
// Convert the map back to a string and set it in the cookie manager | ||
val finalCookiesString = existingCookies.entries.joinToString("; ") { "${it.key}=${it.value}" } | ||
Log.d("AndroidCookieJar", "Final cookies string: $finalCookiesString") | ||
manager.setCookie(urlString, finalCookiesString) | ||
|
||
// Verify if cookies are set correctly | ||
val setCookies = manager.getCookie(urlString) | ||
Log.d("AndroidCookieJar", "Set cookies in manager: $setCookies") | ||
|
||
Log.d("AndroidCookieJar", "All cookies added for URL: $urlString") | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the networkManager http client here?