feat(station): add visible build version reporting
Add a station build version counter, show it on the monitor and terminal header, log it at startup, and report it to the server during register and heartbeat so deployed client versions are visible during troubleshooting.
This commit is contained in:
@@ -1448,19 +1448,21 @@ function handleHeartbeat(ws, data) {
|
||||
name: cleanName,
|
||||
code: data.stationCode || '',
|
||||
platform: data.stationPlatform || getPlatformNumberFromName(cleanName),
|
||||
version: data.stationVersion || '',
|
||||
lastSeen: Date.now(),
|
||||
ws: ws
|
||||
};
|
||||
normalizeStationRecord(stations[cleanName]);
|
||||
log('INFO', `Station auto-registered via heartbeat: "${cleanName}"`);
|
||||
log('INFO', `Station auto-registered via heartbeat: "${cleanName}"${data.stationVersion ? ` ${data.stationVersion}` : ''}`);
|
||||
broadcastUpdate();
|
||||
} else {
|
||||
stations[cleanName].lastSeen = Date.now();
|
||||
if (data.stationCode) stations[cleanName].code = data.stationCode;
|
||||
if (data.stationPlatform) stations[cleanName].platform = data.stationPlatform;
|
||||
if (data.stationVersion) stations[cleanName].version = data.stationVersion;
|
||||
if (stations[cleanName].ws !== ws) {
|
||||
stations[cleanName].ws = ws; // Update WS in case of reconnect
|
||||
log('INFO', `Station WebSocket updated via heartbeat: "${cleanName}"`);
|
||||
log('INFO', `Station WebSocket updated via heartbeat: "${cleanName}"${data.stationVersion ? ` ${data.stationVersion}` : ''}`);
|
||||
broadcastUpdate();
|
||||
}
|
||||
normalizeStationRecord(stations[cleanName]);
|
||||
@@ -1469,19 +1471,20 @@ function handleHeartbeat(ws, data) {
|
||||
}
|
||||
|
||||
function handleStationRegister(ws, data) {
|
||||
const { stationName, stationCode, stationPlatform } = data;
|
||||
const { stationName, stationCode, stationPlatform, stationVersion } = data;
|
||||
const cleanName = stationName.trim();
|
||||
|
||||
stations[cleanName] = {
|
||||
name: cleanName,
|
||||
code: stationCode,
|
||||
platform: stationPlatform || getPlatformNumberFromName(cleanName),
|
||||
version: stationVersion || '',
|
||||
lastSeen: Date.now(),
|
||||
ws: ws // Keep reference if we need to send back
|
||||
};
|
||||
normalizeStationRecord(stations[cleanName]);
|
||||
|
||||
log('SUCCESS', `Station registered: "${cleanName}" (${stationCode})`);
|
||||
log('SUCCESS', `Station registered: "${cleanName}" (${stationCode})${stationVersion ? ` ${stationVersion}` : ''}`);
|
||||
|
||||
// Send ack
|
||||
ws.send(JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user