common-tg-service 1.3.50 → 1.3.52
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/dist/components/Telegram/utils/generateTGConfig.d.ts +1 -1
- package/dist/components/Telegram/utils/generateTGConfig.js +20 -11
- package/dist/components/Telegram/utils/generateTGConfig.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/tg-apps.js +1 -1
- package/dist/utils/tg-apps.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { TelegramClientParams } from "telegram/client/telegramBaseClient";
|
|
2
|
-
export declare function generateTGConfig(mobile: string): Promise<TelegramClientParams>;
|
|
2
|
+
export declare function generateTGConfig(mobile: string, ttl?: number): Promise<TelegramClientParams>;
|
|
@@ -16,26 +16,35 @@ const APP_VERSIONS = ["1.0.0", "2.1.3", "3.5.7", "4.0.2", "5.0.0"];
|
|
|
16
16
|
function pickRandom(arr) {
|
|
17
17
|
return arr[Math.floor(Math.random() * arr.length)];
|
|
18
18
|
}
|
|
19
|
-
async function generateTGConfig(mobile) {
|
|
19
|
+
async function generateTGConfig(mobile, ttl = 60 * 60 * 24 * 60) {
|
|
20
20
|
const redisKey = `tg:config:${mobile}`;
|
|
21
|
-
const
|
|
22
|
-
if (cached) {
|
|
23
|
-
return cached;
|
|
24
|
-
}
|
|
25
|
-
const config = {
|
|
21
|
+
const commonConfig = {
|
|
26
22
|
connectionRetries: 10,
|
|
27
23
|
requestRetries: 5,
|
|
28
|
-
retryDelay:
|
|
29
|
-
timeout:
|
|
24
|
+
retryDelay: 2000,
|
|
25
|
+
timeout: 30,
|
|
30
26
|
autoReconnect: true,
|
|
31
27
|
maxConcurrentDownloads: 3,
|
|
32
28
|
downloadRetries: 5,
|
|
29
|
+
useWSS: true,
|
|
30
|
+
useIPV6: false,
|
|
31
|
+
};
|
|
32
|
+
const cached = await redisClient_1.RedisClient.getObject(redisKey);
|
|
33
|
+
if (cached) {
|
|
34
|
+
return {
|
|
35
|
+
...cached,
|
|
36
|
+
...commonConfig
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const variableConfig = {
|
|
33
40
|
deviceModel: `${pickRandom(DEVICE_MODELS)}-ssk`,
|
|
34
41
|
systemVersion: pickRandom(SYSTEM_VERSIONS),
|
|
35
42
|
appVersion: pickRandom(APP_VERSIONS),
|
|
36
43
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
await redisClient_1.RedisClient.set(redisKey, variableConfig, ttl);
|
|
45
|
+
return {
|
|
46
|
+
...commonConfig,
|
|
47
|
+
...variableConfig
|
|
48
|
+
};
|
|
40
49
|
}
|
|
41
50
|
//# sourceMappingURL=generateTGConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateTGConfig.js","sourceRoot":"","sources":["../../../../src/components/Telegram/utils/generateTGConfig.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"generateTGConfig.js","sourceRoot":"","sources":["../../../../src/components/Telegram/utils/generateTGConfig.ts"],"names":[],"mappings":";;AA4BA,4CAqCC;AAhED,4DAAyD;AACzD,kDAA+C;AAC/C,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE,WAAW,EAAE,oBAAoB,EAAE,eAAe;IAC7D,WAAW,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU;CAClD,CAAC;AAEF,MAAM,eAAe,GAAG;IACtB,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY;IACpD,YAAY,EAAE,cAAc,EAAE,YAAY;CAC3C,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAGnE,SAAS,UAAU,CAAI,GAAQ;IAC7B,OAAO,GAAG,CAAC,IAAI,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