Closed Twinov closed 1 year ago
Yeah, I get the same issue. I'm honestly thinking of just scrapping the native view for the captcha and going all in on WebView to just stop dealing with these problems. I'm already basically halfway there anyways with the solver WebView. I don't really know how Tachiyomi's stuff was architected because that's where I pulled the interceptor from in the first place.
Workaround for testing at least: you can use the post menu->report->load captcha trick to get working cookies without having to reinstall the app over and over hoping it works.
I have tried that before, but it never worked for me. I think emulators sharing the network kinda fucks with Cloudflare and makes it more fickle.
I have a design decision question I'd like to ask actually. Because OkHttp doesn't allow for asynchronous interceptors, that is, interceptors run and block the main/ui thread, maybe changing the Cloudflare interceptor to fail immediately instead of blocking while a WebView asynchronously in the background does the Cloudflare integrity check, and subsequent calls that require the cookie would return either with a failure (cookie not yet retrieved) or success (cookie exists), maybe that would resolve this issue. I kinda think the 12 second timeout is causing issues or Cloudflare just doesn't like emulators.
Also I think the report trick doesn't work all the time because the Cloudflare interceptor clears out the old cookie every single time, and it doesn't say that you've successfully gotten Cloudflare to pass unless you've got a new cookie that's different from the old one. Weird to me, but that's how Tachiyomi does it.
I think this might be the same thing as #1431, which was closed with 003fe47c0f0547c497aac5d3b10f2e30a2b28e30. Let me know if this needs to be reopened.
I haven't encountered this on the release APK, but when testing changes and rebuiliding the app on my phone, a lot of the times the build will get into a state where attempting to post will try to load the cloudflare bypass and then kick out of the captcha screen with a "Couldn't initialize captcha, reason: Could not do cloudflare bypass!" toast. Seems really random, some builds it always fails even with no code changes. I've tried clearing cookies from the site list but doesn't seem to fix it. Is there a workaround for this? Makes testing pretty annoying. Screenshot of error toast:![image](https://user-images.githubusercontent.com/23278147/199864893-72801b67-52d3-4322-acad-81817c652565.png)