-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat: customise linked device name #3325
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
@@ -3,6 +3,9 @@ const { Client, Location, Poll, List, Buttons, LocalAuth } = require('./index'); | |||
const client = new Client({ | |||
authStrategy: new LocalAuth(), | |||
// proxyAuthentication: { username: 'username', password: 'password' }, | |||
/** Check https://github.com/pedroslopez/whatsapp-web.js/pull/3325 for full explanation. */ |
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.
The explanation and details should be either in example itself or in readme.md.
Imo, it's not a good practice to have a link to VCS (especially in github).
We've seen many github repos got removed and we'll lose important notes :)
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.
Seems to be compliant enough. Tested and provides correct browser data in the initial socket header (clientPayload)
PR Details
The PR implements a functionality for setting a device and/or a browser names of a paired device.
Description
Once you paired the web client, you can see it in your linked devices section in the phone.
The PR adds a possibility to customize names of your linked devices.
By default, the library uses user agent for macOS with Google Chrome platform:
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36'
That's the reason why you see
Google Chrome (MacOS)
in the linked device section.In order to customize it you can provide values for two new properties while creating a new
Client
instance:deviceName
browserName
Tip
Valid values for
browserName
are:'Chrome'
|'Firefox'
|'IE'
|'Opera'
|'Safari'
|'Edge'
1. If you want to change the browser type only:
The preview (click to expand)
2. If you want to change the device name only, the browser type will be retrieved from the user agent (in our case it is Google Chrome):
The preview (click to expand)
3. If you want to change both, the browser type and the device name:
The preview (click to expand)
4. If you want only the device name to be shown, you can do it that way:
The preview (click to expand)
5. If the provided value for the
browserName
will be something else, but not one of the valid values, the linked device will be displayed with a OS type retrieved from the user agent:The preview (click to expand)
How Has This Been Tested
Tested with a code provided in usage examples above.
You can try the feature by running one of the following commands:
Types of changes
Checklist