--[[ luawl v1.1 bootstraper for scripts. this code fetches & caches luvit scripts in the folder named luawl.../ https://luawl.org/ ]] local ROOT = "https://auth.luawl.org" local CACHE_DIR = "luawl" local CACHE_FILE = CACHE_DIR .. "/executor.luau" local function log(alias) return { "log", alias } end local function post(path, body) local req = (syn and syn.request) or http_request or request or (http and http.request) if req then local ok, resp = pcall(req, { Url = ROOT .. path, Method = "POST", Body = body, }) if ok and resp then local code = resp.StatusCode or resp.status_code or resp.status local text = resp.Body or resp.body if code == 200 and text and text ~= "" then return text end end end if game and game.HttpPost then local ok, text = pcall(game.HttpPost, game, ROOT .. path, body) if ok and text and text ~= "" then return text end end return nil end local function normalize(input) if type(input) == "table" then local first = input[1] if type(first) == "table" and first[1] == "log" then input = first[2] elseif first == "log" then input = input[2] else input = first or input.login or input.key or input.alias end if type(input) == "table" then input = input[1] or input.login or input.key or input.alias end end if input == 0 or input == "0" or input == "type 0" or input == "log type 0" or input == "type '0'" or input == "log type '0'" or input == 'type "0"' or input == 'log type "0"' or input == "luawl-auth" then input = "bizarro-auth" end return input end local function read(path) if readfile then local ok, value = pcall(readfile, path) if ok and type(value) == "string" then return value end end return nil end local function head(src) if type(src) ~= "string" then return "" end local closeAt = string.find(src, "]]", 1, true) if closeAt and closeAt < 256 then return string.sub(src, 1, closeAt + 1) end return string.sub(src, 1, 192) end local function fetchHead() local req = (syn and syn.request) or http_request or request or (http and http.request) if req then local ok, resp = pcall(req, { Url = ROOT .. "/executor", Method = "GET", Headers = { Range = "bytes=0-255", ["Cache-Control"] = "no-cache", }, }) if ok and resp then local code = resp.StatusCode or resp.status_code or resp.status local text = resp.Body or resp.body if (code == 200 or code == 206) and type(text) == "string" and text ~= "" then return head(text) end end end return nil end local function run(input) local KEY = normalize(input) if not KEY or KEY == "" then return end if #KEY < 64 then local resolved = post("/resolve", KEY) if resolved and #resolved >= 64 then KEY = resolved end end local src = read(CACHE_FILE) local cachedHead = head(src) local remoteHead = fetchHead() if not src or #src < 100000 or (remoteHead and remoteHead ~= cachedHead) then src = game:HttpGet(ROOT .. "/executor") if makefolder then pcall(makefolder, CACHE_DIR) end if writefile then pcall(writefile, CACHE_FILE, src) end end return loadstring(src)(KEY) end local ARG = (...) if ARG == nil then local env = if getgenv then getgenv() else _G if env then env.log = log end if getfenv then local ok, caller = pcall(getfenv, 2) if ok and caller then caller.log = log end end return run end return run(ARG)