diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/background/run-ocr.ts | 8 | ||||
| -rw-r--r-- | src/background/second-script.ts | 1 | ||||
| -rw-r--r-- | src/scripts.json | 4 | ||||
| -rw-r--r-- | src/scripts/login/index.ts | 7 |
4 files changed, 11 insertions, 9 deletions
diff --git a/src/background/run-ocr.ts b/src/background/run-ocr.ts index d0af073..d61e71a 100644 --- a/src/background/run-ocr.ts +++ b/src/background/run-ocr.ts @@ -1 +1,7 @@ -console.log("THIS IS A BACKGROUND script."); +chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => { + if (message.type === "ping") { + console.log("Received ping from content script"); + console.log(message.data); + sendResponse({ text: "pong" }); + } +}); diff --git a/src/background/second-script.ts b/src/background/second-script.ts deleted file mode 100644 index 9e3a621..0000000 --- a/src/background/second-script.ts +++ /dev/null @@ -1 +0,0 @@ -console.log("THiS IS THE SECOND SCRIPT"); diff --git a/src/scripts.json b/src/scripts.json index 74a465d..715ad4d 100644 --- a/src/scripts.json +++ b/src/scripts.json @@ -1,7 +1,6 @@ { "injected": { "stop-blocking.ts": "*", - "login/index.ts": "*", "otps/grievance-application.ts": "GrievAppViewAction.action", "otps/mutation-application.ts": "MuteApplication.action", "otps/warish-application.ts": "WarishAppViewAction.action", @@ -10,5 +9,8 @@ "captcha/know-your-property.ts": "KnowYourProperty.action", "captcha/application-receipt.ts": "Apprecrep.action", "functionality/sheet-map/index.ts": "SheetMapViewAction.action" + }, + "after": { + "login/index.ts": "*" } } diff --git a/src/scripts/login/index.ts b/src/scripts/login/index.ts index adbcdbc..dacc90a 100644 --- a/src/scripts/login/index.ts +++ b/src/scripts/login/index.ts @@ -84,12 +84,7 @@ 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); - }); + chrome.runtime.sendMessage({ type: "ping", data: "hello background" }).then(console.log); // TODO: Perform OCR // window.postMessage({ // type: "RUN_OCR", |
