@mtkruto/node 0.0.962 → 0.0.963
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/esm/connection/1_connection_web_socket.d.ts +1 -0
- package/esm/connection/1_connection_web_socket.js +11 -3
- package/esm/constants.d.ts +1 -1
- package/esm/constants.js +1 -1
- package/esm/tl/1_tl_object.js +4 -1
- package/esm/types/3_message.js +3 -0
- package/esm/utilities/0_base64.js +4 -2
- package/esm/utilities/0_base64_test.d.ts +1 -0
- package/package.json +1 -1
- package/script/connection/1_connection_web_socket.d.ts +1 -0
- package/script/connection/1_connection_web_socket.js +11 -3
- package/script/constants.d.ts +1 -1
- package/script/constants.js +1 -1
- package/script/tl/1_tl_object.js +4 -1
- package/script/types/3_message.js +3 -0
- package/script/utilities/0_base64.js +4 -2
- package/script/utilities/0_base64_test.d.ts +1 -0
|
@@ -33,8 +33,15 @@ export class ConnectionWebSocket {
|
|
|
33
33
|
writable: true,
|
|
34
34
|
value: null
|
|
35
35
|
});
|
|
36
|
-
this.webSocket =
|
|
37
|
-
|
|
36
|
+
this.webSocket = this.reinitWs(url);
|
|
37
|
+
// TODO
|
|
38
|
+
this.webSocket.onclose = () => {
|
|
39
|
+
this.webSocket = this.reinitWs(url);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
reinitWs(url) {
|
|
43
|
+
const webSocket = new dntShim.WebSocket(url, "binary");
|
|
44
|
+
webSocket.onmessage = async (e) => {
|
|
38
45
|
// deno-lint-ignore no-explicit-any
|
|
39
46
|
const data = e.data instanceof Blob ? new Uint8Array(await e.data.arrayBuffer()) : new Uint8Array(e.data);
|
|
40
47
|
for (const byte of data) {
|
|
@@ -45,9 +52,10 @@ export class ConnectionWebSocket {
|
|
|
45
52
|
this.nextResolve = null;
|
|
46
53
|
}
|
|
47
54
|
};
|
|
48
|
-
|
|
55
|
+
webSocket.onerror = (err) => {
|
|
49
56
|
d("WebSocket error: %o", err);
|
|
50
57
|
};
|
|
58
|
+
return webSocket;
|
|
51
59
|
}
|
|
52
60
|
get connected() {
|
|
53
61
|
return this.webSocket.readyState == dntShim.WebSocket.OPEN;
|
package/esm/constants.d.ts
CHANGED
|
@@ -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.
|
|
7
|
+
export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.963";
|
|
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.
|
|
65
|
+
export const DEFAULT_APP_VERSION = "MTKruto 0.0.963";
|
|
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/esm/tl/1_tl_object.js
CHANGED
|
@@ -91,8 +91,11 @@ function serializeSingleParam(writer, value, type, ntype) {
|
|
|
91
91
|
writer.writeBytes(value);
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
|
-
|
|
94
|
+
writer.writeString("");
|
|
95
95
|
}
|
|
96
|
+
// else {
|
|
97
|
+
// throw new TypeError(`Expected string or Uint8Array but received ${valueRepr}`);
|
|
98
|
+
// }
|
|
96
99
|
break;
|
|
97
100
|
case "true":
|
|
98
101
|
if (value !== true) {
|
package/esm/types/3_message.js
CHANGED
|
@@ -380,6 +380,9 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
|
|
|
380
380
|
else if (message_.media instanceof types.MessageMediaGeo || message_.media instanceof types.MessageMediaGeoLive) {
|
|
381
381
|
message.location = constructLocation(message_.media);
|
|
382
382
|
}
|
|
383
|
+
else if (message_.media instanceof types.MessageMediaWebPage) {
|
|
384
|
+
//
|
|
385
|
+
}
|
|
383
386
|
else {
|
|
384
387
|
// not implemented
|
|
385
388
|
UNREACHABLE();
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { base64Decode, base64Encode } from "../deps.js";
|
|
2
|
-
// TODO: test
|
|
3
2
|
export function base64EncodeUrlSafe(data) {
|
|
4
3
|
return base64Encode(data).replace(/=*$/, "").replaceAll("+", "-").replaceAll("/", "_");
|
|
5
4
|
}
|
|
6
5
|
export function base64DecodeUrlSafe(data) {
|
|
7
6
|
data = data.replaceAll("_", "/").replaceAll("-", "+");
|
|
8
|
-
|
|
7
|
+
if (data.length != 4) {
|
|
8
|
+
data += "=".repeat(4 - data.length % 4);
|
|
9
|
+
}
|
|
10
|
+
return base64Decode(data);
|
|
9
11
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -59,8 +59,15 @@ class ConnectionWebSocket {
|
|
|
59
59
|
writable: true,
|
|
60
60
|
value: null
|
|
61
61
|
});
|
|
62
|
-
this.webSocket =
|
|
63
|
-
|
|
62
|
+
this.webSocket = this.reinitWs(url);
|
|
63
|
+
// TODO
|
|
64
|
+
this.webSocket.onclose = () => {
|
|
65
|
+
this.webSocket = this.reinitWs(url);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
reinitWs(url) {
|
|
69
|
+
const webSocket = new dntShim.WebSocket(url, "binary");
|
|
70
|
+
webSocket.onmessage = async (e) => {
|
|
64
71
|
// deno-lint-ignore no-explicit-any
|
|
65
72
|
const data = e.data instanceof Blob ? new Uint8Array(await e.data.arrayBuffer()) : new Uint8Array(e.data);
|
|
66
73
|
for (const byte of data) {
|
|
@@ -71,9 +78,10 @@ class ConnectionWebSocket {
|
|
|
71
78
|
this.nextResolve = null;
|
|
72
79
|
}
|
|
73
80
|
};
|
|
74
|
-
|
|
81
|
+
webSocket.onerror = (err) => {
|
|
75
82
|
d("WebSocket error: %o", err);
|
|
76
83
|
};
|
|
84
|
+
return webSocket;
|
|
77
85
|
}
|
|
78
86
|
get connected() {
|
|
79
87
|
return this.webSocket.readyState == dntShim.WebSocket.OPEN;
|
package/script/constants.d.ts
CHANGED
|
@@ -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.
|
|
7
|
+
export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.963";
|
|
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/script/constants.js
CHANGED
|
@@ -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.
|
|
91
|
+
exports.DEFAULT_APP_VERSION = "MTKruto 0.0.963";
|
|
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];
|
package/script/tl/1_tl_object.js
CHANGED
|
@@ -96,8 +96,11 @@ function serializeSingleParam(writer, value, type, ntype) {
|
|
|
96
96
|
writer.writeBytes(value);
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
|
-
|
|
99
|
+
writer.writeString("");
|
|
100
100
|
}
|
|
101
|
+
// else {
|
|
102
|
+
// throw new TypeError(`Expected string or Uint8Array but received ${valueRepr}`);
|
|
103
|
+
// }
|
|
101
104
|
break;
|
|
102
105
|
case "true":
|
|
103
106
|
if (value !== true) {
|
|
@@ -406,6 +406,9 @@ async function constructMessage(message_, getEntity, getMessage, getStickerSetNa
|
|
|
406
406
|
else if (message_.media instanceof types.MessageMediaGeo || message_.media instanceof types.MessageMediaGeoLive) {
|
|
407
407
|
message.location = (0, _0_location_js_1.constructLocation)(message_.media);
|
|
408
408
|
}
|
|
409
|
+
else if (message_.media instanceof types.MessageMediaWebPage) {
|
|
410
|
+
//
|
|
411
|
+
}
|
|
409
412
|
else {
|
|
410
413
|
// not implemented
|
|
411
414
|
(0, _0_control_js_1.UNREACHABLE)();
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.base64DecodeUrlSafe = exports.base64EncodeUrlSafe = void 0;
|
|
4
4
|
const deps_js_1 = require("../deps.js");
|
|
5
|
-
// TODO: test
|
|
6
5
|
function base64EncodeUrlSafe(data) {
|
|
7
6
|
return (0, deps_js_1.base64Encode)(data).replace(/=*$/, "").replaceAll("+", "-").replaceAll("/", "_");
|
|
8
7
|
}
|
|
9
8
|
exports.base64EncodeUrlSafe = base64EncodeUrlSafe;
|
|
10
9
|
function base64DecodeUrlSafe(data) {
|
|
11
10
|
data = data.replaceAll("_", "/").replaceAll("-", "+");
|
|
12
|
-
|
|
11
|
+
if (data.length != 4) {
|
|
12
|
+
data += "=".repeat(4 - data.length % 4);
|
|
13
|
+
}
|
|
14
|
+
return (0, deps_js_1.base64Decode)(data);
|
|
13
15
|
}
|
|
14
16
|
exports.base64DecodeUrlSafe = base64DecodeUrlSafe;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|