fix(gate): 修复缺失的 splitDisplayLines 函数定义导致的启动崩溃

- 添加 splitDisplayLines 函数,用于按换行符拆分多行显示文本
- 处理 nil 输入、空字符串及无换行场景的边界情况
- 版本号从 v1.5.30 升级至 v1.5.31
This commit is contained in:
2026-08-15 19:25:19 +08:00
parent e18f732b38
commit 228077a49c
+13 -1
View File
@@ -1,7 +1,7 @@
local DEFAULT_SERVER_BASE = "https://ticket.fse-media.group"
local DEFAULT_SERVER_PATH = "/api/tickets/check"
local GATE_OPEN_SECONDS = 2
local VERSION = "v1.5.30"
local VERSION = "v1.5.31"
local VERSION_CHECK_INTERVAL = 5
local PERIPHERAL_WAIT_INTERVAL = 0.5
local PERIPHERAL_WAIT_MAX_RETRIES = 40
@@ -440,6 +440,18 @@ end
local _cachedDrawArgHash = nil
local function splitDisplayLines(s)
if s == nil then return {} end
local str = tostring(s)
if #trim(str) == 0 then return {} end
local lines = {}
for line in str:gmatch("[^\n]+") do
table.insert(lines, line)
end
if #lines == 0 then table.insert(lines, str) end
return lines
end
local function draw(statusLine1, statusLine2, statusColor)
clear()
if not termDev then return end