From 4c2197919a6fb4e34e39fb784b8dff72b36403ef Mon Sep 17 00:00:00 2001 From: MCorange Date: Sun, 18 Aug 2024 15:09:33 +0300 Subject: [PATCH] ;-; --- keypadOS.lua | 4 ++-- src/updater.lua | 2 +- x.py | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/keypadOS.lua b/keypadOS.lua index 7e9c9a8..70f5919 100644 --- a/keypadOS.lua +++ b/keypadOS.lua @@ -1,4 +1,3 @@ -local __UPDATE_HASH = "33e691170d24b5e81fd7624e5ab2ad9e8c1aeb72" local __BUNDLER_FILES = {} local __DEFAULT_IMPORT = require local require = function(path) @@ -8,6 +7,7 @@ local require = function(path) return __DEFAULT_IMPORT(path) end end +local __UPDATE_HASH = "918aa142c365e6dd2957f611deecaf6ec7bb409a" rawset(__BUNDLER_FILES, "updater.lua", function () local utils = require("utils.lua") local config = require("config.lua") @@ -25,7 +25,7 @@ rawset(__BUNDLER_FILES, "updater.lua", function () 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 __UPDATE_HASH") then + if string.find(update_code_text, "^local __BUNDLER_FILES = {}") then if fs.exists("backup.lua") then fs.delete("backup.lua") end diff --git a/src/updater.lua b/src/updater.lua index 3d74129..57ef886 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -21,7 +21,7 @@ local function checkForUpdate() 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 __UPDATE_HASH") then + if string.find(update_code_text, "^local __BUNDLER_FILES = {}") then -- Make backup if fs.exists("backup.lua") then fs.delete("backup.lua") diff --git a/x.py b/x.py index 56f540d..c527b76 100755 --- a/x.py +++ b/x.py @@ -51,7 +51,7 @@ def main(): buf += " return __DEFAULT_IMPORT(path)\n"; buf += " end\n"; buf += "end\n"; - + buf += "local __UPDATE_HASH = __BUNDLER_REPLACE_HASH__\n"; for file in FILES: print(f"=== FILE: {file}"); buf += read_file(file); @@ -61,8 +61,7 @@ def main(): if MINIMISE: buf = minimise(buf); update_hash = get_hash(buf); - - buf = f"local __UPDATE_HASH = \"{update_hash}\"\n" + buf; + buf = buf.replace("__BUNDLER_REPLACE_HASH__", f"\"{update_hash}\""); print(f"=== UPDATE HASH: {update_hash}") with open(OUTPUT, "w", encoding="utf-8") as f: