Fix Web Token login (#2136)

This commit is contained in:
Alexander Zinchuk 2022-11-14 17:28:05 +04:00
parent 47eac1b33f
commit 966e6f7f37

View File

@ -26,8 +26,6 @@ const { updateTwoFaSettings, getTmpPassword } = require('./2fa');
const DEFAULT_DC_ID = 2;
const WEBDOCUMENT_DC_ID = 4;
const DEFAULT_IPV4_IP = 'zws2.web.telegram.org';
const DEFAULT_IPV6_IP = '[2001:67c:4e8:f002::a]';
const EXPORTED_SENDER_RECONNECT_TIMEOUT = 1000; // 1 sec
const EXPORTED_SENDER_RELEASE_TIMEOUT = 30000; // 30 sec
const WEBDOCUMENT_REQUEST_PART_SIZE = 131072; // 128kb
@ -223,8 +221,9 @@ class TelegramClient {
await this.session.load();
if (!this.session.serverAddress || (this.session.serverAddress.includes(':') !== this._useIPV6)) {
this.session.setDC(this.defaultDcId, this._useIPV6
? DEFAULT_IPV6_IP : DEFAULT_IPV4_IP, this._args.useWSS ? 443 : 80);
const DC = utils.getDC(this.defaultDcId);
// TODO Fill IP addresses for when `this._useIPV6` is used
this.session.setDC(this.defaultDcId, DC.ipAddress, this._args.useWSS ? 443 : 80);
}
}