fix(ota): make update scripts self-updating and add cache-busting to installers
This commit is contained in:
+7
-2
@@ -69,9 +69,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
|
||||
@@ -130,7 +135,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
|
||||
|
||||
Reference in New Issue
Block a user