mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 11:03:48 +01:00
new server api url, returning signin response, alive api
This commit is contained in:
parent
0d0bfccb92
commit
d083ee70dd
@ -10,7 +10,7 @@ local M = {}
|
||||
--- Signin to connect.doodle3d.com server
|
||||
--
|
||||
function M.signin()
|
||||
local baseurl = "http://connect.doodle3d.com/signin.php"
|
||||
local baseurl = "http://connect.doodle3d.com/api/signin.php"
|
||||
|
||||
local localip = wifi.getLocalIP();
|
||||
if localip == nil then
|
||||
@ -24,7 +24,7 @@ function M.signin()
|
||||
local output = utils.captureCommandOutput(cmd);
|
||||
log:info("signin: "..output)
|
||||
|
||||
return string.len(output) > 0
|
||||
return string.len(output) > 0, output
|
||||
end
|
||||
|
||||
return M
|
@ -29,8 +29,11 @@ function M._global_POST(request, response)
|
||||
end
|
||||
|
||||
log:info("API:Network:try signing in")
|
||||
signin.signin();
|
||||
log:info("API:Network:signed in")
|
||||
if signin.signin() then
|
||||
log:info("API:Network:signin successfull")
|
||||
else
|
||||
log:info("API:Network:signin failed")
|
||||
end
|
||||
end
|
||||
|
||||
function M.all_GET(request, response)
|
||||
|
@ -178,13 +178,19 @@ end
|
||||
|
||||
function M.signin(request, response)
|
||||
log:info("API:Network:signin")
|
||||
if signin.signin() then
|
||||
local success, output = signin.signin()
|
||||
if success then
|
||||
log:info("API:Network:signed in")
|
||||
response:setSuccess("API:Network:signed in")
|
||||
response:addData("response", output)
|
||||
else
|
||||
log:info("API:Network:Signing in failed")
|
||||
response:setError("Signing in failed")
|
||||
end
|
||||
end
|
||||
|
||||
function M.alive(request, response)
|
||||
response:setSuccess("alive")
|
||||
end
|
||||
|
||||
return M
|
||||
|
Loading…
Reference in New Issue
Block a user