From 18f39ecea8961ab6f844fc7d6837675e57bea4ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B0=D0=BB=D0=B8=D0=BC=D0=BE=D0=B2=20=D0=A0=D1=83?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=BC?= Date: Wed, 11 Mar 2026 15:18:35 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=BD=D0=BE=D0=B9=20=D0=BF=D0=BE=D0=B4?= =?UTF-8?q?=D1=85=D0=BE=D0=B4=20=D0=BA=20=D0=B7=D0=B2=D0=BE=D0=BD=D0=BA?= =?UTF-8?q?=D0=B0=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/server/src/config.ts | 6 +----- apps/server/src/index.ts | 17 ----------------- apps/web/src/components/CallModal.tsx | 8 +++----- docker-compose.yml | 25 +------------------------ 4 files changed, 5 insertions(+), 51 deletions(-) diff --git a/apps/server/src/config.ts b/apps/server/src/config.ts index 491592d..b0aa02e 100644 --- a/apps/server/src/config.ts +++ b/apps/server/src/config.ts @@ -30,11 +30,7 @@ export const config = { minPasswordLength: 8, /** Maximum registrations allowed from the same IP (permanent, DB-level) */ maxRegistrationsPerIp: Number(process.env.MAX_REGISTRATIONS_PER_IP) || 2, - /** TURN server URL for WebRTC calls (e.g. turn:your-domain.com:3478) */ - turnUrl: process.env.TURN_URL || '', - /** Shared secret for TURN server (coturn static-auth-secret) */ - turnSecret: process.env.TURN_SECRET || '', /** STUN server URLs */ - stunUrls: (process.env.STUN_URLS || 'stun:stun.l.google.com:19302,stun:stun1.l.google.com:19302') + stunUrls: (process.env.STUN_URLS || 'stun:stun.yandex.ru:3478,stun:stun.sipnet.net:3478,stun:stun.l.google.com:19302,stun:stun.voip.aebc.com:3478,stun:stun.stunprotocol.org:3478') .split(',').map(s => s.trim()).filter(Boolean), }; diff --git a/apps/server/src/index.ts b/apps/server/src/index.ts index ae64e76..b0cea86 100644 --- a/apps/server/src/index.ts +++ b/apps/server/src/index.ts @@ -124,23 +124,6 @@ app.get('/api/ice-servers', authenticateToken, (_req: AuthRequest, res) => { iceServers.push({ urls: config.stunUrls }); } - // TURN сервер с временными credentials (coturn --use-auth-secret) - if (config.turnUrl && config.turnSecret) { - const ttl = 24 * 3600; // 24 часа - const timestamp = Math.floor(Date.now() / 1000) + ttl; - const username = `${timestamp}:vortex`; - const credential = crypto - .createHmac('sha1', config.turnSecret) - .update(username) - .digest('base64'); - - iceServers.push({ - urls: config.turnUrl, - username, - credential, - }); - } - res.json({ iceServers }); }); diff --git a/apps/web/src/components/CallModal.tsx b/apps/web/src/components/CallModal.tsx index f02040f..4a1f1e5 100644 --- a/apps/web/src/components/CallModal.tsx +++ b/apps/web/src/components/CallModal.tsx @@ -21,18 +21,16 @@ interface CallModalProps { } | null; } -// ICE servers cache (fetched from server, includes TURN credentials when configured) +// ICE servers cache (fetched from server) let cachedIceConfig: RTCConfiguration | null = null; let iceCacheFetchedAt = 0; const ICE_CACHE_TTL = 3600_000; // 1 hour const FALLBACK_ICE: RTCConfiguration = { iceServers: [ + { urls: 'stun:stun.yandex.ru:3478' }, + { urls: 'stun:stun.sipnet.net:3478' }, { urls: 'stun:stun.l.google.com:19302' }, - { urls: 'stun:stun1.l.google.com:19302' }, - { urls: 'stun:stun2.l.google.com:19302' }, - { urls: 'stun:stun3.l.google.com:19302' }, - { urls: 'stun:stun4.l.google.com:19302' }, ], }; diff --git a/docker-compose.yml b/docker-compose.yml index 4726f95..5d99429 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,10 +22,8 @@ services: DATABASE_URL: ${DATABASE_URL:-postgresql://${POSTGRES_USER:-vortex}:${POSTGRES_PASSWORD:-vortex_pass}@db:5432/${POSTGRES_DB:-vortex_db}} PORT: 3001 JWT_SECRET: ${JWT_SECRET:-your-secure-random-secret-key-here} - CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost,http://localhost:80,http://localhost:9090,http://localhost:5173} + CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost,http://localhost:80,http://localhost:9090,http://localhost:5173,http://${DOMAIN:-mess.khomegeneric.keenetic.pro},https://${DOMAIN:-mess.khomegeneric.keenetic.pro}} ENCRYPTION_KEY: ${ENCRYPTION_KEY:-0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef} - TURN_URL: ${TURN_URL:-turn:${DOMAIN:-mess.khomegeneric.keenetic.pro}:3478} - TURN_SECRET: ${TURN_SECRET:-dcf1c1827c0c520d45130e282ea26991} depends_on: - db ports: @@ -44,26 +42,5 @@ services: depends_on: - server - turn: - image: coturn/coturn - container_name: vortex-turn - restart: always - ports: - - "3478:3478" - - "3478:3478/udp" - - "49152-49170:49152-49170/udp" - command: - - turnserver - - -n - - -v - - --log-file=stdout - - --min-port=49152 - - --max-port=49170 - - --realm=${DOMAIN:-mess.khomegeneric.keenetic.pro} - - --static-auth-secret=${TURN_SECRET:-dcf1c1827c0c520d45130e282ea26991} - - --no-tls - - --no-dtls - - --external-ip=78.47.125.180 - volumes: postgres_data: