mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-11-05 14:13:22 +01:00
30 lines
814 B
Lua
30 lines
814 B
Lua
local log = require('util.logger')
|
|
local utils = require('util.utils')
|
|
local uci = require('uci').cursor()
|
|
local iwinfo = require('iwinfo')
|
|
local settings = require('util.settings')
|
|
local wifi = require("network.wlanconfig")
|
|
|
|
local M = {}
|
|
|
|
--- Signin to connect.doodle3d.com server
|
|
--
|
|
function M.signin()
|
|
local baseurl = "http://connect.doodle3d.com/api/signin.php"
|
|
|
|
local localip = wifi.getLocalIP();
|
|
if localip == nil then
|
|
log:error("signin failed no local ip found")
|
|
return false
|
|
end
|
|
|
|
local wifiboxid = wifi.getSubstitutedSsid(settings.get('network.cl.wifiboxid'))
|
|
|
|
local cmd = "wget -q -T 2 -t 1 -O - "..baseurl.."?wifiboxid="..wifiboxid.."\\&localip="..localip;
|
|
local output = utils.captureCommandOutput(cmd);
|
|
log:info("signin: "..output)
|
|
|
|
return string.len(output) > 0, output
|
|
end
|
|
|
|
return M |