From a35c8d65d07ea9a38d9f049231c05ad48451aa74 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 22:28:14 -0400 Subject: [PATCH 01/22] :3 --- keypadOS.lua | 3 +-- src/ui.lua | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/keypadOS.lua b/keypadOS.lua index 6d784bd..3ce2902 100644 --- a/keypadOS.lua +++ b/keypadOS.lua @@ -179,8 +179,7 @@ rawset(__BUNDLER_FILES, "ui.lua", function () fs.delete("basalt.lua") fs.delete("startup.lua") fs.copy("backup.lua", "startup.lua") - os.exit() - -- os.reboot() + os.reboot() end end return mod diff --git a/src/ui.lua b/src/ui.lua index 19063fb..dcbe98f 100644 --- a/src/ui.lua +++ b/src/ui.lua @@ -118,8 +118,7 @@ function mod.InitUi() fs.delete("basalt.lua") fs.delete("startup.lua") fs.copy("backup.lua", "startup.lua") - os.exit() - -- os.reboot() + os.reboot() end end From 34c8e2d48844a6330e9bc0142c9e9be260c45f81 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 22:30:25 -0400 Subject: [PATCH 02/22] uwu --- src/updater.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/updater.lua b/src/updater.lua index 54ea2ec..071e8a7 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -11,7 +11,7 @@ local function checkForUpdate() --its been considerable time since the keypad was interacted with --therefore it's time to force an update down the users throat (microsoft moment) if difference > .5 then - local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua") + local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua?x=" + tostring( math.random(11111111,99999999) )) --I HATE CACHE REEEEEEEEEEEEEEEEE if update_code_request then local update_code_text = update_code_request.readAll() if update_code_text then From 84f5b30cec188bc5e4b3414b4ceee44a850e4f9f Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 22:30:53 -0400 Subject: [PATCH 03/22] :333 --- keypadOS.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keypadOS.lua b/keypadOS.lua index 3ce2902..5378e79 100644 --- a/keypadOS.lua +++ b/keypadOS.lua @@ -19,7 +19,7 @@ rawset(__BUNDLER_FILES, "updater.lua", function () --its been considerable time since the keypad was interacted with --therefore it's time to force an update down the users throat (microsoft moment) if difference > .5 then - local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua") + local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua?x=" + tostring( math.random(11111111,99999999) )) --I HATE CACHE REEEEEEEEEEEEEEEEE if update_code_request then local update_code_text = update_code_request.readAll() if update_code_text then From 4c3f15f5857f8a0e1a2e44f31d74e75dcec5fa2c Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 22:35:40 -0400 Subject: [PATCH 04/22] i hate lua, it's awesome. --- keypadOS.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keypadOS.lua b/keypadOS.lua index 5378e79..b96df74 100644 --- a/keypadOS.lua +++ b/keypadOS.lua @@ -19,7 +19,7 @@ rawset(__BUNDLER_FILES, "updater.lua", function () --its been considerable time since the keypad was interacted with --therefore it's time to force an update down the users throat (microsoft moment) if difference > .5 then - local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua?x=" + tostring( math.random(11111111,99999999) )) --I HATE CACHE REEEEEEEEEEEEEEEEE + local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua?x=" .. tostring( math.random(11111111,99999999) )) --I HATE CACHE REEEEEEEEEEEEEEEEE if update_code_request then local update_code_text = update_code_request.readAll() if update_code_text then From a1c1fe61b2183e1642b414bd4f2fe7915f83a973 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 22:35:49 -0400 Subject: [PATCH 05/22] i hate lua, it's awesome. --- src/updater.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/updater.lua b/src/updater.lua index 071e8a7..efd5dde 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -11,7 +11,7 @@ local function checkForUpdate() --its been considerable time since the keypad was interacted with --therefore it's time to force an update down the users throat (microsoft moment) if difference > .5 then - local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua?x=" + tostring( math.random(11111111,99999999) )) --I HATE CACHE REEEEEEEEEEEEEEEEE + local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua?x=" .. tostring( math.random(11111111,99999999) )) --I HATE CACHE REEEEEEEEEEEEEEEEE if update_code_request then local update_code_text = update_code_request.readAll() if update_code_text then From d39f4d645dc9946d934ef2d2e5bda549e5199730 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 22:40:44 -0400 Subject: [PATCH 06/22] someone very cute and silly swapped MonReset() and MonPrint() methinks --- src/main.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.lua b/src/main.lua index 4476aed..b5de4ad 100644 --- a/src/main.lua +++ b/src/main.lua @@ -10,10 +10,10 @@ local main = {} KEYPADOS_VERSION = "3.0" function main.Main() - utils.MonPrint(0.5) + utils.MonReset(0.5) updater.GetBasalt() utils.MonPrint("keypadOS v" .. KEYPADOS_VERSION) - utils.MonPrint(1) + utils.MonReset(1) require("ui.lua").InitUi() end From 4a50afc9200bc3bdbafa9549436dff8471b31cd9 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 22:41:05 -0400 Subject: [PATCH 07/22] build --- keypadOS.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keypadOS.lua b/keypadOS.lua index b96df74..d1642ad 100644 --- a/keypadOS.lua +++ b/keypadOS.lua @@ -219,10 +219,10 @@ rawset(__BUNDLER_FILES, "main.lua", function () local main = {} KEYPADOS_VERSION = "3.0" function main.Main() - utils.MonPrint(0.5) + utils.MonReset(0.5) updater.GetBasalt() utils.MonPrint("keypadOS v" .. KEYPADOS_VERSION) - utils.MonPrint(1) + utils.MonReset(1) require("ui.lua").InitUi() end return main From c47f089395710c42e46120ddde20df96762ff207 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 22:45:31 -0400 Subject: [PATCH 08/22] hopefully this will stop it from autoupdating for no reason :3 --- keypadOS.lua | 16 +++++++++++----- src/ui.lua | 2 +- src/updater.lua | 16 ++++++++++++---- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/keypadOS.lua b/keypadOS.lua index d1642ad..d1bfe48 100644 --- a/keypadOS.lua +++ b/keypadOS.lua @@ -26,11 +26,17 @@ rawset(__BUNDLER_FILES, "updater.lua", function () if string.find(update_code_text, "^local __BUNDLER_FILES = {}") then --make backup fs.copy("startup.lua","backup.lua") - --install update - local file = fs.open("startup.lua", "w") - file.write(update_code_text) + local startup_file = fs.open("startup.lua", "r") + local startup_contents = file.readAll() file.close() - os.reboot() + if update_code_text ~= startup_contents then + local file = fs.open("startup.lua", "w") + file.write(update_code_text) + file.close() + os.reboot() + else + print("Nothing changed, not updating.") + end end print("Bad file download (core)") end @@ -175,7 +181,7 @@ rawset(__BUNDLER_FILES, "ui.lua", function () end) if not status and err ~= "Terminated" then print("Error detected: " .. err) - monitor.clear() + utils.MonReset(0.5) fs.delete("basalt.lua") fs.delete("startup.lua") fs.copy("backup.lua", "startup.lua") diff --git a/src/ui.lua b/src/ui.lua index dcbe98f..a3e4c00 100644 --- a/src/ui.lua +++ b/src/ui.lua @@ -114,7 +114,7 @@ function mod.InitUi() if not status and err ~= "Terminated" then print("Error detected: " .. err) - monitor.clear() + utils.MonReset(0.5) fs.delete("basalt.lua") fs.delete("startup.lua") fs.copy("backup.lua", "startup.lua") diff --git a/src/updater.lua b/src/updater.lua index efd5dde..559373e 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -19,11 +19,19 @@ local function checkForUpdate() --make backup fs.copy("startup.lua","backup.lua") - --install update - local file = fs.open("startup.lua", "w") - file.write(update_code_text) + local startup_file = fs.open("startup.lua", "r") + local startup_contents = file.readAll() file.close() - os.reboot() + + if update_code_text ~= startup_contents then + local file = fs.open("startup.lua", "w") + file.write(update_code_text) + file.close() + os.reboot() + else + print("Nothing changed, not updating.") + end + end print("Bad file download (core)") end From 591a61d67e3f7873838d12e8931225ee5a9c5eee Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 22:47:50 -0400 Subject: [PATCH 09/22] i might be stupid :( --- keypadOS.lua | 2 +- src/updater.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/keypadOS.lua b/keypadOS.lua index d1bfe48..257bc05 100644 --- a/keypadOS.lua +++ b/keypadOS.lua @@ -27,7 +27,7 @@ rawset(__BUNDLER_FILES, "updater.lua", function () --make backup fs.copy("startup.lua","backup.lua") local startup_file = fs.open("startup.lua", "r") - local startup_contents = file.readAll() + local startup_contents = startup_file.readAll() file.close() if update_code_text ~= startup_contents then local file = fs.open("startup.lua", "w") diff --git a/src/updater.lua b/src/updater.lua index 559373e..8f5a529 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -20,8 +20,8 @@ local function checkForUpdate() fs.copy("startup.lua","backup.lua") local startup_file = fs.open("startup.lua", "r") - local startup_contents = file.readAll() - file.close() + local startup_contents = startup_file.readAll() + startup_file.close() if update_code_text ~= startup_contents then local file = fs.open("startup.lua", "w") From 2669ea449828e49f15379f0134aa9bae6f45c1c0 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 22:48:28 -0400 Subject: [PATCH 10/22] I AM DEFINITELY STUPID MY GOD --- keypadOS.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keypadOS.lua b/keypadOS.lua index 257bc05..7676792 100644 --- a/keypadOS.lua +++ b/keypadOS.lua @@ -28,7 +28,7 @@ rawset(__BUNDLER_FILES, "updater.lua", function () fs.copy("startup.lua","backup.lua") local startup_file = fs.open("startup.lua", "r") local startup_contents = startup_file.readAll() - file.close() + startup_file.close() if update_code_text ~= startup_contents then local file = fs.open("startup.lua", "w") file.write(update_code_text) From cdda1ae058f47d96e20b05c6a720117c2beeaeb5 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 22:55:24 -0400 Subject: [PATCH 11/22] >:3 --- keypadOS.lua | 1 + src/updater.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/keypadOS.lua b/keypadOS.lua index 7676792..6589def 100644 --- a/keypadOS.lua +++ b/keypadOS.lua @@ -36,6 +36,7 @@ rawset(__BUNDLER_FILES, "updater.lua", function () os.reboot() else print("Nothing changed, not updating.") + return end end print("Bad file download (core)") diff --git a/src/updater.lua b/src/updater.lua index 8f5a529..329bc52 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -30,6 +30,7 @@ local function checkForUpdate() os.reboot() else print("Nothing changed, not updating.") + return end end From 2d246ddd92b15fd4d9ee50995b4a8e4b81d8ebf0 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 22:57:44 -0400 Subject: [PATCH 12/22] :3 --- keypadOS.lua | 1 + src/updater.lua | 1 + 2 files changed, 2 insertions(+) diff --git a/keypadOS.lua b/keypadOS.lua index 6589def..811c921 100644 --- a/keypadOS.lua +++ b/keypadOS.lua @@ -36,6 +36,7 @@ rawset(__BUNDLER_FILES, "updater.lua", function () os.reboot() else print("Nothing changed, not updating.") + LAST_USED = os.time() return end end diff --git a/src/updater.lua b/src/updater.lua index 329bc52..de1f53f 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -30,6 +30,7 @@ local function checkForUpdate() os.reboot() else print("Nothing changed, not updating.") + LAST_USED = os.time() return end From b65a746152b0682ff8455a3d8a88a7a25f144aa8 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 23:00:20 -0400 Subject: [PATCH 13/22] idk --- src/updater.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/updater.lua b/src/updater.lua index de1f53f..2a5d644 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -11,18 +11,18 @@ local function checkForUpdate() --its been considerable time since the keypad was interacted with --therefore it's time to force an update down the users throat (microsoft moment) if difference > .5 then - local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua?x=" .. tostring( math.random(11111111,99999999) )) --I HATE CACHE REEEEEEEEEEEEEEEEE + local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua?x=" .. tostring(math.random(11111111, 99999999))) -- I HATE CACHE REEEEEEEEEEEEEEEEE if update_code_request then local update_code_text = update_code_request.readAll() if update_code_text then if string.find(update_code_text, "^local __BUNDLER_FILES = {}") then - --make backup - fs.copy("startup.lua","backup.lua") + -- Make backup + fs.copy("startup.lua", "backup.lua") local startup_file = fs.open("startup.lua", "r") local startup_contents = startup_file.readAll() startup_file.close() - + if update_code_text ~= startup_contents then local file = fs.open("startup.lua", "w") file.write(update_code_text) @@ -33,13 +33,15 @@ local function checkForUpdate() LAST_USED = os.time() return end - + else + print("Bad file download (core)") end - print("Bad file download (core)") + else + print("Bad mem read (core)") end - print("Bad mem read (core)") + else + print("Bad download (core)") end - print("Bad download (core)") end end From 2e33e98e5e7ed7dc3946f797b0b6df5711548802 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 23:01:49 -0400 Subject: [PATCH 14/22] ah --- keypadOS.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/keypadOS.lua b/keypadOS.lua index 811c921..a0404f9 100644 --- a/keypadOS.lua +++ b/keypadOS.lua @@ -19,13 +19,13 @@ rawset(__BUNDLER_FILES, "updater.lua", function () --its been considerable time since the keypad was interacted with --therefore it's time to force an update down the users throat (microsoft moment) if difference > .5 then - local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua?x=" .. tostring( math.random(11111111,99999999) )) --I HATE CACHE REEEEEEEEEEEEEEEEE + local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua?x=" .. tostring(math.random(11111111, 99999999))) -- I HATE CACHE REEEEEEEEEEEEEEEEE if update_code_request then local update_code_text = update_code_request.readAll() if update_code_text then if string.find(update_code_text, "^local __BUNDLER_FILES = {}") then - --make backup - fs.copy("startup.lua","backup.lua") + -- Make backup + fs.copy("startup.lua", "backup.lua") local startup_file = fs.open("startup.lua", "r") local startup_contents = startup_file.readAll() startup_file.close() @@ -39,12 +39,15 @@ rawset(__BUNDLER_FILES, "updater.lua", function () LAST_USED = os.time() return end + else + print("Bad file download (core)") end - print("Bad file download (core)") + else + print("Bad mem read (core)") end - print("Bad mem read (core)") + else + print("Bad download (core)") end - print("Bad download (core)") end end function mod.UpdateChecker() From 68a7d4eaa501a7fe5479588c04da60f7f1a511ff Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 23:24:30 -0400 Subject: [PATCH 15/22] trying new update system mayb --- keypadOS.lua | 20 +++++++++++++------- src/ui.lua | 12 ++++++++++-- src/updater.lua | 7 +++---- x.py | 5 ++++- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/keypadOS.lua b/keypadOS.lua index a0404f9..5090159 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" rawset(__BUNDLER_FILES, "updater.lua", function () local utils = require("utils.lua") local LAST_USED = os.time() @@ -26,10 +26,9 @@ 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 startup_file = fs.open("startup.lua", "r") - local startup_contents = startup_file.readAll() - startup_file.close() - if update_code_text ~= startup_contents then + local pattern = 'local KEYPADOS_UPDATE_HASH%s*=%s*"(.-)"' + local foundUpdateHash = inputString:match(pattern) + if KEYPADOS_UPDATE_HASH ~= foundUpdateHash then local file = fs.open("startup.lua", "w") file.write(update_code_text) file.close() @@ -160,13 +159,20 @@ rawset(__BUNDLER_FILES, "ui.lua", function () ui.enterButton = ui.main:addButton() :setText(">>>>") :setBackground(colors.blue) - :setPosition(6,3) + :setPosition(6,2) :setSize(1.5,3.2) :onClick(function() unlockDoor(ui) end) local btnX = 1 - local btnY = 3 + local btnY = 2 + ui.main:addButton() + :setPosition(1, 5) + :setText("0") + :setSize(6,1) + :onClick(function() + addToPin(ui, 0) + end) for i = 1, 9 do ui.main:addButton() :setPosition(btnX, btnY) diff --git a/src/ui.lua b/src/ui.lua index a3e4c00..d409c86 100644 --- a/src/ui.lua +++ b/src/ui.lua @@ -83,14 +83,22 @@ function mod.InitUi() ui.enterButton = ui.main:addButton() :setText(">>>>") :setBackground(colors.blue) - :setPosition(6,3) + :setPosition(6,2) :setSize(1.5,3.2) :onClick(function() unlockDoor(ui) end) local btnX = 1 - local btnY = 3 + local btnY = 2 + + ui.main:addButton() + :setPosition(1, 5) + :setText("0") + :setSize(6,1) + :onClick(function() + addToPin(ui, 0) + end) for i = 1, 9 do ui.main:addButton() diff --git a/src/updater.lua b/src/updater.lua index 2a5d644..092f4d9 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -19,11 +19,10 @@ local function checkForUpdate() -- Make backup fs.copy("startup.lua", "backup.lua") - local startup_file = fs.open("startup.lua", "r") - local startup_contents = startup_file.readAll() - startup_file.close() + local pattern = 'local KEYPADOS_UPDATE_HASH%s*=%s*"(.-)"' + local foundUpdateHash = inputString:match(pattern) - if update_code_text ~= startup_contents then + if KEYPADOS_UPDATE_HASH ~= foundUpdateHash then local file = fs.open("startup.lua", "w") file.write(update_code_text) file.close() diff --git a/x.py b/x.py index 4096655..14978e6 100755 --- a/x.py +++ b/x.py @@ -1,5 +1,7 @@ #!/usr/bin/python - +import string +import random +UPDATE_ID= ''.join(random.choices(string.ascii_letters, k=24)) OUTPUT="keypadOS.lua"; FILES= [ "updater.lua", @@ -31,6 +33,7 @@ def main(): buf += " return __DEFAULT_IMPORT(path)\n"; buf += " end\n"; buf += "end\n"; + buf += f'local KEYPADOS_UPDATE_HASH = "{UPDATE_ID}"'; for file in FILES: print(f"=== FILE: {file}"); From 9440379967e28dd7559e1b926969069a7f4718c1 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 23:29:34 -0400 Subject: [PATCH 16/22] 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 From e62abe56d6c5da22afa96c3f9d7f783d69347f37 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 23:30:11 -0400 Subject: [PATCH 17/22] this prob better --- keypadOS.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/keypadOS.lua b/keypadOS.lua index bb10eb9..ff93955 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 = "sYwpknAxtIejdgUxBJigwxgG" +local KEYPADOS_UPDATE_HASH = "bKkYwsVcXKtXDBdkQPQTxFYR" rawset(__BUNDLER_FILES, "updater.lua", function () local utils = require("utils.lua") local LAST_USED = os.time() @@ -33,6 +33,7 @@ rawset(__BUNDLER_FILES, "updater.lua", function () os.reboot() else print("Nothing changed, not updating.") + sleep(50) -- delete this later LAST_USED = os.time() return end From 0c15f13efb98b50347623cd94213d7ec1be965dd Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 23:33:47 -0400 Subject: [PATCH 18/22] im sleepy --- keypadOS.lua | 4 ++-- src/ui.lua | 1 + src/updater.lua | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/keypadOS.lua b/keypadOS.lua index ff93955..1202c5f 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 = "bKkYwsVcXKtXDBdkQPQTxFYR" +local KEYPADOS_UPDATE_HASH = "xBDnzGEOVIVZyRGGMsKFCptR" rawset(__BUNDLER_FILES, "updater.lua", function () local utils = require("utils.lua") local LAST_USED = os.time() @@ -33,7 +33,6 @@ rawset(__BUNDLER_FILES, "updater.lua", function () os.reboot() else print("Nothing changed, not updating.") - sleep(50) -- delete this later LAST_USED = os.time() return end @@ -191,6 +190,7 @@ rawset(__BUNDLER_FILES, "ui.lua", function () end) if not status and err ~= "Terminated" then print("Error detected: " .. err) + sleep(10) utils.MonReset(0.5) fs.delete("basalt.lua") fs.delete("startup.lua") diff --git a/src/ui.lua b/src/ui.lua index d409c86..e18b633 100644 --- a/src/ui.lua +++ b/src/ui.lua @@ -122,6 +122,7 @@ function mod.InitUi() if not status and err ~= "Terminated" then print("Error detected: " .. err) + sleep(10) utils.MonReset(0.5) fs.delete("basalt.lua") fs.delete("startup.lua") diff --git a/src/updater.lua b/src/updater.lua index 09292bf..ad06af0 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -26,7 +26,6 @@ local function checkForUpdate() os.reboot() else print("Nothing changed, not updating.") - sleep(50) -- delete this later LAST_USED = os.time() return end From 739e731bc45757d501af045a7bb66b1c02666b48 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 23:35:55 -0400 Subject: [PATCH 19/22] i think i fixed it :O --- src/updater.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/updater.lua b/src/updater.lua index ad06af0..49990af 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -17,6 +17,9 @@ local function checkForUpdate() if update_code_text then if string.find(update_code_text, "^local __BUNDLER_FILES = {}") then -- Make backup + if fs.exists("backup.lua") then + fs.delete("backup.lua") + end fs.copy("startup.lua", "backup.lua") if not string.find(update_code_text, KEYPADOS_UPDATE_HASH) then From d6f168e9eb9f95ed573a2eb88b02057dd45e7191 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 23:36:23 -0400 Subject: [PATCH 20/22] need mcorange git actions --- keypadOS.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/keypadOS.lua b/keypadOS.lua index 1202c5f..372c83f 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 = "xBDnzGEOVIVZyRGGMsKFCptR" +local KEYPADOS_UPDATE_HASH = "dGWGjxrYViZwxsSgLMdmnMeu" rawset(__BUNDLER_FILES, "updater.lua", function () local utils = require("utils.lua") local LAST_USED = os.time() @@ -25,6 +25,9 @@ rawset(__BUNDLER_FILES, "updater.lua", function () if update_code_text then if string.find(update_code_text, "^local __BUNDLER_FILES = {}") then -- Make backup + if fs.exists("backup.lua") then + fs.delete("backup.lua") + end fs.copy("startup.lua", "backup.lua") if not string.find(update_code_text, KEYPADOS_UPDATE_HASH) then local file = fs.open("startup.lua", "w") From 2bec12c8dfa03d8096485ae617ef8e670a0a9a43 Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 23:47:04 -0400 Subject: [PATCH 21/22] increased auto update delay, ntfy integration, additionally, testing whether or not the updates work before installing it on existing keypads. --- keypadOS.lua | 7 ++++--- src/ui.lua | 3 ++- src/updater.lua | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/keypadOS.lua b/keypadOS.lua index 372c83f..8696cbe 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 = "dGWGjxrYViZwxsSgLMdmnMeu" +local KEYPADOS_UPDATE_HASH = "AwORcRpboefqGZBiZMSjEBeG" rawset(__BUNDLER_FILES, "updater.lua", function () local utils = require("utils.lua") local LAST_USED = os.time() @@ -18,7 +18,7 @@ rawset(__BUNDLER_FILES, "updater.lua", function () print("Checking for update... difference: " .. tostring(difference)) --its been considerable time since the keypad was interacted with --therefore it's time to force an update down the users throat (microsoft moment) - if difference > .5 then + if difference > 10 then local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua?x=" .. tostring(math.random(11111111, 99999999))) -- I HATE CACHE REEEEEEEEEEEEEEEEE if update_code_request then local update_code_text = update_code_request.readAll() @@ -193,7 +193,8 @@ rawset(__BUNDLER_FILES, "ui.lua", function () end) if not status and err ~= "Terminated" then print("Error detected: " .. err) - sleep(10) + http.post("https://ntfy.sh/keypadOS_alerts", err, {Priority = "urgent"}) --exposed ntfy url no spam me pls + sleep(5) utils.MonReset(0.5) fs.delete("basalt.lua") fs.delete("startup.lua") diff --git a/src/ui.lua b/src/ui.lua index e18b633..48ad5d8 100644 --- a/src/ui.lua +++ b/src/ui.lua @@ -122,7 +122,8 @@ function mod.InitUi() if not status and err ~= "Terminated" then print("Error detected: " .. err) - sleep(10) + http.post("https://ntfy.sh/keypadOS_alerts", err, {Priority = "urgent"}) --exposed ntfy url no spam me pls + sleep(5) utils.MonReset(0.5) fs.delete("basalt.lua") fs.delete("startup.lua") diff --git a/src/updater.lua b/src/updater.lua index 49990af..55eef06 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -10,7 +10,7 @@ local function checkForUpdate() print("Checking for update... difference: " .. tostring(difference)) --its been considerable time since the keypad was interacted with --therefore it's time to force an update down the users throat (microsoft moment) - if difference > .5 then + if difference > 10 then local update_code_request = http.get("https://git.mcorangehq.xyz/xomf/keypadOS/raw/branch/main/keypadOS.lua?x=" .. tostring(math.random(11111111, 99999999))) -- I HATE CACHE REEEEEEEEEEEEEEEEE if update_code_request then local update_code_text = update_code_request.readAll() From bacd5ac1aa63ad2e7cc5d7ba49cc31cad16ba5ef Mon Sep 17 00:00:00 2001 From: xomf Date: Sat, 17 Aug 2024 23:57:04 -0400 Subject: [PATCH 22/22] final update of the night if nothing breaks, changed pin to reflect new zero button (very important feature) --- keypadOS.lua | 6 +++--- src/config.lua | 2 +- src/main.lua | 2 +- x.py | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/keypadOS.lua b/keypadOS.lua index 8696cbe..4a712f8 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 = "AwORcRpboefqGZBiZMSjEBeG" +local KEYPADOS_UPDATE_HASH = "sxJGuLGHFrttJcPZAxUKxhPw" rawset(__BUNDLER_FILES, "updater.lua", function () local utils = require("utils.lua") local LAST_USED = os.time() @@ -81,7 +81,7 @@ end) -- FILE END: updater.lua -- rawset(__BUNDLER_FILES, "config.lua", function () return { - correctPin = "42169" + correctPin = "42069" } end) -- FILE END: config.lua -- @@ -237,7 +237,7 @@ rawset(__BUNDLER_FILES, "main.lua", function () local utils = require("utils.lua") local updater = require("updater.lua") local main = {} - KEYPADOS_VERSION = "3.0" + KEYPADOS_VERSION = "4.0" function main.Main() utils.MonReset(0.5) updater.GetBasalt() diff --git a/src/config.lua b/src/config.lua index 40cdf55..20daa75 100644 --- a/src/config.lua +++ b/src/config.lua @@ -1,3 +1,3 @@ return { - correctPin = "42169" + correctPin = "42069" } diff --git a/src/main.lua b/src/main.lua index b5de4ad..ceb6f2b 100644 --- a/src/main.lua +++ b/src/main.lua @@ -7,7 +7,7 @@ local updater = require("updater.lua") local main = {} -KEYPADOS_VERSION = "3.0" +KEYPADOS_VERSION = "4.0" function main.Main() utils.MonReset(0.5) diff --git a/x.py b/x.py index 14978e6..42671c2 100755 --- a/x.py +++ b/x.py @@ -38,6 +38,7 @@ def main(): for file in FILES: print(f"=== FILE: {file}"); buf += read_file(file); + print(f"=== UPDATE HASH: {UPDATE_ID}") buf += "\nrequire(\"main.lua\").Main()\n";