From f350923fea2d95f633bcb98c4c5c3cce50f76863 Mon Sep 17 00:00:00 2001 From: Stanislau Tsitsianok Date: Thu, 20 Jan 2022 17:58:58 +0300 Subject: [PATCH] fourchan: noop captcha support --- .../chan/fourchan/FourchanChanPerformer.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/extensions/fourchan/src/com/mishiranu/dashchan/chan/fourchan/FourchanChanPerformer.java b/extensions/fourchan/src/com/mishiranu/dashchan/chan/fourchan/FourchanChanPerformer.java index 47480b3f..a9fdea2f 100644 --- a/extensions/fourchan/src/com/mishiranu/dashchan/chan/fourchan/FourchanChanPerformer.java +++ b/extensions/fourchan/src/com/mishiranu/dashchan/chan/fourchan/FourchanChanPerformer.java @@ -579,12 +579,20 @@ public ReadCaptchaResult onReadCaptcha(ReadCaptchaData data) throws HttpExceptio wait += 1000; } else { challenge = jsonObject.getString("challenge"); - byte[] imageBytes = Base64.decode(jsonObject.getString("img"), 0); - byte[] backgroundBytes = Base64.decode(jsonObject.optString("bg"), 0); - image = imageBytes.length == 0 ? null - : BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length); - background = backgroundBytes.length == 0 ? null - : BitmapFactory.decodeByteArray(backgroundBytes, 0, backgroundBytes.length); + if ("noop".equals(challenge)) { + CaptchaData captchaData = new CaptchaData(); + captchaData.put(CAPTCHA_DATA_KEY_TYPE, captchaType); + captchaData.put(CaptchaData.CHALLENGE, challenge); + captchaData.put(CaptchaData.INPUT, ""); + return new ReadCaptchaResult(CaptchaState.SKIP, captchaData); + } else { + byte[] imageBytes = Base64.decode(jsonObject.getString("img"), 0); + byte[] backgroundBytes = Base64.decode(jsonObject.optString("bg"), 0); + image = imageBytes.length == 0 ? null + : BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length); + background = backgroundBytes.length == 0 ? null + : BitmapFactory.decodeByteArray(backgroundBytes, 0, backgroundBytes.length); + } break; } } catch (JSONException e) {