Skip to content

feat: implement OCR client, worker, and types for text detection#232

Merged
piquark6046 merged 13 commits intomainfrom
fix/OCR
Apr 1, 2026
Merged

feat: implement OCR client, worker, and types for text detection#232
piquark6046 merged 13 commits intomainfrom
fix/OCR

Conversation

@piquark6046
Copy link
Copy Markdown
Member

No description provided.

- 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.
@piquark6046 piquark6046 marked this pull request as ready for review April 1, 2026 06:12
Copilot AI review requested due to automatic review settings April 1, 2026 06:12
…tion or class'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
piquark6046 and others added 3 commits April 1, 2026 15:13
…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>
piquark6046 and others added 2 commits April 1, 2026 15:17
…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>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

piquark6046 and others added 4 commits April 1, 2026 15:21
…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>
@piquark6046 piquark6046 merged commit b5d4952 into main Apr 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants