aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/login/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripts/login/index.ts')
-rw-r--r--src/scripts/login/index.ts7
1 files changed, 7 insertions, 0 deletions
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",