From bce4cff7f7144bc91d780e2dd2f8e1114109f407 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Fri, 13 Jun 2025 18:30:50 +0530 Subject: Added background scripts. --- src/scripts/login/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/scripts/login') diff --git a/src/scripts/login/index.ts b/src/scripts/login/index.ts index b7503b9..adbcdbc 100644 --- a/src/scripts/login/index.ts +++ b/src/scripts/login/index.ts @@ -1,3 +1,4 @@ +import Tesseract from "tesseract.js"; import { interceptPost, interceptGet } from "@/shared/intercept-jquery-ajax"; function prepareCaptcha(ctx: CanvasRenderingContext2D, width: number, height: number) { @@ -83,6 +84,12 @@ const observer = new MutationObserver((mutationsList, obs) => { prepareCaptcha(ctx, canvas.width, canvas.height); canvas.style.display = ""; const dataURL = canvas.toDataURL("image/png"); + Tesseract.recognize(canvas, 'eng', { + logger: console.log + }).then(({ data: { text, confidence } }) => { + console.log("OCR Result:", text); + console.log("OCR confidence:", confidence); + }); // TODO: Perform OCR // window.postMessage({ // type: "RUN_OCR", -- cgit v1.2.3