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:
parent
0d0bfccb92
commit
d083ee70dd
@ -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
|
@ -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)
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user