fix(ota): make update scripts self-updating and add cache-busting to installers

This commit is contained in:
2026-07-11 16:00:37 +08:00
parent de187db646
commit 4fe3a24eaf
7 changed files with 70 additions and 14 deletions
+7 -2
View File
@@ -54,19 +54,24 @@ local function httpGet(url)
end
end
local function getCacheBustedUrl(url)
local sep = url:find("?") and "&" or "?"
return url .. sep .. "_t=" .. tostring(os.epoch and os.epoch("utc") or math.random(1, 999999))
end
term.clear()
term.setCursorPos(1, 1)
print("Refill Machine Installer")
print("")
print("Downloading refill machine program...")
local ok, code = httpGet(URL_REFILL_MACHINE)
local ok, code = httpGet(getCacheBustedUrl(URL_REFILL_MACHINE))
if not ok or type(code) ~= "string" or #code == 0 then
print("Download failed: " .. tostring(code or ""))
return
end
local okUpdate, updateCode = httpGet(URL_UPDATE_REFILL)
local okUpdate, updateCode = httpGet(getCacheBustedUrl(URL_UPDATE_REFILL))
if not okUpdate or type(updateCode) ~= "string" or #updateCode == 0 then
print("Download failed: " .. tostring(updateCode or ""))
return