-- FlowAuth isolated console return (function(...) local kind,protect,raise=type,pcall,error local getEnvironment,setEnvironment,compile=getfenv,setfenv,loadstring if kind(getEnvironment)~="function" or kind(setEnvironment)~="function" then return nil,"Silent execution is unavailable in this executor" end local base=getEnvironment() local inherited=rawget(base,"__flowauth_console_scope") local shared=base if kind(getgenv)=="function" then local ok,value=protect(getgenv);if ok and kind(value)=="table" then shared=value end end if kind(inherited)=="table" and kind(inherited.base)=="table" and kind(inherited.compile)=="function" then base,shared,compile=inherited.base,inherited.shared,inherited.compile end local unpackValues=table.unpack or unpack local function pack(...)return {n=select("#",...),...}end local quiet=true local pending={} local authoredError local nativePrint,nativeWarn=base.print,base.warn local nativeRawGet,nativeRawSet=rawget,rawset local function output(fn,...) if quiet==nil then if #pending<32 then pending[#pending+1]={fn,pack(...)}end elseif not quiet and kind(fn)=="function" then fn(...)end end local function decide(value) if quiet~=nil then return end quiet=value if not quiet then for _,entry in ipairs(pending)do if kind(entry[1])=="function" then entry[1](unpackValues(entry[2],1,entry[2].n))end end end pending={} end local scope,sharedScope={},{} setmetatable(scope,{__index=base,__newindex=base}) setmetatable(sharedScope,{__index=shared,__newindex=shared}) local function mutedPrint(...)output(nativePrint,...)end local function mutedWarn(...)output(nativeWarn,...)end local function scopedCompile(text,name) if kind(text)=="string" then local prefix=string.sub(text,1,256) if string.find(prefix,"-- FlowAuth console: silent",1,true)then decide(true) elseif string.find(prefix,"-- FlowAuth console: normal",1,true)then decide(false)end end local chunk,reason=compile(text,name) if kind(chunk)=="function" then if name=="=FlowAuth" or name=="=FlowAuthInit" or name=="=FlowAuthUI" then setEnvironment(chunk,base) local function authored(fn) return function(...) local values=pack(protect(fn,...)) if not values[1] then authoredError=values[2];raise(values[2],0)end if name=="=FlowAuthInit" and kind(values[2])=="function" then values[2]=authored(values[2])end return unpackValues(values,2,values.n) end end return authored(chunk) end setEnvironment(chunk,scope) end return chunk,reason end local function scopedRawGet(environment,key) if environment==scope or environment==sharedScope then local own=nativeRawGet(environment,key) if own~=nil then return own end return nativeRawGet(environment==scope and base or shared,key) end return nativeRawGet(environment,key) end local function scopedRawSet(environment,key,value) if environment==scope then nativeRawSet(base,key,value);return environment end if environment==sharedScope then nativeRawSet(shared,key,value);return environment end return nativeRawSet(environment,key,value) end for _,environment in ipairs({scope,sharedScope})do rawset(environment,"__flowauth_console_scope",{base=base,shared=shared,compile=compile}) rawset(environment,"rawget",scopedRawGet);rawset(environment,"rawset",scopedRawSet) rawset(environment,"print",mutedPrint);rawset(environment,"warn",mutedWarn) rawset(environment,"loadstring",scopedCompile) rawset(environment,"getgenv",function()return sharedScope end) rawset(environment,"_G",sharedScope) end local function run(...) local credential=... local type,pcall,error,tostring,tonumber=type,pcall,error,tostring,tonumber local rawset,getfenv=rawset,getfenv local globals,host=_G,game local byte,gsub,find=string.byte,string.gsub,string.find local wait=type(task)=="table"and task.wait local clock=os.clock local compile=loadstring local function member(value,key) local ok,result=pcall(function()return value[key]end) if ok then return result end end local spawn=member(task,"spawn") local fetch=member(host,"HttpGet") local ok,scriptEnv=pcall(function()return getfenv()end) if not ok or type(scriptEnv)~="table"then scriptEnv=globals end local ok,environment=pcall(function()return getgenv()end) if not ok or type(environment)~="table"then environment=scriptEnv end local function global(key)return member(environment,key)or member(scriptEnv,key)or member(globals,key)end local requests,seen={},{} local function add(fn,name) if type(fn)=="function"and not seen[fn]then seen[fn]=true;requests[#requests+1]={fn,name}end end add(global("request"),"request") add(global("http_request"),"http_request") add(global("httpRequest"),"httpRequest") add(global("httprequest"),"httprequest") add(member(global("http"),"request"),"http.request") add(member(global("syn"),"request"),"syn.request") local bufferText=member(global("buffer"),"tostring") local url="\104\116\116\112\115\058\047\047\102\108\111\119\097\117\116\104\046\110\101\116\047\097\115\115\101\116\115\047\102\108\111\119\097\117\116\104\047\115\104\097\050\053\054\047\102\048\051\102\102\100\057\054\101\051\101\054\050\102\053\054\053\098\057\049\053\050\048\053\097\052\098\050\050\053\100\102\052\101\097\101\052\100\053\098\100\055\051\054\056\051\050\054\097\100\098\050\048\101\055\049\099\049\056\100\057\057\102\055\047\118\052\095\098\111\111\116\115\116\114\097\112\112\101\114\095\109\097\114\098\101\103\046\108\117\097" local fallback="\104\116\116\112\115\058\047\047\051\055\046\049\056\055\046\049\051\054\046\049\056\055\047\097\115\115\101\116\115\047\102\108\111\119\097\117\116\104\047\115\104\097\050\053\054\047\102\048\051\102\102\100\057\054\101\051\101\054\050\102\053\054\053\098\057\049\053\050\048\053\097\052\098\050\050\053\100\102\052\101\097\101\052\100\053\098\100\055\051\054\056\051\050\054\097\100\098\050\048\101\055\049\099\049\056\100\057\057\102\055\047\118\052\095\098\111\111\116\115\116\114\097\112\112\101\114\095\109\097\114\098\101\103\046\108\117\097" local pinned=url.."?retry=380a07fd8aee6d02" local retry=gsub(url,"/sha256/[a-f0-9]+/","/").."?retry=380a07fd8aee6d02" local expected=680955 local runtime,reason,issue,priority=nil,nil,"request failed",0 local transport,issueTransport="HttpGet","HttpGet" local function problem(message,rank) if rank>=priority then issue,priority,issueTransport=message,rank,transport end end local function accept(value) if type(value)=="buffer"then local ok,text=pcall(bufferText,value);value=ok and text or nil end if type(value)~="string"then problem("unsupported response body",1);return end if #value~=expected then if #value<1024 and find(value,"Failed to send HTTP request.",1,true)then problem(find(value,"timed out",1,true)and"HTTP request timed out"or"HTTP request failed",2) else problem("received "..#value.." bytes; expected "..expected,2)end return end -- Eight bytes per Adler-32 step. local s1,s2,i=1.0,0.0,1 while i+7<=#value do local a,b,c,d,e,f,g,h=byte(value,i,i+7) s2=(s2+8*s1+8*a+7*b+6*c+5*d+4*e+3*f+2*g+h)%65521 s1=(s1+a+b+c+d+e+f+g+h)%65521;i=i+8 end while i<=#value do s1=(s1+byte(value,i))%65521;s2=(s2+s1)%65521;i=i+1 end if s2*65536.0+s1~=668314204 then problem("runtime checksum mismatch",3);return end local ok,compiled,detail=pcall(compile,value,"=FlowAuthRuntime") if ok and type(compiled)=="function"then runtime=compiled;return true end reason=(ok and detail or compiled)or"compiler returned no function" return false end local candidates={{fetch,"HttpGet",url}} if fallback~=""then candidates[#candidates+1]={fetch,"HttpGet",fallback,true}end for i=1,#requests do local candidate=requests[i] if fallback~=""then candidates[#candidates+1]={candidate[1],candidate[2],fallback,true}end candidates[#candidates+1]={candidate[1],candidate[2],pinned} end candidates[#candidates+1]={fetch,"HttpGet",retry} local started,nextIndex,lastStart=clock(),1,0 local jobs,closed,alternate={},false,false local asynchronous=type(spawn)=="function"and type(wait)=="function" -- Only public GETs run in workers. local function launch() local candidate=candidates[nextIndex];nextIndex=nextIndex+1;lastStart=clock() local job={name=candidate[2],alternate=candidate[4]};jobs[#jobs+1]=job local function run() if closed or job.started then return end job.started=true local ok,response if job.name=="HttpGet"then ok,response=pcall(candidate[1],host,candidate[3]) else ok,response=pcall(candidate[1],{Url=candidate[3],Method="GET"})end if not closed then job.ok,job.response,job.done=ok,response,true end end if asynchronous then local ok,thread=pcall(spawn,run);job.thread=ok and thread or nil if not job.started and type(job.thread)~="thread"then asynchronous=false;run()end else run()end end launch() for poll=1,600 do if clock()-started>=15 then problem("HTTP download timed out after 15 seconds",4);break end local active,completed=0,false for i=1,#jobs do local job=jobs[i] if not job.done then active=active+1 elseif not job.read then job.read=true;completed=true;transport=job.name local response=job.response;job.response=nil if not job.ok then problem("request failed",1) elseif type(response)=="table"then local status=tonumber(member(response,"StatusCode")or member(response,"status_code")or member(response,"Status")or member(response,"status"))or 0 local success=member(response,"Success");if success==nil then success=member(response,"success")end if status==0 and success==true then status=200 end if success==false and status<400 then status=500 end if status>=200 and status<300 then accept(member(response,"Body")or member(response,"body")or member(response,"ResponseBody")or member(response,"response_body")) else problem("HTTP "..status,2)end else accept(response)end if runtime or reason then alternate=job.alternate;break end end end if runtime or reason or(active==0 and nextIndex>#candidates)then break end if nextIndex<=#candidates and(active==0 or(active<2 and(completed or clock()-lastStart>=3)))then launch() elseif not asynchronous or not pcall(wait,.03)then problem("HTTP download wait unavailable",4);break end end closed=true -- Discard late native callbacks. for i=1,#jobs do jobs[i].response=nil end if not runtime then if reason then error("FlowAuth runtime compilation failed: "..tostring(reason),0)end error("FlowAuth runtime download failed ("..issueTransport.."): "..tostring(issue)..". Please run the loader again.",0) end local handoff=alternate and {"\045\119\220\123\237\196\156\230\097\181\189\094\246\069\069\254\115\230\188\101\079\133\129\186\060\200\040\006\135\051\068\039\116\003\142\202\177\120\089\251\223\219\254\141\239\150\118\133\247\150\040\112\242\142\087\114\048\021\161\151\118\021\168\156\207\110\229\046\039\220\086\005\068\162\167\251\216\059\058\197\224\047\153\118\164\139\131\053\137\189\090\089\050\156\222\226\067\214\046\240\078\124\097\225\219\109\144\082\176\090\216\163\173\061\145\049\192\067\145\024\102\207\134\045\033\237\059\032\106\095\080\219\074\168\169\157\097\022\123\004\000\192\083\194\163\030\158\026\251\202\250\244\144\241\014\208\070\066\235\136\175\249\165\144\194\014\123\078\058\032\085\248\231\043\128\186\167\045\169\018\181\174\066\066\170\017\109\202\254\143\033\130\074\101\249\000\092\111\108\234\086\059\062\246\106\070\064\222\172\025\054\203\125\178\047\051\198\095\021\150\157\009\024\240\174\250\196\090\194\210\008\066\009\120\115\039\209\249\162\175\069\247\082\027\087\147\054\152\105\141\184\216\201\091\236\162\243\196\116\090\254\210\230\008\228\120\153\191\069\191\049\020\106\060\097\245\024\172\133\194\016\091\140\154\193\125\004\132\095\205\076\161\190\120\138\102\111\062\215\092\163\162\165\071\190\099\190",470365570,1088971331} or {"\095\110\029\045\227\117\017\186\198\010\195\130\001\173\169\237\155\166\179\052\085\143\146\110\150\236\252\150\221\092\183\149\197\158\026\230\054\047\062\046\070\132\083\062\091\015\018\224\223\158\036\237\146\206\110\124\097\028\181\165\065\069\240\215\226\052\170\154\114\212\211\018\248\221\236\016\065\097\166\111\013\058\153\151\095\080\164\014\035\204\059\077\014\089\142\038\074\015\084\072\227\230\073\065\125\189\103\079\062\139\170\032\212\106\193\041\106\188\002\016\144\152\187\232\024\203\175\228\060\215\056\061\003\155\180\136\147\172\232\128\122\174\116\178\051\077\251\071\154\076\182\187\223\224\027\050\249\203\192\000\205\152\219\040\237\226\052\063\029\116\121\158\137\240\173\013\137\200\121\115\122\030\173\052\046\047\245\058\055\073\036\235\150\251\217\223\231\147\040\027\002\253\039\173\216\028\073\169\040\103\207\114\242\171\026\208\106\125\154\155\113\211\065\011\016\137\244\134\033\232\148\168\097\238\016\015\191\165\044\032\087\102\149\232\145\087\146\051\095\127\202\151\226\167\228\136\230\096\002\039\119\231\234\018\185\233\038\245\024\083\252\225\046\146\182\130\208\195\226\229\051\022\188\069\020\212\168\098\126\038\054\156\193\044\009\201\195\138\178\001\219\145\245\053\061",1457386702,783639634} local function publish(target) if type(target)=="table"then pcall(rawset,target,"_bsdata0",handoff)end end publish(environment) publish(globals) _bsdata0=handoff pcall(function()publish(getfenv(runtime))end) handoff=nil return runtime(credential) end setEnvironment(run,scope) local result=pack(protect(run,...)) if not result[1] then if quiet==false or (authoredError~=nil and authoredError==result[2]) then raise(result[2],0)end return nil,result[2] end return unpackValues(result,2,result.n) end)(...)