From 4b7f2881e5b07be52fa55ef4e640c76aecf89c34 Mon Sep 17 00:00:00 2001 From: Gokul Narayanan Date: Sun, 15 Sep 2024 08:18:48 +0530 Subject: [PATCH] Fix for bug#259 **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. --- src/client.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/client.js b/src/client.js index 8a07c4d..673de6b 100644 --- a/src/client.js +++ b/src/client.js @@ -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 @@ -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',