Skip to content

Commit

Permalink
Fix for bug#259
Browse files Browse the repository at this point in the history
**Root cause**

The client constructor relies on the `getUser` method of the
`miscRequests` module, which requires location-specific URL to be passed
as one of its arguments.

Added a property `location` to the `clientOptions` object passed to the
client constructor. This `location` field will then be passed to the
`getUser` method within the constructor.
  • Loading branch information
narayanan-gokul committed Sep 15, 2024
1 parent 6cc1a40 commit 4b7f288
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ module.exports = class Client {
* @prop {string} [signature] User auth token signature (in 'sessionid_sign' cookie)
* @prop {boolean} [DEBUG] Enable debug mode
* @prop {'data' | 'prodata' | 'widgetdata'} [server] Server type
* @prop {string} [location] Auth page location (For france: https://fr.tradingview.com/)
*/

/** Client object
Expand All @@ -234,6 +235,7 @@ module.exports = class Client {
misc.getUser(
clientOptions.token,
clientOptions.signature ? clientOptions.signature : '',
clientOptions.location ? clientOptions.location : "https://tradingview.com",
).then((user) => {
this.#sendQueue.unshift(protocol.formatWSPacket({
m: 'set_auth_token',
Expand Down

0 comments on commit 4b7f288

Please sign in to comment.