@mtkruto/node 0.0.966 → 0.0.967

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.
@@ -17,11 +17,10 @@ export function getMessageId(lastMsgId) {
17
17
  if (lastMsgId >= (newMsgId)) {
18
18
  newMsgId = lastMsgId + 4n;
19
19
  }
20
- lastMsgId = newMsgId;
21
20
  return newMsgId;
22
21
  }
23
22
  export function packUnencryptedMessage(data, messageId) {
24
- const message = concat(bufferFromBigInt(0x00, 8), bufferFromBigInt(getMessageId(messageId), 8), bufferFromBigInt(data.length, 4), data);
23
+ const message = concat(bufferFromBigInt(0x00, 8), bufferFromBigInt(messageId, 8), bufferFromBigInt(data.length, 4), data);
25
24
  return message;
26
25
  }
27
26
  export function unpackUnencryptedMessage(buffer) {
@@ -61,7 +61,7 @@ export class ConnectionWebSocket {
61
61
  return;
62
62
  }
63
63
  const release = await mutex.acquire();
64
- const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof ArrayBuffer ? v : Array.isArray(v) ? v.map((v) => v.buffer) : v.buffer).flat()).arrayBuffer());
64
+ const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob ? v : v instanceof ArrayBuffer ? v : Array.isArray(v) ? v.map((v) => v.buffer) : v.buffer).flat()).arrayBuffer());
65
65
  for (const byte of data) {
66
66
  this.buffer.push(byte);
67
67
  }
@@ -140,6 +140,5 @@ export class ConnectionWebSocket {
140
140
  throw new Error("Connection not open");
141
141
  }
142
142
  this.webSocket.close(1000, "method");
143
- console.trace("close called");
144
143
  }
145
144
  }
@@ -4,7 +4,7 @@ export declare const publicKeys: Map<bigint, [bigint, bigint]>;
4
4
  export declare const VECTOR_CONSTRUCTOR = 481674261;
5
5
  export declare const DEFAULT_INITIAL_DC: DC;
6
6
  export declare const LAYER = 158;
7
- export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.966";
7
+ export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.967";
8
8
  export declare const DEFAULT_DEVICE_MODEL: string;
9
9
  export declare const DEFAULT_LANG_CODE: string;
10
10
  export declare const DEFAULT_LANG_PACK = "";
package/esm/constants.js CHANGED
@@ -62,7 +62,7 @@ export const publicKeys = new Map([
62
62
  export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
63
63
  export const DEFAULT_INITIAL_DC = "2-test";
64
64
  export const LAYER = 158;
65
- export const DEFAULT_APP_VERSION = "MTKruto 0.0.966";
65
+ export const DEFAULT_APP_VERSION = "MTKruto 0.0.967";
66
66
  // @ts-ignore: lib
67
67
  export const DEFAULT_DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
68
68
  export const DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "module": "./esm/mod.js",
3
3
  "main": "./script/mod.js",
4
4
  "name": "@mtkruto/node",
5
- "version": "0.0.966",
5
+ "version": "0.0.967",
6
6
  "description": "MTKruto for Node.js",
7
7
  "author": "Roj <rojvv@icloud.com>",
8
8
  "license": "LGPL-3.0-or-later",
@@ -20,12 +20,11 @@ function getMessageId(lastMsgId) {
20
20
  if (lastMsgId >= (newMsgId)) {
21
21
  newMsgId = lastMsgId + 4n;
22
22
  }
23
- lastMsgId = newMsgId;
24
23
  return newMsgId;
25
24
  }
26
25
  exports.getMessageId = getMessageId;
27
26
  function packUnencryptedMessage(data, messageId) {
28
- const message = (0, _0_buffer_js_1.concat)((0, _0_buffer_js_1.bufferFromBigInt)(0x00, 8), (0, _0_buffer_js_1.bufferFromBigInt)(getMessageId(messageId), 8), (0, _0_buffer_js_1.bufferFromBigInt)(data.length, 4), data);
27
+ const message = (0, _0_buffer_js_1.concat)((0, _0_buffer_js_1.bufferFromBigInt)(0x00, 8), (0, _0_buffer_js_1.bufferFromBigInt)(messageId, 8), (0, _0_buffer_js_1.bufferFromBigInt)(data.length, 4), data);
29
28
  return message;
30
29
  }
31
30
  exports.packUnencryptedMessage = packUnencryptedMessage;
@@ -87,7 +87,7 @@ class ConnectionWebSocket {
87
87
  return;
88
88
  }
89
89
  const release = await mutex.acquire();
90
- const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof ArrayBuffer ? v : Array.isArray(v) ? v.map((v) => v.buffer) : v.buffer).flat()).arrayBuffer());
90
+ const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob ? v : v instanceof ArrayBuffer ? v : Array.isArray(v) ? v.map((v) => v.buffer) : v.buffer).flat()).arrayBuffer());
91
91
  for (const byte of data) {
92
92
  this.buffer.push(byte);
93
93
  }
@@ -166,7 +166,6 @@ class ConnectionWebSocket {
166
166
  throw new Error("Connection not open");
167
167
  }
168
168
  this.webSocket.close(1000, "method");
169
- console.trace("close called");
170
169
  }
171
170
  }
172
171
  exports.ConnectionWebSocket = ConnectionWebSocket;
@@ -4,7 +4,7 @@ export declare const publicKeys: Map<bigint, [bigint, bigint]>;
4
4
  export declare const VECTOR_CONSTRUCTOR = 481674261;
5
5
  export declare const DEFAULT_INITIAL_DC: DC;
6
6
  export declare const LAYER = 158;
7
- export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.966";
7
+ export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.967";
8
8
  export declare const DEFAULT_DEVICE_MODEL: string;
9
9
  export declare const DEFAULT_LANG_CODE: string;
10
10
  export declare const DEFAULT_LANG_PACK = "";
@@ -88,7 +88,7 @@ exports.publicKeys = new Map([
88
88
  exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
89
89
  exports.DEFAULT_INITIAL_DC = "2-test";
90
90
  exports.LAYER = 158;
91
- exports.DEFAULT_APP_VERSION = "MTKruto 0.0.966";
91
+ exports.DEFAULT_APP_VERSION = "MTKruto 0.0.967";
92
92
  // @ts-ignore: lib
93
93
  exports.DEFAULT_DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
94
94
  exports.DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];