From cbba5d40b80d9dec5a04a26d26b959e663ddf573 Mon Sep 17 00:00:00 2001 From: kyle Date: Mon, 2 Feb 2026 22:49:14 +0100 Subject: [PATCH] fix: use traccar subdomain for device server URL Device server URL now derives from TRACCAR_PUBLIC_URL, returning traccar.vip.madeamess.online:5055 instead of vip.madeamess.online:5055 Co-Authored-By: Claude Opus 4.5 --- backend/src/gps/traccar-client.service.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backend/src/gps/traccar-client.service.ts b/backend/src/gps/traccar-client.service.ts index b864162..68515db 100644 --- a/backend/src/gps/traccar-client.service.ts +++ b/backend/src/gps/traccar-client.service.ts @@ -300,18 +300,19 @@ export class TraccarClientService implements OnModuleInit { /** * Get the device port URL for mobile app configuration + * Returns hostname:port for Traccar Client app to connect to */ getDeviceServerUrl(): string { - // In production, this should be the public URL const port = this.configService.get('TRACCAR_DEVICE_PORT') || '5055'; - const frontendUrl = this.configService.get('FRONTEND_URL') || 'http://localhost:5173'; - // Extract hostname from frontend URL + // Use the Traccar public URL to derive the device server hostname + const traccarUrl = this.getTraccarUrl(); try { - const url = new URL(frontendUrl); - return `${url.protocol}//${url.hostname}:${port}`; + const url = new URL(traccarUrl); + // Return just hostname:port (no protocol - the app handles that) + return `${url.hostname}:${port}`; } catch { - return `http://localhost:${port}`; + return `localhost:${port}`; } }