1
0
mirror of https://github.com/lxsang/antd-lua-plugin synced 2024-12-29 02:38:22 +01:00
antd-lua-plugin/example-app/os/system/settings.lua
2018-09-19 15:08:49 +02:00

20 lines
440 B
Lua

auth_or_die("User unauthorized. Please login")
local user = SESSION.iotos_user
if user then
local ospath = require('fs.vfs').ospath("home:///",user)
if REQUEST.query and REQUEST.query.json then
local f = io.open(ospath.."/"..".settings.json", "w")
if f then
f:write(REQUEST.query.json)
f:close()
result(true)
else
fail("Cannot save setting")
end
else
fail("No setting founds")
end
else
fail("User not found")
end