From 9440379967e28dd7559e1b926969069a7f4718c1 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 23:29:34 -0400 Subject: [PATCH] this prob better --- keypadOS.lua | 6 ++---- src/updater.lua | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/keypadOS.lua b/keypadOS.lua index 5090159..bb10eb9 100644 --- a/keypadOS.lua +++ b/keypadOS.lua @@ -7,7 +7,7 @@ local require = function(path) return __DEFAULT_IMPORT(path) end end -local KEYPADOS_UPDATE_HASH = "PJIEvsAncSvhKOqsLGVlxvzJ" +local KEYPADOS_UPDATE_HASH = "sYwpknAxtIejdgUxBJigwxgG" rawset(__BUNDLER_FILES, "updater.lua", function () local utils = require("utils.lua") local LAST_USED = os.time() @@ -26,9 +26,7 @@ rawset(__BUNDLER_FILES, "updater.lua", function () if string.find(update_code_text, "^local __BUNDLER_FILES = {}") then -- Make backup fs.copy("startup.lua", "backup.lua") - local pattern = 'local KEYPADOS_UPDATE_HASH%s*=%s*"(.-)"' - local foundUpdateHash = inputString:match(pattern) - if KEYPADOS_UPDATE_HASH ~= foundUpdateHash then + if not string.find(update_code_text, KEYPADOS_UPDATE_HASH) then local file = fs.open("startup.lua", "w") file.write(update_code_text) file.close() diff --git a/src/updater.lua b/src/updater.lua index 092f4d9..09292bf 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -19,16 +19,14 @@ local function checkForUpdate() -- Make backup fs.copy("startup.lua", "backup.lua") - local pattern = 'local KEYPADOS_UPDATE_HASH%s*=%s*"(.-)"' - local foundUpdateHash = inputString:match(pattern) - - if KEYPADOS_UPDATE_HASH ~= foundUpdateHash then + if not string.find(update_code_text, KEYPADOS_UPDATE_HASH) then local file = fs.open("startup.lua", "w") file.write(update_code_text) file.close() os.reboot() else print("Nothing changed, not updating.") + sleep(50) -- delete this later LAST_USED = os.time() return end