@mtcute/core 0.27.7 → 0.27.8

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.
@@ -11,7 +11,7 @@ function determinePartSize(fileSize) {
11
11
  if (fileSize <= 262078465) return 128;
12
12
  if (fileSize <= 786432e3) return 256;
13
13
  if (fileSize <= 2097152e3) return 512;
14
- throw new errors.MtArgumentError("File is too large");
14
+ return 1024;
15
15
  }
16
16
  function isProbablyPlainText(buf) {
17
17
  return !buf.some(
@@ -4,7 +4,7 @@ function determinePartSize(fileSize) {
4
4
  if (fileSize <= 262078465) return 128;
5
5
  if (fileSize <= 786432e3) return 256;
6
6
  if (fileSize <= 2097152e3) return 512;
7
- throw new MtArgumentError("File is too large");
7
+ return 1024;
8
8
  }
9
9
  function isProbablyPlainText(buf) {
10
10
  return !buf.some(
@@ -36,7 +36,6 @@ class MtprotoSession {
36
36
  // recent msg ids
37
37
  recentOutgoingMsgIds = new utils.LruSet(1e3, longUtils.LongSet);
38
38
  recentIncomingMsgIds = new utils.LruSet(1e3, longUtils.LongSet);
39
- // eslint-disable-next-line ts/no-unsafe-argument
40
39
  recentStateRequests = new utils.LruMap(1e3, longUtils.LongMap);
41
40
  // queues
42
41
  queuedRpc = new utils.Deque();
@@ -29,7 +29,6 @@ class MtprotoSession {
29
29
  // recent msg ids
30
30
  recentOutgoingMsgIds = new LruSet(1e3, LongSet);
31
31
  recentIncomingMsgIds = new LruSet(1e3, LongSet);
32
- // eslint-disable-next-line ts/no-unsafe-argument
33
32
  recentStateRequests = new LruMap(1e3, LongMap);
34
33
  // queues
35
34
  queuedRpc = new Deque();
@@ -225,7 +225,7 @@ class NetworkManager {
225
225
  _: "initConnection",
226
226
  deviceModel,
227
227
  systemVersion: "1.0",
228
- appVersion: "0.27.7",
228
+ appVersion: "0.27.8",
229
229
  systemLangCode: "en",
230
230
  langPack: "",
231
231
  // "langPacks are for official apps only"
@@ -218,7 +218,7 @@ class NetworkManager {
218
218
  _: "initConnection",
219
219
  deviceModel,
220
220
  systemVersion: "1.0",
221
- appVersion: "0.27.7",
221
+ appVersion: "0.27.8",
222
222
  systemLangCode: "en",
223
223
  langPack: "",
224
224
  // "langPacks are for official apps only"
@@ -21,9 +21,12 @@ class ServerSaltManager {
21
21
  this.currentSalt = salts[0].salt;
22
22
  this._futureSalts.shift();
23
23
  }
24
- if (!this._futureSalts.length) {
25
- this.currentSalt = Long.ZERO;
26
- } else {
24
+ if (salts.length > 0 && salts[0].validSince <= now) {
25
+ this.currentSalt = salts[0].salt;
26
+ this._futureSalts.shift();
27
+ }
28
+ if (!this._futureSalts.length) ;
29
+ else {
27
30
  this._scheduleReplace(this._futureSalts[0]);
28
31
  }
29
32
  }
@@ -14,9 +14,12 @@ class ServerSaltManager {
14
14
  this.currentSalt = salts[0].salt;
15
15
  this._futureSalts.shift();
16
16
  }
17
- if (!this._futureSalts.length) {
18
- this.currentSalt = Long.ZERO;
19
- } else {
17
+ if (salts.length > 0 && salts[0].validSince <= now) {
18
+ this.currentSalt = salts[0].salt;
19
+ this._futureSalts.shift();
20
+ }
21
+ if (!this._futureSalts.length) ;
22
+ else {
20
23
  this._scheduleReplace(this._futureSalts[0]);
21
24
  }
22
25
  }
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@mtcute/core",
3
3
  "type": "module",
4
- "version": "0.27.7",
4
+ "version": "0.27.8",
5
5
  "description": "Type-safe library for MTProto (Telegram API)",
6
6
  "license": "MIT",
7
7
  "scripts": {},
8
8
  "dependencies": {
9
- "@fuman/io": "0.0.17",
10
- "@fuman/net": "0.0.17",
11
- "@fuman/utils": "0.0.17",
12
- "@mtcute/file-id": "^0.27.6",
9
+ "@fuman/io": "0.0.19",
10
+ "@fuman/net": "0.0.19",
11
+ "@fuman/utils": "0.0.19",
12
+ "@mtcute/file-id": "^0.27.8",
13
13
  "@mtcute/tl": "^221.0.0",
14
14
  "@mtcute/tl-runtime": "^0.24.3",
15
15
  "@types/events": "3.0.0",
@@ -95,7 +95,7 @@ class BaseSqliteStorageDriver extends driver.BaseStorageDriver {
95
95
  this.db = this._createDatabase();
96
96
  this._runMany = this.db.transaction((stmts) => {
97
97
  stmts.forEach((stmt) => {
98
- stmt[0].run(stmt[1]);
98
+ stmt[0].run(...stmt[1]);
99
99
  });
100
100
  });
101
101
  this.db.transaction(() => this._initialize())();
@@ -88,7 +88,7 @@ class BaseSqliteStorageDriver extends BaseStorageDriver {
88
88
  this.db = this._createDatabase();
89
89
  this._runMany = this.db.transaction((stmts) => {
90
90
  stmts.forEach((stmt) => {
91
- stmt[0].run(stmt[1]);
91
+ stmt[0].run(...stmt[1]);
92
92
  });
93
93
  });
94
94
  this.db.transaction(() => this._initialize())();