From b52af6647101b93c92a3c34d6682271e4c644081 Mon Sep 17 00:00:00 2001 From: Layla Manley Date: Sun, 8 Oct 2023 04:10:24 -0400 Subject: [PATCH] iteration --- lib/lum.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/lum.lua b/lib/lum.lua index 492bb39..c9c2474 100644 --- a/lib/lum.lua +++ b/lib/lum.lua @@ -3,8 +3,24 @@ local bin_path = "/bin/" local lib_path = "/lib/" local startup_path = "/startup/" +settings.define("lum.target_branch", { + description = "Target branch for updates", + type = "string", + default = "main" +}) + +settings.define("lum.log_level", { + description = "Log Level", + type = "string", + default = "debug" +}) + function download_lua(remote_path, local_path) - response = http.get("https://gitea.layla.gg/layla/computercraft/raw/branch/" .. target_branch .. "/" .. remote_path .. ".lua", nil) + local url = "https://gitea.layla.gg/layla/computercraft/raw/branch/" .. settings.get("lum.target_branch") .. "/" .. remote_path .. ".lua" + if settings.get("lum.log_level") == "debug" then + io.write("Downloading " .. url .. " to " .. local_path .. "\n") + end + local response = http.get(url, nil) if response.getResponseCode() == 200 then file = fs.open(local_path, "w") file.write(response.readAll())