0
0
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:
peteruithoven 2013-10-03 18:07:58 +02:00
parent 0d0bfccb92
commit d083ee70dd
3 changed files with 14 additions and 5 deletions

View File

@ -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

View File

@ -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)

View File

@ -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