diff --git a/src/init.lua b/src/init.lua index 4686efb..3ab555f 100644 --- a/src/init.lua +++ b/src/init.lua @@ -91,6 +91,25 @@ type = "boolean" }) + -- Load Basalt + local basalt = {} + if not fs.exists(fs.combine(ctx.path.src, "lib", "basalt")) then + local authenticate = _G._GIT_API_KEY and { Authorization = "Bearer " .. _G._GIT_API_KEY } + local basaltDL, err, errCode = http.get("https://raw.githubusercontent.com/Kristify/kristify/main/src/libs/basalt.lua" + , authenticate) + if not basaltDL then + ctx.logger:error("Couldn't load Basalt into memory! Reason: \'" .. + err .. "\' (code " .. errCode.getResponseCode() .. ')') + return + end + + basalt = load(basaltDL.readAll())() + basaltDL.close() + else + basalt = require("basalt") + end + ctx.basalt = basalt + -- Load scripts ctx.kristly = require(fs.combine("libs", "kristly")) ctx.utils = require("utils") @@ -134,4 +153,4 @@ end ) -ctx.logger:debug("Something exited (init.lua)") +ctx.logger:debug("Something exited (init.lua)") \ No newline at end of file