Skip to content

Add WhatsApp Chinese send guard - #2560

Open
huic0279-stack wants to merge 1 commit into
ferdium:developfrom
huic0279-stack:onechat/chinese-send-guard
Open

huic0279-stack wants to merge 1 commit into
ferdium:developfrom
huic0279-stack:onechat/chinese-send-guard

Conversation

@huic0279-stack

@huic0279-stack huic0279-stack commented Sep 14, 2026 •

Copy link
Copy Markdown

Pre-flight Checklist

Please ensure you've completed all of the following.

Description of Change

Adds a WebView preload send guard that blocks WhatsApp/Ferdium drafts containing Han characters before the first real send attempt.

The guard intercepts Enter, beforeinput paragraph, submit, and send-button click/touch attempts before they can reach WhatsApp send handling. It allows drafts without Han characters, including English, numbers, emoji, URLs, email addresses, and Chinese punctuation-only text.

This also adds focused unit tests for the blocking policy and documents the VM 103 installed-Ferdium hotfix path used during validation.

Motivation and Context

OneChat stage 1 needs Chinese customer-facing drafts to fail closed: if a WhatsApp input contains Chinese Han characters, the first send attempt must be blocked so Chinese text cannot be sent to customers by mistake.

IME composition is ignored until the draft text is committed.

Screenshots

Validated manually on VM 103 WhatsApp/Ferdium:

  • 你好 was blocked with: 检测到中文,已阻止发送。中文不会发送给客户。
  • Hello 123 😀 https://example.com a@b.com was allowed.

Checklist

  • My pull request is properly named
  • Focused lint/typecheck/tests passed; full pre-commit was blocked by existing .tmp/translation-panel.js Biome size limit
  • pnpm test passes
  • I tested/previewed my changes locally

Release Notes

Add a WhatsApp/Ferdium Chinese send guard that blocks drafts containing Han characters before send.

@huic0279-stack

Copy link
Copy Markdown
Author

Hi maintainers, this PR is ready for review. The two GitHub Actions workflows are awaiting maintainer approval.

@huic0279-stack

Copy link
Copy Markdown
Author

Local validation completed:

  • pnpm test test/webview/sendGuard.test.ts --runInBand: passed
  • pnpm typecheck: passed
  • pnpm exec eslint src/webview/sendGuard.ts src/webview/recipe.ts test/webview/sendGuard.test.ts --max-warnings 0: passed
  • node esbuild.mjs: passed

Manual VM 103 WhatsApp/Ferdium validation:

  • 你好 was blocked before send with: 检测到中文,已阻止发送。中文不会发送给客户。
  • Hello 123 😀 https://example.com a@b.com was allowed

The two GitHub Actions workflows are still awaiting maintainer approval.

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.

1 participant