diff options
| author | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2025-06-14 02:01:26 +0530 |
|---|---|---|
| committer | Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> | 2025-06-14 02:01:26 +0530 |
| commit | 44bd0df461e486ef64c67e75b9073344a2a00a07 (patch) | |
| tree | 000b2c2abb372da320550e10617010d853a4521b | |
| parent | b4169b8a4ec4f5fda7ceab8f197ac73d0743c49b (diff) | |
| download | banglar-bhumi-utils-44bd0df461e486ef64c67e75b9073344a2a00a07.tar.gz banglar-bhumi-utils-44bd0df461e486ef64c67e75b9073344a2a00a07.zip | |
Fixed confidence being undefined.
The confidence rating wasn't being passed from the background script to the content script.
| -rw-r--r-- | src/background/run-ocr.ts | 2 | ||||
| -rw-r--r-- | src/scripts/login/index.ts | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/background/run-ocr.ts b/src/background/run-ocr.ts index 4476f54..7975fc0 100644 --- a/src/background/run-ocr.ts +++ b/src/background/run-ocr.ts @@ -27,7 +27,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { }); if (offscreenResponse && offscreenResponse.success) { - sendResponse({ success: true, text: offscreenResponse.text }); + sendResponse(offscreenResponse); } else { sendResponse({ success: false, error: offscreenResponse?.error || "Unknown OCR error" }); } diff --git a/src/scripts/login/index.ts b/src/scripts/login/index.ts index 6e459a5..bed05f9 100644 --- a/src/scripts/login/index.ts +++ b/src/scripts/login/index.ts @@ -89,11 +89,12 @@ const observer = new MutationObserver((mutationsList, obs) => { { type: "OCR", dataURL }, ({ success, text, confidence }) => { if (success) { - if (confidence < 85) { + const textResult = text.trim(); + if (confidence < 80 || textResult.length !== 6) { // Reset the captcha if confidence is low img.src = "generateCaptcha?" + new Date().getTime(); } else { - captchaInput.value = text; + captchaInput.value = textResult; } } }, |
