@mtcute/core 0.25.3 → 0.25.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/highlevel/methods/users/resolve-peer.cjs +28 -20
- package/highlevel/methods/users/resolve-peer.js +28 -20
- package/highlevel/updates/manager.cjs +2 -2
- package/highlevel/updates/manager.js +2 -2
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/network/session-connection.cjs +2 -2
- package/network/session-connection.js +2 -2
- package/package.json +1 -1
|
@@ -133,32 +133,40 @@ async function resolvePeer(client, peerId, force = false) {
|
|
|
133
133
|
}
|
|
134
134
|
switch (peerType) {
|
|
135
135
|
case "user": {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
accessHash: Long.ZERO
|
|
140
|
-
});
|
|
141
|
-
if (res != null && res._ === "user" && res.accessHash != null) {
|
|
142
|
-
return {
|
|
143
|
-
_: "inputPeerUser",
|
|
136
|
+
try {
|
|
137
|
+
const res = await batchedQueries._getUsersBatched(client, {
|
|
138
|
+
_: "inputUser",
|
|
144
139
|
userId: bareId,
|
|
145
|
-
accessHash:
|
|
146
|
-
};
|
|
140
|
+
accessHash: Long.ZERO
|
|
141
|
+
});
|
|
142
|
+
if (res != null && res._ === "user" && res.accessHash != null) {
|
|
143
|
+
return {
|
|
144
|
+
_: "inputPeerUser",
|
|
145
|
+
userId: bareId,
|
|
146
|
+
accessHash: res.accessHash
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
} catch (e) {
|
|
150
|
+
if (!tl.tl.RpcError.is(e, "USER_INVALID")) throw e;
|
|
147
151
|
}
|
|
148
152
|
break;
|
|
149
153
|
}
|
|
150
154
|
case "channel": {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
accessHash: Long.ZERO
|
|
155
|
-
});
|
|
156
|
-
if (res != null && res._ === "channel" && res.accessHash != null) {
|
|
157
|
-
return {
|
|
158
|
-
_: "inputPeerChannel",
|
|
155
|
+
try {
|
|
156
|
+
const res = await batchedQueries._getChannelsBatched(client, {
|
|
157
|
+
_: "inputChannel",
|
|
159
158
|
channelId: bareId,
|
|
160
|
-
accessHash:
|
|
161
|
-
};
|
|
159
|
+
accessHash: Long.ZERO
|
|
160
|
+
});
|
|
161
|
+
if (res != null && res._ === "channel" && res.accessHash != null) {
|
|
162
|
+
return {
|
|
163
|
+
_: "inputPeerChannel",
|
|
164
|
+
channelId: bareId,
|
|
165
|
+
accessHash: res.accessHash
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
} catch (e) {
|
|
169
|
+
if (!tl.tl.RpcError.is(e, "CHANNEL_INVALID")) throw e;
|
|
162
170
|
}
|
|
163
171
|
break;
|
|
164
172
|
}
|
|
@@ -126,32 +126,40 @@ async function resolvePeer(client, peerId, force = false) {
|
|
|
126
126
|
}
|
|
127
127
|
switch (peerType) {
|
|
128
128
|
case "user": {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
accessHash: Long.ZERO
|
|
133
|
-
});
|
|
134
|
-
if (res != null && res._ === "user" && res.accessHash != null) {
|
|
135
|
-
return {
|
|
136
|
-
_: "inputPeerUser",
|
|
129
|
+
try {
|
|
130
|
+
const res = await _getUsersBatched(client, {
|
|
131
|
+
_: "inputUser",
|
|
137
132
|
userId: bareId,
|
|
138
|
-
accessHash:
|
|
139
|
-
};
|
|
133
|
+
accessHash: Long.ZERO
|
|
134
|
+
});
|
|
135
|
+
if (res != null && res._ === "user" && res.accessHash != null) {
|
|
136
|
+
return {
|
|
137
|
+
_: "inputPeerUser",
|
|
138
|
+
userId: bareId,
|
|
139
|
+
accessHash: res.accessHash
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
} catch (e) {
|
|
143
|
+
if (!tl.RpcError.is(e, "USER_INVALID")) throw e;
|
|
140
144
|
}
|
|
141
145
|
break;
|
|
142
146
|
}
|
|
143
147
|
case "channel": {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
accessHash: Long.ZERO
|
|
148
|
-
});
|
|
149
|
-
if (res != null && res._ === "channel" && res.accessHash != null) {
|
|
150
|
-
return {
|
|
151
|
-
_: "inputPeerChannel",
|
|
148
|
+
try {
|
|
149
|
+
const res = await _getChannelsBatched(client, {
|
|
150
|
+
_: "inputChannel",
|
|
152
151
|
channelId: bareId,
|
|
153
|
-
accessHash:
|
|
154
|
-
};
|
|
152
|
+
accessHash: Long.ZERO
|
|
153
|
+
});
|
|
154
|
+
if (res != null && res._ === "channel" && res.accessHash != null) {
|
|
155
|
+
return {
|
|
156
|
+
_: "inputPeerChannel",
|
|
157
|
+
channelId: bareId,
|
|
158
|
+
accessHash: res.accessHash
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
} catch (e) {
|
|
162
|
+
if (!tl.RpcError.is(e, "CHANNEL_INVALID")) throw e;
|
|
155
163
|
}
|
|
156
164
|
break;
|
|
157
165
|
}
|
|
@@ -219,9 +219,9 @@ class UpdatesManager {
|
|
|
219
219
|
}
|
|
220
220
|
if (this.pendingUpdateContainers.length % WARN_EVERY === 0) {
|
|
221
221
|
if (this.updatesLoopActive) {
|
|
222
|
-
this.log.warn("%d pending update containers, but the updates loop is not active. did you forget to start it?", this.pendingUpdateContainers.length);
|
|
223
|
-
} else {
|
|
224
222
|
this.log.warn("%d pending update containers, can't keep up!", this.pendingUpdateContainers.length);
|
|
223
|
+
} else {
|
|
224
|
+
this.log.warn("%d pending update containers, but the updates loop is not active. did you forget to start it?", this.pendingUpdateContainers.length);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
this.updatesLoopCv.notify();
|
|
@@ -212,9 +212,9 @@ class UpdatesManager {
|
|
|
212
212
|
}
|
|
213
213
|
if (this.pendingUpdateContainers.length % WARN_EVERY === 0) {
|
|
214
214
|
if (this.updatesLoopActive) {
|
|
215
|
-
this.log.warn("%d pending update containers, but the updates loop is not active. did you forget to start it?", this.pendingUpdateContainers.length);
|
|
216
|
-
} else {
|
|
217
215
|
this.log.warn("%d pending update containers, can't keep up!", this.pendingUpdateContainers.length);
|
|
216
|
+
} else {
|
|
217
|
+
this.log.warn("%d pending update containers, but the updates loop is not active. did you forget to start it?", this.pendingUpdateContainers.length);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
this.updatesLoopCv.notify();
|
|
@@ -536,8 +536,9 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
536
536
|
this.log.error("received rpc_result for %s request %l", msg._, reqMsgId);
|
|
537
537
|
return;
|
|
538
538
|
}
|
|
539
|
-
longUtils.removeFromLongArray(this._session.queuedStateReq, reqMsgId);
|
|
540
539
|
const rpc = msg.rpc;
|
|
540
|
+
longUtils.removeFromLongArray(this._session.queuedStateReq, reqMsgId);
|
|
541
|
+
this._session.getStateSchedule.remove(rpc);
|
|
541
542
|
rpc.resetAbortSignal?.();
|
|
542
543
|
const resultConstructorId = message.peekUint();
|
|
543
544
|
let result;
|
|
@@ -660,7 +661,6 @@ class SessionConnection extends persistentConnection.PersistentConnection {
|
|
|
660
661
|
this._onMessageAcked(rpc.containerId);
|
|
661
662
|
}
|
|
662
663
|
longUtils.removeFromLongArray(this._session.queuedResendReq, msgId);
|
|
663
|
-
this._session.getStateSchedule.remove(rpc);
|
|
664
664
|
break;
|
|
665
665
|
}
|
|
666
666
|
case "bind":
|
|
@@ -529,8 +529,9 @@ class SessionConnection extends PersistentConnection {
|
|
|
529
529
|
this.log.error("received rpc_result for %s request %l", msg._, reqMsgId);
|
|
530
530
|
return;
|
|
531
531
|
}
|
|
532
|
-
removeFromLongArray(this._session.queuedStateReq, reqMsgId);
|
|
533
532
|
const rpc = msg.rpc;
|
|
533
|
+
removeFromLongArray(this._session.queuedStateReq, reqMsgId);
|
|
534
|
+
this._session.getStateSchedule.remove(rpc);
|
|
534
535
|
rpc.resetAbortSignal?.();
|
|
535
536
|
const resultConstructorId = message.peekUint();
|
|
536
537
|
let result;
|
|
@@ -653,7 +654,6 @@ class SessionConnection extends PersistentConnection {
|
|
|
653
654
|
this._onMessageAcked(rpc.containerId);
|
|
654
655
|
}
|
|
655
656
|
removeFromLongArray(this._session.queuedResendReq, msgId);
|
|
656
|
-
this._session.getStateSchedule.remove(rpc);
|
|
657
657
|
break;
|
|
658
658
|
}
|
|
659
659
|
case "bind":
|