-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathtest.lua
More file actions
26 lines (24 loc) Β· 1.01 KB
/
test.lua
File metadata and controls
26 lines (24 loc) Β· 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-- Test your connection to Eclipse Hub servers. Note: This is NOT the loadstring.
print("π Starting test...")
local start = os.clock();
getgenv().mainKey = "nil";
xpcall(function()
local a,b,c,d,e=loadstring,request or http_request or (http and http.request) or (syn and syn.request),assert,tostring,"https\58//api.eclipsehub.xyz/auth";
if not a or not b then
return warn("β Test failed due to compatability issue:", a, b)
end
local f = b({Url=e.."?\107e\121\61"..d(mainKey),Headers={["User-Agent"]="Eclipse"}});
print("Response:", f.Success, f.StatusCode);
if not f.Body:find("startup") then
setclipboard(f.Body);
return warn("β Test failed due to invalid body:", f.Body);
end
local g, h = pcall(a, f.Body);
if not g then
return warn("β Test failed due to syntax error:", h);
end
print("β
Test passed.", h)
end, function(err)
warn("β Test failed due to error:", err);
end)
print(("π Ending test, took %.2f"):format(os.clock() - start));