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/background/run-ocr.ts | 1 + src/background/second-script.ts | 1 + src/scripts/login/index.ts | 7 +++++++ 3 files changed, 9 insertions(+) create mode 100644 src/background/run-ocr.ts create mode 100644 src/background/second-script.ts (limited to 'src') diff --git a/src/background/run-ocr.ts b/src/background/run-ocr.ts new file mode 100644 index 0000000..d0af073 --- /dev/null +++ b/src/background/run-ocr.ts @@ -0,0 +1 @@ +console.log("THIS IS A BACKGROUND script."); diff --git a/src/background/second-script.ts b/src/background/second-script.ts new file mode 100644 index 0000000..9e3a621 --- /dev/null +++ b/src/background/second-script.ts @@ -0,0 +1 @@ +console.log("THiS IS THE SECOND SCRIPT"); 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