0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2025-01-03 08:13:49 +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 --- Signin to connect.doodle3d.com server
-- --
function M.signin() function M.signin()
local baseurl = "http://connect.doodle3d.com/signin.php" local baseurl = "http://connect.doodle3d.com/api/signin.php"
local localip = wifi.getLocalIP(); local localip = wifi.getLocalIP();
if localip == nil then if localip == nil then
@ -24,7 +24,7 @@ function M.signin()
local output = utils.captureCommandOutput(cmd); local output = utils.captureCommandOutput(cmd);
log:info("signin: "..output) log:info("signin: "..output)
return string.len(output) > 0 return string.len(output) > 0, output
end end
return M return M

View File

@ -29,8 +29,11 @@ function M._global_POST(request, response)
end end
log:info("API:Network:try signing in") log:info("API:Network:try signing in")
signin.signin(); if signin.signin() then
log:info("API:Network:signed in") log:info("API:Network:signin successfull")
else
log:info("API:Network:signin failed")
end
end end
function M.all_GET(request, response) function M.all_GET(request, response)

View File

@ -178,13 +178,19 @@ end
function M.signin(request, response) function M.signin(request, response)
log:info("API:Network:signin") log:info("API:Network:signin")
if signin.signin() then local success, output = signin.signin()
if success then
log:info("API:Network:signed in") log:info("API:Network:signed in")
response:setSuccess("API:Network:signed in") response:setSuccess("API:Network:signed in")
response:addData("response", output)
else else
log:info("API:Network:Signing in failed") log:info("API:Network:Signing in failed")
response:setError("Signing in failed") response:setError("Signing in failed")
end end
end end
function M.alive(request, response)
response:setSuccess("alive")
end
return M return M