mirror of https://github.com/Nofated095/Q2TG.git
perf: 通过环境变量设置 websocket
This commit is contained in:
parent
7ba8e9116a
commit
4987b15e0e
|
@ -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
|
||||
|
|
|
@ -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<boolean | void>;
|
||||
type ServiceMessageHandler = (message: Api.MessageService) => Promise<boolean | void>;
|
||||
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue