fix(weixin): add missing iLink headers to QR code login and clean up error output (#3044)

PR #2943 fixed headers in buildHeaders() but the login flow in
waitForLogin() still used a hardcoded incomplete header object.
Reuse the shared buildHeaders() so all endpoints send consistent
iLink-App-Id and iLink-App-ClientVersion headers.

Also wrap channel.connect() in startSingle() with a try/catch so
configuration errors print a clean message instead of dumping the
yargs help text and a stack trace.
This commit is contained in:
tanzhenxin 2026-04-10 11:36:02 +08:00 committed by GitHub
parent 760df2c144
commit 98a0f78c4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 3 deletions

View file

@ -35,7 +35,7 @@ function randomUin(): string {
return btoa(String.fromCharCode(...buf));
}
function buildHeaders(token?: string): Record<string, string> {
export function buildHeaders(token?: string): Record<string, string> {
const headers: Record<string, string> = {
'Content-Type': 'application/json',
'X-WECHAT-UIN': randomUin(),