This commit is contained in:
Gvidas Juknevičius 2024-08-18 15:09:33 +03:00
parent 5eb4a9edb7
commit 4c2197919a
Signed by: MCorange
GPG Key ID: 12B1346D720B7FBB
3 changed files with 5 additions and 6 deletions

View File

@ -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

View File

@ -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")

5
x.py
View File

@ -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: