feat: implement OCR client, worker, and types for text detection#232
Merged
piquark6046 merged 13 commits intomainfrom Apr 1, 2026
Merged
feat: implement OCR client, worker, and types for text detection#232piquark6046 merged 13 commits intomainfrom
piquark6046 merged 13 commits intomainfrom
Conversation
- Add ocr-client.ts for managing OCR requests and responses. - Create ocr-types.ts to define types for OCR operations. - Implement ocr-worker.ts for processing image data and detecting text. - Introduce vuejsawait.ts for handling Vue.js settled events. - Update tsconfig.json to include VM.d.ts for type definitions.
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds an OCR-based detection pipeline to the userscript by introducing an inlined Web Worker (built via esbuild) plus a client wrapper, and hooks it into Vue DOM-settled events to scan for likely ad elements.
Changes:
- Add OCR worker + message types (
ocr-worker.ts,ocr-types.ts) and a browser/userscript-side worker client (ocr-client.ts). - Add Vue mutation “settled” event helper + DOM wait helper to coordinate scanning (
vuejsawait.ts,dom-await.ts). - Update build pipeline to bundle the worker and inline it into the userscript via
__OCR_WORKER_CODE__, plus update grants/deps/tsconfigs.
Reviewed changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| userscript/VM.d.ts | Pulls in Violentmonkey GM typings. |
| userscript/tsconfig.json | Includes the VM type shim in compilation. |
| userscript/source/vuejsawait.ts | Adds Vue DOM mutation “change/settled” event emitter. |
| userscript/source/dom-await.ts | Adds helper to await an element via MutationObserver. |
| userscript/source/ocr-types.ts | Defines OCR worker request/response and match result types. |
| userscript/source/ocr-worker.ts | Implements OCR-like bitmap processing + template matching in a worker. |
| userscript/source/ocr-client.ts | Implements worker client + image loading/rasterization (incl. GM.xmlHttpRequest). |
| userscript/source/index.ts | Replaces prior logic with Vue-settled scanning + OCR detection flow. |
| userscript/package.json | Updates lint deps and adds @violentmonkey/types. |
| tsconfig.json | Removes alwaysStrict override from root config. |
| package.json | Updates shared eslint/typescript-eslint versions. |
| builder/tsconfig.json | Adds types: ["node"] to fix Node typings for builder. |
| builder/source/utils/http-server.ts | Hardens loopback check when remoteAddress is null. |
| builder/source/debug.ts | Tightens types and timer handling in watcher/debug flow. |
| builder/source/build.ts | Bundles OCR worker and inlines code via define.__OCR_WORKER_CODE__. |
| builder/source/banner/index.ts | Adds @grant GM.xmlHttpRequest for OCR client fetches. |
| builder/package.json | Updates toolchain deps (esbuild, eslint, typescript, etc.). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.