From b65b653a7478edc3af0093fefe5627a7a85a0ce1 Mon Sep 17 00:00:00 2001 From: eafonyang Date: Tue, 1 Sep 2026 18:42:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(api):=20=E4=BF=AE=E5=A4=8D=E5=9B=BA?= =?UTF-8?q?=E4=BB=B6=E7=89=88=E6=9C=AC=E6=98=BE=E7=A4=BA=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 formatFirmwareVersionDisplay 函数,支持版本号 >= 2010 的新格式显示 - 对于版本号小于 2010,保持原有 X.Y.0.Z 格式显示 - 对于版本号大于等于 2010,第三段显示两位数尾数,第四段固定为 0 - 更新 changelog,修复系统页面固件版本显示错误问题 --- client/public/changelog.md | 5 +++++ client/src/lib/luxsinApi.ts | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/client/public/changelog.md b/client/public/changelog.md index e8dccd7..cff6f4f 100644 --- a/client/public/changelog.md +++ b/client/public/changelog.md @@ -2,6 +2,11 @@ > This document records feature updates and bug fixes for the Luxsin X9 controller. Entries are listed in reverse chronological order — the newest release appears first. +## v2026.09.01 + +### Bug Fixes +- Fixed the incorrect firmware version display on the System page. + ## v2026.08.17 ### Changes diff --git a/client/src/lib/luxsinApi.ts b/client/src/lib/luxsinApi.ts index 7ae4ad5..6fe3429 100644 --- a/client/src/lib/luxsinApi.ts +++ b/client/src/lib/luxsinApi.ts @@ -477,7 +477,11 @@ export function parseFirmwareVersion(version: unknown): number { return Number(parts[parts.length - 1]); } -/** Display firmware version as X.Y.0.Z (e.g. 2005 → 2.0.0.5). */ +/** + * Display firmware version. + * n < 2010: X.Y.0.Z (e.g. 2005 → 2.0.0.5). + * n >= 2010: third segment carries the two-digit tail (e.g. 2010 → 2.0.10.0, 2011 → 2.0.11.0). + */ export function formatFirmwareVersionDisplay(version: unknown): string { if (version === null || version === undefined || String(version).trim() === "") { return "—"; @@ -485,6 +489,10 @@ export function formatFirmwareVersionDisplay(version: unknown): string { const n = parseFirmwareVersion(version); const major = Math.floor(n / 1000); const minor = Math.floor((n % 1000) / 100); + if (n >= 2010) { + // Since 2.0.10.0 the third segment counts up (09 → 10), fourth segment stays 0. + return `${major}.${minor}.${n % 100}.0`; + } const patch = 0; const build = n % 10; return `${major}.${minor}.${patch}.${build}`;