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:
2026-07-31 23:30:41 +08:00
parent 87e45de15b
commit 5d2397db7c
2 changed files with 17 additions and 8 deletions
+10 -4
View File
@@ -2,6 +2,9 @@
-- ============================================================================
-- 1. Configuration & Constants
-- ============================================================================
local APP_VERSION = 1
local APP_VERSION_TEXT = "v" .. tostring(APP_VERSION)
local CONFIG = {
CLOUD_URL = "ws://stabadmin.fse-media.group",
API_URL = "http://stabadmin.fse-media.group",
@@ -1108,7 +1111,8 @@ function Network.register()
type = "station_register",
stationName = State.stationName,
stationCode = State.stationCode,
stationPlatform = State.stationPlatform
stationPlatform = State.stationPlatform,
stationVersion = APP_VERSION_TEXT
})
end
@@ -1291,7 +1295,8 @@ function Network.heartbeat()
type = "heartbeat",
stationName = State.stationName,
stationCode = State.stationCode,
stationPlatform = State.stationPlatform
stationPlatform = State.stationPlatform,
stationVersion = APP_VERSION_TEXT
})
end
os.sleep(10)
@@ -1309,7 +1314,7 @@ function Display.render()
mon.clear()
mon.setCursorPos(1,1)
mon.setTextColor(COLORS.INFO)
mon.write("STATION: " .. State.stationName)
mon.write("STATION: " .. State.stationName .. " " .. APP_VERSION_TEXT)
mon.setCursorPos(1,2)
mon.write("TIME: " .. os.date("%H:%M:%S"))
@@ -1397,7 +1402,7 @@ function Display.renderTerminal()
term.setBackgroundColor(colors.gray)
term.setTextColor(colors.white)
term.clearLine()
local title = " Station Broadcast Console (" .. State.stationName .. ") "
local title = " Station Broadcast Console (" .. State.stationName .. " / " .. APP_VERSION_TEXT .. ") "
term.setCursorPos(math.floor((w - #title)/2) + 1, 1)
term.write(title)
term.setBackgroundColor(colors.black)
@@ -1542,6 +1547,7 @@ end
-- ============================================================================
Peripherals.init()
Audio.loadStationList()
Utils.log("INFO", "StationBroadcast version " .. APP_VERSION_TEXT)
parallel.waitForAny(
function()