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 <noreply@anthropic.com>
This commit is contained in:
@@ -300,18 +300,19 @@ export class TraccarClientService implements OnModuleInit {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the device port URL for mobile app configuration
|
* Get the device port URL for mobile app configuration
|
||||||
|
* Returns hostname:port for Traccar Client app to connect to
|
||||||
*/
|
*/
|
||||||
getDeviceServerUrl(): string {
|
getDeviceServerUrl(): string {
|
||||||
// In production, this should be the public URL
|
|
||||||
const port = this.configService.get<string>('TRACCAR_DEVICE_PORT') || '5055';
|
const port = this.configService.get<string>('TRACCAR_DEVICE_PORT') || '5055';
|
||||||
const frontendUrl = this.configService.get<string>('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 {
|
try {
|
||||||
const url = new URL(frontendUrl);
|
const url = new URL(traccarUrl);
|
||||||
return `${url.protocol}//${url.hostname}:${port}`;
|
// Return just hostname:port (no protocol - the app handles that)
|
||||||
|
return `${url.hostname}:${port}`;
|
||||||
} catch {
|
} catch {
|
||||||
return `http://localhost:${port}`;
|
return `localhost:${port}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user