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