diff --git a/Dockerfile b/Dockerfile index be06764e..730881cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -56,5 +56,6 @@ COPY prisma /app/ RUN pnpm exec prisma generate COPY --from=build /app/build /app/build +ENV TG_CONNECTION=websocket ENV DATA_DIR=/app/data CMD pnpm start diff --git a/src/client/Telegram.ts b/src/client/Telegram.ts index 0c8ab824..8d029a87 100644 --- a/src/client/Telegram.ts +++ b/src/client/Telegram.ts @@ -13,8 +13,8 @@ import TelegramSession from '../models/TelegramSession'; import { LogLevel } from 'telegram/extensions/Logger'; import { BigInteger } from 'big-integer'; import { IterMessagesParams } from 'telegram/client/messages'; -import { PromisedWebSockets } from 'telegram/extensions'; -import { ConnectionTCPObfuscated } from 'telegram/network'; +import { PromisedNetSockets, PromisedWebSockets } from 'telegram/extensions'; +import { ConnectionTCPFull, ConnectionTCPObfuscated } from 'telegram/network'; type MessageHandler = (message: Api.Message) => Promise; type ServiceMessageHandler = (message: Api.MessageService) => Promise; @@ -55,8 +55,8 @@ export default class Telegram { port: parseInt(process.env.PROXY_PORT), } : undefined, autoReconnect: true, - networkSocket: PromisedWebSockets, - connection: ConnectionTCPObfuscated, + networkSocket: process.env.TG_CONNECTION === 'websocket' ? PromisedWebSockets : PromisedNetSockets, + connection: process.env.TG_CONNECTION === 'websocket' ? ConnectionTCPObfuscated : ConnectionTCPFull, }, ); // this.client.logger.setLevel(LogLevel.WARN); diff --git a/src/controllers/SetupController.ts b/src/controllers/SetupController.ts index a432b5ea..2ca400b8 100644 --- a/src/controllers/SetupController.ts +++ b/src/controllers/SetupController.ts @@ -9,8 +9,6 @@ import { WorkMode } from '../types/definitions'; import OicqClient from '../client/OicqClient'; import { md5Hex } from '../utils/hashing'; import Instance from '../models/Instance'; -import db from '../models/db'; -import { CustomFile } from 'telegram/client/uploads'; export default class SetupController { private readonly setupService: SetupService;