@mtkruto/node 0.0.968 → 0.0.969
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/client/1_client_abstract.js +2 -2
- package/esm/client/2_client_plain.d.ts +3 -0
- package/esm/client/2_client_plain.js +11 -5
- package/esm/client/3_client.d.ts +3 -0
- package/esm/client/3_client.js +16 -9
- package/esm/constants.d.ts +10 -9
- package/esm/constants.js +9 -17
- package/esm/mod.d.ts +1 -1
- package/esm/mod.js +1 -1
- package/esm/tl/2_types.d.ts +49 -49
- package/esm/tl/2_types.js +194 -193
- package/esm/tl/3_functions.d.ts +15 -15
- package/esm/tl/3_functions.js +45 -44
- package/package.json +1 -1
- package/script/client/1_client_abstract.js +1 -1
- package/script/client/2_client_plain.d.ts +3 -0
- package/script/client/2_client_plain.js +10 -4
- package/script/client/3_client.d.ts +3 -0
- package/script/client/3_client.js +15 -8
- package/script/constants.d.ts +10 -9
- package/script/constants.js +10 -18
- package/script/mod.d.ts +1 -1
- package/script/mod.js +8 -8
- package/script/tl/2_types.d.ts +49 -49
- package/script/tl/2_types.js +193 -192
- package/script/tl/3_functions.d.ts +15 -15
- package/script/tl/3_functions.js +44 -43
package/esm/tl/3_functions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { id,
|
|
1
|
+
import { id, params, TLObject, Params, paramDesc, ParamDesc } from "./1_tl_object.js";
|
|
2
2
|
import * as types from "./2_types.js";
|
|
3
3
|
export declare abstract class Function<T> extends TLObject {
|
|
4
4
|
__R: T;
|
|
@@ -496,7 +496,7 @@ export declare class AccountUpdateProfile extends Function<types.TypeUser> {
|
|
|
496
496
|
protected get [id](): number;
|
|
497
497
|
static get [paramDesc](): ParamDesc;
|
|
498
498
|
protected get [params](): Params;
|
|
499
|
-
constructor(params
|
|
499
|
+
constructor(params?: {
|
|
500
500
|
firstName?: string;
|
|
501
501
|
lastName?: string;
|
|
502
502
|
about?: string;
|
|
@@ -847,7 +847,7 @@ export declare class AccountInitTakeoutSession extends Function<types.AccountTak
|
|
|
847
847
|
protected get [id](): number;
|
|
848
848
|
static get [paramDesc](): ParamDesc;
|
|
849
849
|
protected get [params](): Params;
|
|
850
|
-
constructor(params
|
|
850
|
+
constructor(params?: {
|
|
851
851
|
contacts?: true;
|
|
852
852
|
messageUsers?: true;
|
|
853
853
|
messageChats?: true;
|
|
@@ -862,7 +862,7 @@ export declare class AccountFinishTakeoutSession extends Function<boolean> {
|
|
|
862
862
|
protected get [id](): number;
|
|
863
863
|
static get [paramDesc](): ParamDesc;
|
|
864
864
|
protected get [params](): Params;
|
|
865
|
-
constructor(params
|
|
865
|
+
constructor(params?: {
|
|
866
866
|
success?: true;
|
|
867
867
|
});
|
|
868
868
|
}
|
|
@@ -909,7 +909,7 @@ export declare class AccountGetNotifyExceptions extends Function<types.TypeUpdat
|
|
|
909
909
|
protected get [id](): number;
|
|
910
910
|
static get [paramDesc](): ParamDesc;
|
|
911
911
|
protected get [params](): Params;
|
|
912
|
-
constructor(params
|
|
912
|
+
constructor(params?: {
|
|
913
913
|
compareSound?: true;
|
|
914
914
|
compareStories?: true;
|
|
915
915
|
peer?: types.TypeInputNotifyPeer;
|
|
@@ -1056,7 +1056,7 @@ export declare class AccountInstallTheme extends Function<boolean> {
|
|
|
1056
1056
|
protected get [id](): number;
|
|
1057
1057
|
static get [paramDesc](): ParamDesc;
|
|
1058
1058
|
protected get [params](): Params;
|
|
1059
|
-
constructor(params
|
|
1059
|
+
constructor(params?: {
|
|
1060
1060
|
dark?: true;
|
|
1061
1061
|
theme?: types.TypeInputTheme;
|
|
1062
1062
|
format?: string;
|
|
@@ -1090,7 +1090,7 @@ export declare class AccountSetContentSettings extends Function<boolean> {
|
|
|
1090
1090
|
protected get [id](): number;
|
|
1091
1091
|
static get [paramDesc](): ParamDesc;
|
|
1092
1092
|
protected get [params](): Params;
|
|
1093
|
-
constructor(params
|
|
1093
|
+
constructor(params?: {
|
|
1094
1094
|
sensitiveEnabled?: true;
|
|
1095
1095
|
});
|
|
1096
1096
|
}
|
|
@@ -2584,7 +2584,7 @@ export declare class MessagesClearRecentStickers extends Function<boolean> {
|
|
|
2584
2584
|
protected get [id](): number;
|
|
2585
2585
|
static get [paramDesc](): ParamDesc;
|
|
2586
2586
|
protected get [params](): Params;
|
|
2587
|
-
constructor(params
|
|
2587
|
+
constructor(params?: {
|
|
2588
2588
|
attached?: true;
|
|
2589
2589
|
});
|
|
2590
2590
|
}
|
|
@@ -3064,7 +3064,7 @@ export declare class MessagesRequestURLAuth extends Function<types.TypeURLAuthRe
|
|
|
3064
3064
|
protected get [id](): number;
|
|
3065
3065
|
static get [paramDesc](): ParamDesc;
|
|
3066
3066
|
protected get [params](): Params;
|
|
3067
|
-
constructor(params
|
|
3067
|
+
constructor(params?: {
|
|
3068
3068
|
peer?: types.TypeInputPeer;
|
|
3069
3069
|
msgId?: number;
|
|
3070
3070
|
buttonId?: number;
|
|
@@ -3080,7 +3080,7 @@ export declare class MessagesAcceptURLAuth extends Function<types.TypeURLAuthRes
|
|
|
3080
3080
|
protected get [id](): number;
|
|
3081
3081
|
static get [paramDesc](): ParamDesc;
|
|
3082
3082
|
protected get [params](): Params;
|
|
3083
|
-
constructor(params
|
|
3083
|
+
constructor(params?: {
|
|
3084
3084
|
writeAllowed?: true;
|
|
3085
3085
|
peer?: types.TypeInputPeer;
|
|
3086
3086
|
msgId?: number;
|
|
@@ -3292,7 +3292,7 @@ export declare class MessagesDeletePhoneCallHistory extends Function<types.Messa
|
|
|
3292
3292
|
protected get [id](): number;
|
|
3293
3293
|
static get [paramDesc](): ParamDesc;
|
|
3294
3294
|
protected get [params](): Params;
|
|
3295
|
-
constructor(params
|
|
3295
|
+
constructor(params?: {
|
|
3296
3296
|
revoke?: true;
|
|
3297
3297
|
});
|
|
3298
3298
|
}
|
|
@@ -4115,7 +4115,7 @@ export declare class PhotosUploadProfilePhoto extends Function<types.PhotosPhoto
|
|
|
4115
4115
|
protected get [id](): number;
|
|
4116
4116
|
static get [paramDesc](): ParamDesc;
|
|
4117
4117
|
protected get [params](): Params;
|
|
4118
|
-
constructor(params
|
|
4118
|
+
constructor(params?: {
|
|
4119
4119
|
fallback?: true;
|
|
4120
4120
|
bot?: types.TypeInputUser;
|
|
4121
4121
|
file?: types.TypeInputFile;
|
|
@@ -4709,7 +4709,7 @@ export declare class ChannelsGetAdminedPublicChannels extends Function<types.Typ
|
|
|
4709
4709
|
protected get [id](): number;
|
|
4710
4710
|
static get [paramDesc](): ParamDesc;
|
|
4711
4711
|
protected get [params](): Params;
|
|
4712
|
-
constructor(params
|
|
4712
|
+
constructor(params?: {
|
|
4713
4713
|
byLocation?: true;
|
|
4714
4714
|
checkLimit?: true;
|
|
4715
4715
|
});
|
|
@@ -5340,7 +5340,7 @@ export declare class PaymentsClearSavedInfo extends Function<boolean> {
|
|
|
5340
5340
|
protected get [id](): number;
|
|
5341
5341
|
static get [paramDesc](): ParamDesc;
|
|
5342
5342
|
protected get [params](): Params;
|
|
5343
|
-
constructor(params
|
|
5343
|
+
constructor(params?: {
|
|
5344
5344
|
credentials?: true;
|
|
5345
5345
|
info?: true;
|
|
5346
5346
|
});
|
|
@@ -6221,7 +6221,7 @@ export declare class StoriesGetAllStories extends Function<types.TypeStoriesAllS
|
|
|
6221
6221
|
protected get [id](): number;
|
|
6222
6222
|
static get [paramDesc](): ParamDesc;
|
|
6223
6223
|
protected get [params](): Params;
|
|
6224
|
-
constructor(params
|
|
6224
|
+
constructor(params?: {
|
|
6225
6225
|
next?: true;
|
|
6226
6226
|
hidden?: true;
|
|
6227
6227
|
state?: string;
|
package/esm/tl/3_functions.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
// deno-fmt-ignore-file
|
|
2
|
+
import { id, params, TLObject, paramDesc, flags } from "./1_tl_object.js";
|
|
2
3
|
import * as types from "./2_types.js";
|
|
3
4
|
export class Function extends TLObject {
|
|
4
5
|
constructor() {
|
|
@@ -1594,9 +1595,9 @@ export class AccountUpdateProfile extends Function {
|
|
|
1594
1595
|
writable: true,
|
|
1595
1596
|
value: void 0
|
|
1596
1597
|
});
|
|
1597
|
-
this.firstName = params
|
|
1598
|
-
this.lastName = params
|
|
1599
|
-
this.about = params
|
|
1598
|
+
this.firstName = params?.firstName;
|
|
1599
|
+
this.lastName = params?.lastName;
|
|
1600
|
+
this.about = params?.about;
|
|
1600
1601
|
}
|
|
1601
1602
|
}
|
|
1602
1603
|
export class AccountUpdateStatus extends Function {
|
|
@@ -2664,13 +2665,13 @@ export class AccountInitTakeoutSession extends Function {
|
|
|
2664
2665
|
writable: true,
|
|
2665
2666
|
value: void 0
|
|
2666
2667
|
});
|
|
2667
|
-
this.contacts = params
|
|
2668
|
-
this.messageUsers = params
|
|
2669
|
-
this.messageChats = params
|
|
2670
|
-
this.messageMegagroups = params
|
|
2671
|
-
this.messageChannels = params
|
|
2672
|
-
this.files = params
|
|
2673
|
-
this.fileMaxSize = params
|
|
2668
|
+
this.contacts = params?.contacts;
|
|
2669
|
+
this.messageUsers = params?.messageUsers;
|
|
2670
|
+
this.messageChats = params?.messageChats;
|
|
2671
|
+
this.messageMegagroups = params?.messageMegagroups;
|
|
2672
|
+
this.messageChannels = params?.messageChannels;
|
|
2673
|
+
this.files = params?.files;
|
|
2674
|
+
this.fileMaxSize = params?.fileMaxSize;
|
|
2674
2675
|
}
|
|
2675
2676
|
}
|
|
2676
2677
|
export class AccountFinishTakeoutSession extends Function {
|
|
@@ -2697,7 +2698,7 @@ export class AccountFinishTakeoutSession extends Function {
|
|
|
2697
2698
|
writable: true,
|
|
2698
2699
|
value: void 0
|
|
2699
2700
|
});
|
|
2700
|
-
this.success = params
|
|
2701
|
+
this.success = params?.success;
|
|
2701
2702
|
}
|
|
2702
2703
|
}
|
|
2703
2704
|
export class AccountConfirmPasswordEmail extends Function {
|
|
@@ -2832,9 +2833,9 @@ export class AccountGetNotifyExceptions extends Function {
|
|
|
2832
2833
|
writable: true,
|
|
2833
2834
|
value: void 0
|
|
2834
2835
|
});
|
|
2835
|
-
this.compareSound = params
|
|
2836
|
-
this.compareStories = params
|
|
2837
|
-
this.peer = params
|
|
2836
|
+
this.compareSound = params?.compareSound;
|
|
2837
|
+
this.compareStories = params?.compareStories;
|
|
2838
|
+
this.peer = params?.peer;
|
|
2838
2839
|
}
|
|
2839
2840
|
}
|
|
2840
2841
|
export class AccountGetWallPaper extends Function {
|
|
@@ -3328,10 +3329,10 @@ export class AccountInstallTheme extends Function {
|
|
|
3328
3329
|
writable: true,
|
|
3329
3330
|
value: void 0
|
|
3330
3331
|
});
|
|
3331
|
-
this.dark = params
|
|
3332
|
-
this.theme = params
|
|
3333
|
-
this.format = params
|
|
3334
|
-
this.baseTheme = params
|
|
3332
|
+
this.dark = params?.dark;
|
|
3333
|
+
this.theme = params?.theme;
|
|
3334
|
+
this.format = params?.format;
|
|
3335
|
+
this.baseTheme = params?.baseTheme;
|
|
3335
3336
|
}
|
|
3336
3337
|
}
|
|
3337
3338
|
export class AccountGetTheme extends Function {
|
|
@@ -3426,7 +3427,7 @@ export class AccountSetContentSettings extends Function {
|
|
|
3426
3427
|
writable: true,
|
|
3427
3428
|
value: void 0
|
|
3428
3429
|
});
|
|
3429
|
-
this.sensitiveEnabled = params
|
|
3430
|
+
this.sensitiveEnabled = params?.sensitiveEnabled;
|
|
3430
3431
|
}
|
|
3431
3432
|
}
|
|
3432
3433
|
export class AccountGetContentSettings extends Function {
|
|
@@ -8356,7 +8357,7 @@ export class MessagesClearRecentStickers extends Function {
|
|
|
8356
8357
|
writable: true,
|
|
8357
8358
|
value: void 0
|
|
8358
8359
|
});
|
|
8359
|
-
this.attached = params
|
|
8360
|
+
this.attached = params?.attached;
|
|
8360
8361
|
}
|
|
8361
8362
|
}
|
|
8362
8363
|
export class MessagesGetArchivedStickers extends Function {
|
|
@@ -9944,10 +9945,10 @@ export class MessagesRequestURLAuth extends Function {
|
|
|
9944
9945
|
writable: true,
|
|
9945
9946
|
value: void 0
|
|
9946
9947
|
});
|
|
9947
|
-
this.peer = params
|
|
9948
|
-
this.msgId = params
|
|
9949
|
-
this.buttonId = params
|
|
9950
|
-
this.url = params
|
|
9948
|
+
this.peer = params?.peer;
|
|
9949
|
+
this.msgId = params?.msgId;
|
|
9950
|
+
this.buttonId = params?.buttonId;
|
|
9951
|
+
this.url = params?.url;
|
|
9951
9952
|
}
|
|
9952
9953
|
}
|
|
9953
9954
|
export class MessagesAcceptURLAuth extends Function {
|
|
@@ -10006,11 +10007,11 @@ export class MessagesAcceptURLAuth extends Function {
|
|
|
10006
10007
|
writable: true,
|
|
10007
10008
|
value: void 0
|
|
10008
10009
|
});
|
|
10009
|
-
this.writeAllowed = params
|
|
10010
|
-
this.peer = params
|
|
10011
|
-
this.msgId = params
|
|
10012
|
-
this.buttonId = params
|
|
10013
|
-
this.url = params
|
|
10010
|
+
this.writeAllowed = params?.writeAllowed;
|
|
10011
|
+
this.peer = params?.peer;
|
|
10012
|
+
this.msgId = params?.msgId;
|
|
10013
|
+
this.buttonId = params?.buttonId;
|
|
10014
|
+
this.url = params?.url;
|
|
10014
10015
|
}
|
|
10015
10016
|
}
|
|
10016
10017
|
export class MessagesHidePeerSettingsBar extends Function {
|
|
@@ -10682,7 +10683,7 @@ export class MessagesDeletePhoneCallHistory extends Function {
|
|
|
10682
10683
|
writable: true,
|
|
10683
10684
|
value: void 0
|
|
10684
10685
|
});
|
|
10685
|
-
this.revoke = params
|
|
10686
|
+
this.revoke = params?.revoke;
|
|
10686
10687
|
}
|
|
10687
10688
|
}
|
|
10688
10689
|
export class MessagesCheckHistoryImport extends Function {
|
|
@@ -13445,12 +13446,12 @@ export class PhotosUploadProfilePhoto extends Function {
|
|
|
13445
13446
|
writable: true,
|
|
13446
13447
|
value: void 0
|
|
13447
13448
|
});
|
|
13448
|
-
this.fallback = params
|
|
13449
|
-
this.bot = params
|
|
13450
|
-
this.file = params
|
|
13451
|
-
this.video = params
|
|
13452
|
-
this.videoStartTs = params
|
|
13453
|
-
this.videoEmojiMarkup = params
|
|
13449
|
+
this.fallback = params?.fallback;
|
|
13450
|
+
this.bot = params?.bot;
|
|
13451
|
+
this.file = params?.file;
|
|
13452
|
+
this.video = params?.video;
|
|
13453
|
+
this.videoStartTs = params?.videoStartTs;
|
|
13454
|
+
this.videoEmojiMarkup = params?.videoEmojiMarkup;
|
|
13454
13455
|
}
|
|
13455
13456
|
}
|
|
13456
13457
|
export class PhotosDeletePhotos extends Function {
|
|
@@ -15284,8 +15285,8 @@ export class ChannelsGetAdminedPublicChannels extends Function {
|
|
|
15284
15285
|
writable: true,
|
|
15285
15286
|
value: void 0
|
|
15286
15287
|
});
|
|
15287
|
-
this.byLocation = params
|
|
15288
|
-
this.checkLimit = params
|
|
15288
|
+
this.byLocation = params?.byLocation;
|
|
15289
|
+
this.checkLimit = params?.checkLimit;
|
|
15289
15290
|
}
|
|
15290
15291
|
}
|
|
15291
15292
|
export class ChannelsEditBanned extends Function {
|
|
@@ -17318,8 +17319,8 @@ export class PaymentsClearSavedInfo extends Function {
|
|
|
17318
17319
|
writable: true,
|
|
17319
17320
|
value: void 0
|
|
17320
17321
|
});
|
|
17321
|
-
this.credentials = params
|
|
17322
|
-
this.info = params
|
|
17322
|
+
this.credentials = params?.credentials;
|
|
17323
|
+
this.info = params?.info;
|
|
17323
17324
|
}
|
|
17324
17325
|
}
|
|
17325
17326
|
export class PaymentsGetBankCardData extends Function {
|
|
@@ -20197,9 +20198,9 @@ export class StoriesGetAllStories extends Function {
|
|
|
20197
20198
|
writable: true,
|
|
20198
20199
|
value: void 0
|
|
20199
20200
|
});
|
|
20200
|
-
this.next = params
|
|
20201
|
-
this.hidden = params
|
|
20202
|
-
this.state = params
|
|
20201
|
+
this.next = params?.next;
|
|
20202
|
+
this.hidden = params?.hidden;
|
|
20203
|
+
this.state = params?.state;
|
|
20203
20204
|
}
|
|
20204
20205
|
}
|
|
20205
20206
|
export class StoriesGetUserStories extends Function {
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ class ClientAbstract {
|
|
|
8
8
|
get initialDc() {
|
|
9
9
|
return this._initialDc;
|
|
10
10
|
}
|
|
11
|
-
constructor(transportProvider = (0, _2_transport_provider_js_1.webSocketTransportProvider)({ initialDc: constants_js_1.
|
|
11
|
+
constructor(transportProvider = (0, _2_transport_provider_js_1.webSocketTransportProvider)({ initialDc: constants_js_1.INITIAL_DC }), cdn = false) {
|
|
12
12
|
Object.defineProperty(this, "transportProvider", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
configurable: true,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Function } from "../tl/3_functions.js";
|
|
2
|
+
import { TransportProvider } from "../transport/2_transport_provider.js";
|
|
2
3
|
import { ClientAbstract } from "./1_client_abstract.js";
|
|
3
4
|
export declare class ClientPlain extends ClientAbstract {
|
|
5
|
+
private readonly publicKeys;
|
|
4
6
|
private lastMsgId;
|
|
7
|
+
constructor(transportProvider: TransportProvider, publicKeys?: import("../constants.js").PublicKeys);
|
|
5
8
|
invoke<T extends Function<unknown>>(function_: T): Promise<T["__R"]>;
|
|
6
9
|
createAuthKey(): Promise<{
|
|
7
10
|
authKey: Uint8Array;
|
|
@@ -16,8 +16,14 @@ const _1_client_abstract_js_1 = require("./1_client_abstract.js");
|
|
|
16
16
|
const _0_message_js_1 = require("./0_message.js");
|
|
17
17
|
const d = (0, deps_js_1.debug)("ClientPlain/createAuthKey");
|
|
18
18
|
class ClientPlain extends _1_client_abstract_js_1.ClientAbstract {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(
|
|
19
|
+
constructor(transportProvider, publicKeys = constants_js_1.PUBLIC_KEYS) {
|
|
20
|
+
super(transportProvider);
|
|
21
|
+
Object.defineProperty(this, "publicKeys", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
value: publicKeys
|
|
26
|
+
});
|
|
21
27
|
Object.defineProperty(this, "lastMsgId", {
|
|
22
28
|
enumerable: true,
|
|
23
29
|
configurable: true,
|
|
@@ -67,10 +73,10 @@ class ClientPlain extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
67
73
|
let publicKeyFingerprint;
|
|
68
74
|
let publicKey;
|
|
69
75
|
for (const fingerprint of resPq.serverPublicKeyFingerprints) {
|
|
70
|
-
const maybePublicKey =
|
|
76
|
+
const maybePublicKey = this.publicKeys.find(([k]) => (k == fingerprint));
|
|
71
77
|
if (maybePublicKey) {
|
|
72
78
|
publicKeyFingerprint = fingerprint;
|
|
73
|
-
publicKey = maybePublicKey;
|
|
79
|
+
publicKey = maybePublicKey[1];
|
|
74
80
|
break;
|
|
75
81
|
}
|
|
76
82
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PublicKeys } from "../constants.js";
|
|
1
2
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
3
|
import * as types from "../tl/2_types.js";
|
|
3
4
|
import * as functions from "../tl/3_functions.js";
|
|
@@ -58,6 +59,7 @@ export interface ClientParams {
|
|
|
58
59
|
* The system_version parameter to be passed to initConnection when calling `authorize`.
|
|
59
60
|
*/
|
|
60
61
|
systemVersion?: string;
|
|
62
|
+
publicKeys?: PublicKeys;
|
|
61
63
|
}
|
|
62
64
|
export interface ForwardMessagesParams {
|
|
63
65
|
messageThreadId?: number;
|
|
@@ -85,6 +87,7 @@ export declare class Client extends ClientAbstract {
|
|
|
85
87
|
readonly langPack: string;
|
|
86
88
|
readonly systemLangCode: string;
|
|
87
89
|
readonly systemVersion: string;
|
|
90
|
+
private readonly publicKeys?;
|
|
88
91
|
/**
|
|
89
92
|
* Constructs the client.
|
|
90
93
|
*
|
|
@@ -179,6 +179,12 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
179
179
|
writable: true,
|
|
180
180
|
value: void 0
|
|
181
181
|
});
|
|
182
|
+
Object.defineProperty(this, "publicKeys", {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
configurable: true,
|
|
185
|
+
writable: true,
|
|
186
|
+
value: void 0
|
|
187
|
+
});
|
|
182
188
|
Object.defineProperty(this, "storageInited", {
|
|
183
189
|
enumerable: true,
|
|
184
190
|
configurable: true,
|
|
@@ -210,12 +216,13 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
210
216
|
value: new deps_js_1.Mutex()
|
|
211
217
|
});
|
|
212
218
|
this.parseMode = params?.parseMode ?? ParseMode.None;
|
|
213
|
-
this.appVersion = params?.appVersion ?? constants_js_1.
|
|
214
|
-
this.deviceModel = params?.deviceModel ?? constants_js_1.
|
|
215
|
-
this.langCode = params?.langCode ?? constants_js_1.
|
|
216
|
-
this.langPack = params?.langPack ?? constants_js_1.
|
|
217
|
-
this.systemLangCode = params?.systemLangCode ?? constants_js_1.
|
|
218
|
-
this.systemVersion = params?.systemVersion ?? constants_js_1.
|
|
219
|
+
this.appVersion = params?.appVersion ?? constants_js_1.APP_VERSION;
|
|
220
|
+
this.deviceModel = params?.deviceModel ?? constants_js_1.DEVICE_MODEL;
|
|
221
|
+
this.langCode = params?.langCode ?? constants_js_1.LANG_CODE;
|
|
222
|
+
this.langPack = params?.langPack ?? constants_js_1.LANG_PACK;
|
|
223
|
+
this.systemLangCode = params?.systemLangCode ?? constants_js_1.SYSTEM_LANG_CODE;
|
|
224
|
+
this.systemVersion = params?.systemVersion ?? constants_js_1.SYSTEM_VERSION;
|
|
225
|
+
this.publicKeys = params?.publicKeys;
|
|
219
226
|
}
|
|
220
227
|
/**
|
|
221
228
|
* Sets the DC and resets the auth key stored in the session provider
|
|
@@ -252,7 +259,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
252
259
|
}
|
|
253
260
|
const authKey = await this.storage.getAuthKey();
|
|
254
261
|
if (authKey == null) {
|
|
255
|
-
const plain = new _2_client_plain_js_1.ClientPlain(this.transportProvider);
|
|
262
|
+
const plain = new _2_client_plain_js_1.ClientPlain(this.transportProvider, this.publicKeys);
|
|
256
263
|
const dc = await this.storage.getDc();
|
|
257
264
|
if (dc != null) {
|
|
258
265
|
plain.setDc(dc);
|
|
@@ -484,7 +491,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
|
484
491
|
}
|
|
485
492
|
while (this.connected) {
|
|
486
493
|
try {
|
|
487
|
-
if (this.toAcknowledge.size >= constants_js_1.
|
|
494
|
+
if (this.toAcknowledge.size >= constants_js_1.ACK_THRESHOLD) {
|
|
488
495
|
await this.send(new types.MsgsAck({ msgIds: [...this.toAcknowledge] }));
|
|
489
496
|
this.toAcknowledge.clear();
|
|
490
497
|
}
|
package/script/constants.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { DC } from "./transport/2_transport_provider.js";
|
|
2
|
-
export declare const
|
|
3
|
-
export
|
|
2
|
+
export declare const ACK_THRESHOLD = 10;
|
|
3
|
+
export type PublicKeys = readonly [bigint, [bigint, bigint]][];
|
|
4
|
+
export declare const PUBLIC_KEYS: PublicKeys;
|
|
4
5
|
export declare const VECTOR_CONSTRUCTOR = 481674261;
|
|
5
|
-
export declare const
|
|
6
|
+
export declare const INITIAL_DC: DC;
|
|
6
7
|
export declare const LAYER = 160;
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
8
|
+
export declare const APP_VERSION = "MTKruto 0.0.969";
|
|
9
|
+
export declare const DEVICE_MODEL: string;
|
|
10
|
+
export declare const LANG_CODE: string;
|
|
11
|
+
export declare const LANG_PACK = "";
|
|
12
|
+
export declare const SYSTEM_LANG_CODE: string;
|
|
13
|
+
export declare const SYSTEM_VERSION: string;
|
|
13
14
|
export declare const USERNAME_TTL = 86400;
|
|
14
15
|
export declare const STICKER_SET_NAME_TTL = 172800;
|
|
15
16
|
export declare const MAX_CHAT_ID = 999999999999;
|
package/script/constants.js
CHANGED
|
@@ -23,10 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.CHANNEL_DIFFERENCE_LIMIT_BOT = exports.CHANNEL_DIFFERENCE_LIMIT_USER = exports.ZERO_CHANNEL_ID = exports.MAX_CHANNEL_ID = exports.MAX_CHAT_ID = exports.STICKER_SET_NAME_TTL = exports.USERNAME_TTL = exports.
|
|
26
|
+
exports.CHANNEL_DIFFERENCE_LIMIT_BOT = exports.CHANNEL_DIFFERENCE_LIMIT_USER = exports.ZERO_CHANNEL_ID = exports.MAX_CHANNEL_ID = exports.MAX_CHAT_ID = exports.STICKER_SET_NAME_TTL = exports.USERNAME_TTL = exports.SYSTEM_VERSION = exports.SYSTEM_LANG_CODE = exports.LANG_PACK = exports.LANG_CODE = exports.DEVICE_MODEL = exports.APP_VERSION = exports.LAYER = exports.INITIAL_DC = exports.VECTOR_CONSTRUCTOR = exports.PUBLIC_KEYS = exports.ACK_THRESHOLD = void 0;
|
|
27
27
|
const dntShim = __importStar(require("./_dnt.shims.js"));
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
28
|
+
exports.ACK_THRESHOLD = 10;
|
|
29
|
+
exports.PUBLIC_KEYS = Object.freeze([
|
|
30
30
|
[
|
|
31
31
|
1562291298945373506n,
|
|
32
32
|
[
|
|
@@ -76,26 +76,18 @@ exports.publicKeys = new Map([
|
|
|
76
76
|
0x010001n,
|
|
77
77
|
],
|
|
78
78
|
],
|
|
79
|
-
// Piltover
|
|
80
|
-
[
|
|
81
|
-
-5746138571559360724n,
|
|
82
|
-
[
|
|
83
|
-
26007219673003768186863565706940772901187119797549016801229858995725553827566821957407312503173782965285118977548255274803204174826509270586421841734996746493071723679186583391927378886693846518017621303145594627156874011707147548520576401963675756312298478878474644101348427872255774246965916073553469761183250044599310582333625453447885100318336864215713703860033765477732305055537755094341310278183464296754000479758644167423888581130401586546401934096183449791147912201040435037926911688179080223967863256047196705714611239523210563418382771999824529581206920323901890386681875893623076449827387008128524246269437n,
|
|
84
|
-
0x010001n,
|
|
85
|
-
],
|
|
86
|
-
],
|
|
87
79
|
]);
|
|
88
80
|
exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
|
|
89
|
-
exports.
|
|
81
|
+
exports.INITIAL_DC = "2-test";
|
|
90
82
|
exports.LAYER = 160;
|
|
91
|
-
exports.
|
|
83
|
+
exports.APP_VERSION = "MTKruto 0.0.969";
|
|
92
84
|
// @ts-ignore: lib
|
|
93
|
-
exports.
|
|
94
|
-
exports.
|
|
95
|
-
exports.
|
|
96
|
-
exports.
|
|
85
|
+
exports.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;
|
|
86
|
+
exports.LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
|
|
87
|
+
exports.LANG_PACK = "";
|
|
88
|
+
exports.SYSTEM_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
|
|
97
89
|
// @ts-ignore: lib
|
|
98
|
-
exports.
|
|
90
|
+
exports.SYSTEM_VERSION = typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : "Node.js/" + process.versions.node : navigator.userAgent;
|
|
99
91
|
exports.USERNAME_TTL = 86400;
|
|
100
92
|
exports.STICKER_SET_NAME_TTL = 172800;
|
|
101
93
|
exports.MAX_CHAT_ID = 999999999999;
|
package/script/mod.d.ts
CHANGED
|
@@ -23,4 +23,4 @@ export * from "./transport/0_transport.js";
|
|
|
23
23
|
export * from "./transport/2_transport_provider.js";
|
|
24
24
|
export * from "./connection/0_connection.js";
|
|
25
25
|
export * from "./connection/1_connection_web_socket.js";
|
|
26
|
-
export {
|
|
26
|
+
export { APP_VERSION, DEVICE_MODEL, INITIAL_DC, LANG_CODE, LANG_PACK, LAYER, SYSTEM_LANG_CODE, SYSTEM_VERSION } from "./constants.js";
|
package/script/mod.js
CHANGED
|
@@ -26,7 +26,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.SYSTEM_VERSION = exports.SYSTEM_LANG_CODE = exports.LAYER = exports.LANG_PACK = exports.LANG_CODE = exports.INITIAL_DC = exports.DEVICE_MODEL = exports.APP_VERSION = exports.functions = exports.types = exports.serialize = exports.as = exports.utils = void 0;
|
|
30
30
|
const _0_bigint_js_1 = require("./utilities/0_bigint.js");
|
|
31
31
|
const _0_password_js_1 = require("./client/0_password.js");
|
|
32
32
|
exports.utils = { checkPassword: _0_password_js_1.checkPassword, getRandomId: _0_bigint_js_1.getRandomId };
|
|
@@ -52,11 +52,11 @@ __exportStar(require("./transport/2_transport_provider.js"), exports);
|
|
|
52
52
|
__exportStar(require("./connection/0_connection.js"), exports);
|
|
53
53
|
__exportStar(require("./connection/1_connection_web_socket.js"), exports);
|
|
54
54
|
var constants_js_1 = require("./constants.js");
|
|
55
|
-
Object.defineProperty(exports, "
|
|
56
|
-
Object.defineProperty(exports, "
|
|
57
|
-
Object.defineProperty(exports, "
|
|
58
|
-
Object.defineProperty(exports, "
|
|
59
|
-
Object.defineProperty(exports, "
|
|
60
|
-
Object.defineProperty(exports, "DEFAULT_SYSTEM_LANG_CODE", { enumerable: true, get: function () { return constants_js_1.DEFAULT_SYSTEM_LANG_CODE; } });
|
|
61
|
-
Object.defineProperty(exports, "DEFAULT_SYSTEM_VERSION", { enumerable: true, get: function () { return constants_js_1.DEFAULT_SYSTEM_VERSION; } });
|
|
55
|
+
Object.defineProperty(exports, "APP_VERSION", { enumerable: true, get: function () { return constants_js_1.APP_VERSION; } });
|
|
56
|
+
Object.defineProperty(exports, "DEVICE_MODEL", { enumerable: true, get: function () { return constants_js_1.DEVICE_MODEL; } });
|
|
57
|
+
Object.defineProperty(exports, "INITIAL_DC", { enumerable: true, get: function () { return constants_js_1.INITIAL_DC; } });
|
|
58
|
+
Object.defineProperty(exports, "LANG_CODE", { enumerable: true, get: function () { return constants_js_1.LANG_CODE; } });
|
|
59
|
+
Object.defineProperty(exports, "LANG_PACK", { enumerable: true, get: function () { return constants_js_1.LANG_PACK; } });
|
|
62
60
|
Object.defineProperty(exports, "LAYER", { enumerable: true, get: function () { return constants_js_1.LAYER; } });
|
|
61
|
+
Object.defineProperty(exports, "SYSTEM_LANG_CODE", { enumerable: true, get: function () { return constants_js_1.SYSTEM_LANG_CODE; } });
|
|
62
|
+
Object.defineProperty(exports, "SYSTEM_VERSION", { enumerable: true, get: function () { return constants_js_1.SYSTEM_VERSION; } });
|