more error resistance
This commit is contained in:
parent
4c2197919a
commit
7ce154ed44
|
@ -7,7 +7,7 @@ local require = function(path)
|
||||||
return __DEFAULT_IMPORT(path)
|
return __DEFAULT_IMPORT(path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local __UPDATE_HASH = "918aa142c365e6dd2957f611deecaf6ec7bb409a"
|
local __UPDATE_HASH = "91dd6ccbfd182ee76b5008fe55aa8f752eaf4268"
|
||||||
rawset(__BUNDLER_FILES, "updater.lua", function ()
|
rawset(__BUNDLER_FILES, "updater.lua", function ()
|
||||||
local utils = require("utils.lua")
|
local utils = require("utils.lua")
|
||||||
local config = require("config.lua")
|
local config = require("config.lua")
|
||||||
|
@ -31,6 +31,7 @@ rawset(__BUNDLER_FILES, "updater.lua", function ()
|
||||||
end
|
end
|
||||||
fs.copy("startup.lua", "backup.lua")
|
fs.copy("startup.lua", "backup.lua")
|
||||||
if not string.find(update_code_text, __UPDATE_HASH) then
|
if not string.find(update_code_text, __UPDATE_HASH) then
|
||||||
|
http.post(config.ntfy_url, "Computer #" .. tostring( os.getComputerID() ) .. "updating")
|
||||||
local file = fs.open("startup.lua", "w")
|
local file = fs.open("startup.lua", "w")
|
||||||
file.write(update_code_text)
|
file.write(update_code_text)
|
||||||
file.close()
|
file.close()
|
||||||
|
@ -53,7 +54,10 @@ rawset(__BUNDLER_FILES, "updater.lua", function ()
|
||||||
end
|
end
|
||||||
function mod.UpdateChecker()
|
function mod.UpdateChecker()
|
||||||
while true do
|
while true do
|
||||||
checkForUpdate()
|
local status, err = pcall(checkForUpdate)
|
||||||
|
if not status and err ~= "Terminated" then
|
||||||
|
http.post(config.ntfy_url, err, {Priority = "urgent"})
|
||||||
|
end
|
||||||
sleep(1)
|
sleep(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,6 +29,7 @@ local function checkForUpdate()
|
||||||
fs.copy("startup.lua", "backup.lua")
|
fs.copy("startup.lua", "backup.lua")
|
||||||
|
|
||||||
if not string.find(update_code_text, __UPDATE_HASH) then
|
if not string.find(update_code_text, __UPDATE_HASH) then
|
||||||
|
http.post(config.ntfy_url, "Computer #" .. tostring( os.getComputerID() ) .. "updating")
|
||||||
local file = fs.open("startup.lua", "w")
|
local file = fs.open("startup.lua", "w")
|
||||||
file.write(update_code_text)
|
file.write(update_code_text)
|
||||||
file.close()
|
file.close()
|
||||||
|
@ -52,7 +53,10 @@ end
|
||||||
|
|
||||||
function mod.UpdateChecker()
|
function mod.UpdateChecker()
|
||||||
while true do
|
while true do
|
||||||
checkForUpdate()
|
local status, err = pcall(checkForUpdate)
|
||||||
|
if not status and err ~= "Terminated" then
|
||||||
|
http.post(config.ntfy_url, err, {Priority = "urgent"})
|
||||||
|
end
|
||||||
sleep(1)
|
sleep(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user