-
-
Notifications
You must be signed in to change notification settings - Fork 755
fix: use config.AppOs directly to resolve connection/pairing issues #487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ient pairing instead of hardcoded or formatted strings.
WalkthroughTwo source files updated to utilize dynamic Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (2)
src/infrastructure/whatsapp/init.go(1 hunks)src/usecase/app.go(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/infrastructure/whatsapp/init.go (1)
src/config/settings.go (1)
AppOs(11-11)
src/usecase/app.go (1)
src/config/settings.go (1)
AppOs(11-11)
🔇 Additional comments (1)
src/infrastructure/whatsapp/init.go (1)
151-151: Refactoring approach is correct, but verify config.AppOs value.The removal of AppVersion concatenation aligns with the PR objective. However, as noted in the review of
src/usecase/app.goline 154, please verify thatconfig.AppOscontains a valid WhatsApp OS identifier rather than a developer name.
|
|
||
| logrus.Infof("[DEBUG] Starting phone pairing for number: %s", phoneNumber) | ||
| loginCode, err = client.PairPhone(ctx, phoneNumber, true, whatsmeow.PairClientChrome, "Chrome (Linux)") | ||
| loginCode, err = client.PairPhone(ctx, phoneNumber, true, whatsmeow.PairClientChrome, config.AppOs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# Search for config.AppOs definition
rg "AppOs" --type go -B 2 -A 2Repository: aldinokemal/go-whatsapp-web-multidevice
Length of output: 222
🏁 Script executed:
# Also search for config structure and initialization
fd "config" --type go -x rg -l "config" {} +Repository: aldinokemal/go-whatsapp-web-multidevice
Length of output: 222
🌐 Web query:
WhatsApp Web device pairing valid OS identifier values whatsmeow Go
💡 Result:
Short answer: whatsmeow requires the companion "client display name" be formatted "Browser (OS)" and the server will reject unknown/odd OS strings — use a common OS name (e.g. Windows, macOS, Linux, Android, iOS, Chrome OS). The whatsmeow docs and source show the check and reference WhatsApp's FAQ. Source: whatsmeow PairPhone implementation and docs. [1][2]
If you need the exact server-side whitelist (the precise allowed OS strings), I can probe it (try pairing with candidate values and show which are accepted) or try to locate the authoritative list in WhatsApp's code/FAQ — which one do you want?
Sources:
- whatsmeow PairPhone docs/source (clientDisplayName must be "Browser (OS)"). [1]
- whatsmeow pair-code implementation (sends companion_platform_display to server; server validates). [2]
config.AppOs must use a standard OS identifier recognized by WhatsApp.
The whatsmeow library enforces that the client display name follows the format "Browser (OS)" and the WhatsApp server validates and rejects unknown or non-standard OS strings. Valid OS identifiers include: Windows, macOS, Linux, Android, iOS, and Chrome OS. Using "AldinoKemal" (or any non-standard value) will cause the server to reject the pairing request, defeating the PR's goal of resolving connection issues.
🤖 Prompt for AI Agents
In src/usecase/app.go around line 154, the call passes config.AppOs which
currently can contain a non-standard value like "AldinoKemal" that WhatsApp
rejects; replace or normalize config.AppOs to a standard OS identifier
recognized by WhatsApp (e.g., "Windows", "macOS", "Linux", "Android", "iOS", or
"Chrome OS") before calling client.PairPhone, or add a mapping/validation step
that converts custom values to one of the accepted strings and use that
normalized value in the PairPhone call.
Description
This PR addresses connection and pairing issues (e.g., "Unable to link device" or infinite loading during pairing) caused by the non-standard OS name format sent during the handshake.
Changes
Why
Some WhatsApp anti-bot measures seem to flag the custom OS string format (e.g., "Chrome v7.10.1"). By allowing the user to specify a clean OS name (e.g., "Chrome" or "Mac OS") via the config, these connection issues are resolved.