2013-09-27 18:38:31 +02:00
|
|
|
local log = require('util.logger')
|
|
|
|
local utils = require('util.utils')
|
|
|
|
local uci = require('uci').cursor()
|
|
|
|
local iwinfo = require('iwinfo')
|
|
|
|
local settings = require('util.settings')
|
2013-09-30 18:08:02 +02:00
|
|
|
local wifi = require("network.wlanconfig")
|
2013-09-27 18:38:31 +02:00
|
|
|
|
|
|
|
local M = {}
|
|
|
|
|
|
|
|
--- Signin to connect.doodle3d.com server
|
|
|
|
--
|
|
|
|
function M.signin()
|
2013-10-03 18:07:58 +02:00
|
|
|
local baseurl = "http://connect.doodle3d.com/api/signin.php"
|
2013-09-27 18:38:31 +02:00
|
|
|
|
2013-09-30 18:08:02 +02:00
|
|
|
local localip = wifi.getLocalIP();
|
|
|
|
if localip == nil then
|
|
|
|
log:error("signin failed no local ip found")
|
2013-10-02 14:41:15 +02:00
|
|
|
return false
|
2013-09-30 18:08:02 +02:00
|
|
|
end
|
2013-09-27 18:38:31 +02:00
|
|
|
|
2013-09-30 18:08:02 +02:00
|
|
|
local wifiboxid = wifi.getSubstitutedSsid(settings.get('network.cl.wifiboxid'))
|
2013-09-27 18:38:31 +02:00
|
|
|
|
2013-10-16 17:16:01 +02:00
|
|
|
local cmd = "wget -q -T 2 -t 1 -O - "..baseurl.."?wifiboxid="..wifiboxid.."\\&localip="..localip;
|
2013-09-30 18:08:02 +02:00
|
|
|
local output = utils.captureCommandOutput(cmd);
|
2013-09-27 18:38:31 +02:00
|
|
|
log:info("signin: "..output)
|
|
|
|
|
2013-10-03 18:07:58 +02:00
|
|
|
return string.len(output) > 0, output
|
2013-09-27 18:38:31 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|