@@ -180,7 +180,7 @@ public static OkHttpClient getHttpClientWithCache() {
180180 @ SuppressLint ("SetJavaScriptEnabled" )
181181 public static void captchaWebview (String url ) {
182182 if (hasWebView ) {
183- // Open the specified url in a webview
183+ // Open the specified url in a webview
184184 WebView webView = new WebView (mainApplication );
185185 webView .getSettings ().setJavaScriptEnabled (true );
186186 webView .getSettings ().setUserAgentString (androidacyUA );
@@ -203,13 +203,11 @@ public static byte[] doHttpGet(String url, boolean allowCache) throws IOExceptio
203203 }
204204 Response response = (allowCache ? getHttpClientWithCache () : getHttpClient ()).newCall (new Request .Builder ().url (url ).get ().build ()).execute ();
205205 // 200/204 == success, 304 == cache valid
206- if (response .code () != 200 && response .code () != 204 && (response .code () != 304 || !allowCache )) {
207- // If error is 403 and it's an Androidacy link, it's probably a 403 from Cloudflare
208- // and we should open a webview to solve the captcha
209- if (response .code () == 403 && AndroidacyUtil .isAndroidacyLink (url )) {
210- // Open webview to solve captcha
211- captchaWebview (url );
212- }
206+ if (response .code () == 403 && AndroidacyUtil .isAndroidacyLink (url )) {
207+ // Open webview to solve captcha
208+ Log .e (TAG , "Received 403 error code, opening webview to solve captcha" );
209+ captchaWebview (url );
210+ } else if (response .code () != 200 && response .code () != 204 && (response .code () != 304 || !allowCache )) {
213211 throw new IOException ("Received error code: " + response .code ());
214212 }
215213 ResponseBody responseBody = response .body ();
@@ -243,8 +241,6 @@ private static Object doHttpPostRaw(String url, String data, boolean allowCache,
243241 // Open webview to solve captcha
244242 Log .e (TAG , "Received 403 error code, opening webview to solve captcha" );
245243 captchaWebview (url );
246- } else if (isRedirect ) {
247- return url ;
248244 } else if (response .code () != 200 && response .code () != 204 && (response .code () != 304 || !allowCache )) {
249245 throw new IOException ("Received error code: " + response .code ());
250246 }
0 commit comments