@mtkruto/browser 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) {
@@ -60,7 +60,7 @@ export class ConnectionWebSocket {
60
60
  return;
61
61
  }
62
62
  const release = await mutex.acquire();
63
- 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());
63
+ 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());
64
64
  for (const byte of data) {
65
65
  this.buffer.push(byte);
66
66
  }
@@ -139,6 +139,5 @@ export class ConnectionWebSocket {
139
139
  throw new Error("Connection not open");
140
140
  }
141
141
  this.webSocket.close(1000, "method");
142
- console.trace("close called");
143
142
  }
144
143
  }
@@ -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
@@ -61,7 +61,7 @@ export const publicKeys = new Map([
61
61
  export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
62
62
  export const DEFAULT_INITIAL_DC = "2-test";
63
63
  export const LAYER = 158;
64
- export const DEFAULT_APP_VERSION = "MTKruto 0.0.966";
64
+ export const DEFAULT_APP_VERSION = "MTKruto 0.0.967";
65
65
  // @ts-ignore: lib
66
66
  export const DEFAULT_DEVICE_MODEL = typeof Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : Deno.build.os + "-" + Deno.build.arch;
67
67
  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/browser",
5
- "version": "0.0.966",
5
+ "version": "0.0.967",
6
6
  "description": "MTKruto for browsers",
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;
@@ -63,7 +63,7 @@ class ConnectionWebSocket {
63
63
  return;
64
64
  }
65
65
  const release = await mutex.acquire();
66
- 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());
66
+ 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());
67
67
  for (const byte of data) {
68
68
  this.buffer.push(byte);
69
69
  }
@@ -142,7 +142,6 @@ class ConnectionWebSocket {
142
142
  throw new Error("Connection not open");
143
143
  }
144
144
  this.webSocket.close(1000, "method");
145
- console.trace("close called");
146
145
  }
147
146
  }
148
147
  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 = "";
@@ -64,7 +64,7 @@ exports.publicKeys = new Map([
64
64
  exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
65
65
  exports.DEFAULT_INITIAL_DC = "2-test";
66
66
  exports.LAYER = 158;
67
- exports.DEFAULT_APP_VERSION = "MTKruto 0.0.966";
67
+ exports.DEFAULT_APP_VERSION = "MTKruto 0.0.967";
68
68
  // @ts-ignore: lib
69
69
  exports.DEFAULT_DEVICE_MODEL = typeof Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : Deno.build.os + "-" + Deno.build.arch;
70
70
  exports.DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];