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
@@ -62,9 +62,14 @@ 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
local function download(url, path, binary)
print("Downloading: " .. path)
local ok, data = httpGet(url)
local ok, data = httpGet(getCacheBustedUrl(url))
if not ok then
print("Download failed: " .. tostring(data or ""))
return false
@@ -103,7 +108,7 @@ end
if not download(URL_PASS, "pass.dfpwm", true) then return end
if not download(URL_ERROR, "error.dfpwm", true) then return end
local okGate, gateCode = httpGet(URL_GATE)
local okGate, gateCode = httpGet(getCacheBustedUrl(URL_GATE))
if not okGate then
print("Download failed: startup")
return