fix(weixin): macOS SSL cert verification, QR scan data, and refresh rendering#8730
Closed
shenuu wants to merge 1 commit into
Closed
fix(weixin): macOS SSL cert verification, QR scan data, and refresh rendering#8730shenuu wants to merge 1 commit into
shenuu wants to merge 1 commit into
Conversation
- Use certifi CA bundle for aiohttp SSL in qr_login(), start(), and send_weixin_direct() to fix SSL verification failures against Tencent's iLink server on macOS (Homebrew OpenSSL lacks system certs) - Fix QR code data: encode qrcode_img_content (full liteapp URL) instead of raw hex token — WeChat needs the full URL to resolve the scan - Render ASCII QR on refresh so the user can re-scan without restarting - Improve error message on QR render failure to show the actual exception Tested on macOS (Apple Silicon, Homebrew Python 3.13)
Contributor
|
Merged as part of Batch-5 salvage: #11634 Your commit cherry-picked onto Commit SHA on main: 3a0ec1d |
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.
Summary
Three bugs that prevent WeChat QR login from working on macOS (Apple Silicon / Homebrew Python 3.13).
1. SSL Certificate Failure
aiohttpuses Homebrew's OpenSSL cert store, which cannot verify Tencent's iLink server (ilinkai.weixin.qq.com). Fix: usecertifiCA bundle viaTCPConnector(ssl=...)in all threeClientSessionlocations:qr_login()— QR setupWeixinAdapter.start()— runtime pollingsend_weixin_direct()— one-shot outbound sends (cron,send_messagetool)2. Wrong Data Encoded in QR Code
The API returns two fields:
qrcode: raw hex token (e.g.2fef748912e6e765...) — NOT scannable by WeChatqrcode_img_content: full liteapp URL (e.g.https://liteapp.weixin.qq.com/q/7GiQu1?qrcode=...) — this is what WeChat needsThe previous code encoded
qrcode_url or qrcode_value, but since both were truthy strings, it always fell through toqrcode_value(the hex). Fix: explicitly preferqrcode_img_content.3. No QR Re-render on Refresh
When the QR code expired and was refreshed, only the URL was printed — no ASCII QR block was rendered. Added the same
qrcode.print_ascii()render in the refresh path.Testing
Verified end-to-end on macOS 14 (Apple Silicon), Homebrew Python 3.13,
certifiinstalled in the hermes venv.