diff --git a/gate.lua b/gate.lua index 52c084d..f37d75d 100644 --- a/gate.lua +++ b/gate.lua @@ -101,7 +101,7 @@ end local function checkAndApplyUpdate() if type(CFG) ~= 'table' then return end - local remoteTs = tonumber(CFG.update_timestamp) + local remoteTs = tonumber(CFG.update_counter) if not remoteTs or remoteTs <= 0 then return end diff --git a/server/routes/api.js b/server/routes/api.js index 35a0eac..672ab50 100644 --- a/server/routes/api.js +++ b/server/routes/api.js @@ -164,7 +164,7 @@ router.get('/config', (req, res) => { promotion: cfg.promotion || { name: '', discount: 1 }, lua_versions: cfg.lua_versions || {}, force_update: cfg.force_update === true, - update_timestamp: cfg.update_timestamp || 0 + update_counter: cfg.update_counter || 0 }); }); @@ -190,8 +190,8 @@ router.put('/config', async (req, res) => { if (typeof incoming.force_update === 'boolean') { cfg.force_update = incoming.force_update; } - if (incoming.update_timestamp) { - cfg.update_timestamp = incoming.update_timestamp; + if (incoming.update_counter) { + cfg.update_counter = incoming.update_counter; } await DataService.saveConfig(cfg); appendReqLog(req, { category: 'admin', type: 'update_config_generic', detail: incoming }); diff --git a/server/routes/public.js b/server/routes/public.js index a7c401d..311c0ae 100644 --- a/server/routes/public.js +++ b/server/routes/public.js @@ -230,7 +230,7 @@ router.get('/config', (req, res) => { promotion: { name: cfg.promotion?.name || '', discount: cfg.promotion?.discount ?? 1 }, lua_versions: cfg.lua_versions || {}, force_update: cfg.force_update === true, - update_timestamp: cfg.update_timestamp || 0 + update_counter: cfg.update_counter || 0 }); }); diff --git a/ticketmachine.lua b/ticketmachine.lua index 0713c4d..bf44c4b 100644 --- a/ticketmachine.lua +++ b/ticketmachine.lua @@ -691,7 +691,7 @@ end local function checkAndApplyUpdate() if type(CFG) ~= 'table' then return end - local remoteTs = tonumber(CFG.update_timestamp) + local remoteTs = tonumber(CFG.update_counter) if not remoteTs or remoteTs <= 0 then return end @@ -728,7 +728,6 @@ local function checkAndApplyUpdate() if lastUpdateError then sleep(3) end - os.reboot() end diff --git a/web/index.js b/web/index.js index 8d3185c..ecb7500 100644 --- a/web/index.js +++ b/web/index.js @@ -1483,8 +1483,8 @@ createApp({ isPushingUpdate.value = true; - // 放弃版本号验证,直接使用时间戳强制下发更新指令 - config.update_timestamp = Date.now(); + // 每次点击,更新计数器 +1,终端只要看到计数器变大就会更新 + config.update_counter = (config.update_counter || 0) + 1; config.force_update = true; try {