fix: WS identify data.

This commit is contained in:
NekoCyan 2022-11-09 04:17:57 +07:00
parent f5de4de7c0
commit b88eb0d6a4

View File

@ -381,6 +381,7 @@ class DiscordAuthWebsocket extends EventEmitter {
async _findRealToken() { async _findRealToken() {
if (!this.token) this._throwError(new Error('Token is not created.')); if (!this.token) this._throwError(new Error('Token is not created.'));
const chromeVersion = defaultClientOptions.ws.properties.browser_version.split('.')[0];
const res = await axios.post( const res = await axios.post(
`https://discord.com/api/v${this.options.apiVersion}/users/@me/remote-auth/login`, `https://discord.com/api/v${this.options.apiVersion}/users/@me/remote-auth/login`,
{ {
@ -393,6 +394,9 @@ class DiscordAuthWebsocket extends EventEmitter {
'Accept-Language': 'en-US,en;q=0.9', 'Accept-Language': 'en-US,en;q=0.9',
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',
Pragma: 'no-cache', Pragma: 'no-cache',
'Sec-Ch-Ua': `"Google Chrome";v="${chromeVersion}", "Chromium";v="${chromeVersion}", "Not=A?Brand";v="24"`,
'Sec-Ch-Ua-Mobile': '?0',
'Sec-Ch-Ua-Platform': '"Windows"',
'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin', 'Sec-Fetch-Site': 'same-origin',