diff --git a/client/src/App.tsx b/client/src/App.tsx index e53ccb9..36fb479 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -4,7 +4,11 @@ import { Login } from './components/Login'; import { Dashboard } from './components/Dashboard'; // Create socket with autoConnect disabled so we can add listeners before connecting -const API_URL = process.env.REACT_APP_API_URL || 'http://localhost:3001'; +// Derive backend URL from the page's host so Docker/remote deploys work without rebuild. +// Override with REACT_APP_API_URL (build-time) or REACT_APP_SOCKET_URL (runtime). +const API_URL = process.env.REACT_APP_API_URL + || process.env.REACT_APP_SOCKET_URL + || `${window.location.protocol}//${window.location.hostname}:3001`; export const socket: Socket = io(API_URL, { autoConnect: false }); export type Platform = 'whatsapp' | 'signal'; diff --git a/client/src/components/ContactCard.tsx b/client/src/components/ContactCard.tsx index f03ec98..65e4ba3 100644 --- a/client/src/components/ContactCard.tsx +++ b/client/src/components/ContactCard.tsx @@ -186,7 +186,7 @@ export function ContactCard({ new Date(t).toLocaleTimeString()} + labelFormatter={(t) => new Date(Number(t)).toLocaleTimeString()} contentStyle={{ borderRadius: '8px', border: 'none', boxShadow: '0 4px 6px -1px rgb(0 0 0 / 0.1)' }} /> diff --git a/package.json b/package.json index d3caea6..0c8c6eb 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "scripts": { "build": "tsc", "start": "npx tsx src/index.ts", - "start:server": "npm run start:signal-api && npx tsx src/server.ts", + "start:server": "npm run start:signal-api || true && npx tsx src/server.ts", "start:signal-api": "npx tsx src/scripts/init-signal.ts", "start:client": "cd client && npm start", "dev": "npm run start:server", diff --git a/src/server.ts b/src/server.ts index 2fa8b51..e476f18 100644 --- a/src/server.ts +++ b/src/server.ts @@ -52,6 +52,7 @@ async function connectToWhatsApp() { const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys'); sock = makeWASocket({ + version: [2, 3000, 1034074495], auth: state, logger: pino({ level: 'debug' }), markOnlineOnConnect: true,