local UPDATER_VERSION = "xunhuo_TK updater 2026 0809 2035 v1.00.005" local SCRIPT_URL = "http://185.241.40.129:18080/xunhuo_TK.lua" local SCRIPT_DIR = "/var/mobile/Media/1ferver/lua/scripts/" local SCRIPT_PATH = SCRIPT_DIR .. "xunhuo_TK.lua" local function launch_script() if type(os.restart) ~= "function" then sys.alert("当前TouchIOS不支持 os.restart(path),请升级TouchIOS", 5) return false end local success, error_message = os.restart(SCRIPT_PATH) if success == false then sys.alert("脚本启动失败\n" .. tostring(error_message), 5) return false end return true end local function cleanup_old_update_files() pcall(os.remove, SCRIPT_PATH .. ".download") pcall(os.remove, SCRIPT_PATH .. ".bak") end local function is_valid_script(content) if type(content) ~= "string" then return false, "响应内容不是字符串" end if #content < 100000 then return false, "脚本长度异常: " .. tostring(#content) end if not string.find(content, "xunhuo_TK", 1, true) then return false, "缺少脚本标识" end if string.find(string.lower(string.sub(content, 1, 512)), " 0 then file.writes(SCRIPT_PATH, old_content) end fail_and_launch_old(reason or "安装后回读不一致") return end cleanup_old_update_files() sys.alert("脚本更新成功\n" .. UPDATER_VERSION, 3) launch_script()