Hi group!
I'm trying to use HTML to have an editable table in LogicMachine, the goal in this project is to give the user the possibility to edit a list of users. I have a script were I put my HTML page. My bdd is in a .json script, and in my HTML code I have two funtion, x_get.lua and x_save.lua. In my x_get.lua i have the next script:
In my x_save.lua
The firmware version of my homeLYnk is:
HW: LM5 Lite (i.MX6)
The problem is that when i try to get into my get.lua, the response is a text, not the list of user that i have in my .json script.
In my version of LM I don't get acces to the /user/ file or the /ww/ file, I ask ChatGPT and it said that I have to create my scripts in those files, because when I try to get into the next url: IP-Server:port/x_get.lua, the response is a text and when I try to get into IP-Server:port/x_save.lua the response is 404 Not Found.
I try to update some packages in the LM, from an new version of homeLYNk, but the packages are:
url.lua
ftp.lua
http.lua
and the packages that are supported are .ipk.
I cannot upgrade the firmaware of the LM, because I don't want to lose the connection with the phisical machines that I have in the project.
Can someone help me with this issue please? Will appriciated!
I'm trying to use HTML to have an editable table in LogicMachine, the goal in this project is to give the user the possibility to edit a list of users. I have a script were I put my HTML page. My bdd is in a .json script, and in my HTML code I have two funtion, x_get.lua and x_save.lua. In my x_get.lua i have the next script:
Code:
content("application/json")
local f = io.open('user/inquilinos.json', 'r')
if not f then
print("[]")
return
end
local data = f:read("*a")
f:close()
print(data) In my x_save.lua
Code:
content("application/json")
-- Leer cuerpo del POST
local len = tonumber(os.getenv("CONTENT_LENGTH") or 0)
local body = ""
if len > 0 then
body = io.read(len)
end
if not body or #body == 0 then
print('{"status":"error","msg":"POST vacío"}')
return
end
-- Intentar escribir el archivo JSON
local f, err = io.open("/www/user/inquilinos.json", "w")
if not f then
print('{"status":"error","msg":"No se pudo abrir el archivo: '..tostring(err)..'"}')
return
end
f:write(body)
f:close()
print('{"status":"ok"}')The firmware version of my homeLYnk is:
HW: LM5 Lite (i.MX6)
The problem is that when i try to get into my get.lua, the response is a text, not the list of user that i have in my .json script.
In my version of LM I don't get acces to the /user/ file or the /ww/ file, I ask ChatGPT and it said that I have to create my scripts in those files, because when I try to get into the next url: IP-Server:port/x_get.lua, the response is a text and when I try to get into IP-Server:port/x_save.lua the response is 404 Not Found.
I try to update some packages in the LM, from an new version of homeLYNk, but the packages are:
url.lua
ftp.lua
http.lua
and the packages that are supported are .ipk.
I cannot upgrade the firmaware of the LM, because I don't want to lose the connection with the phisical machines that I have in the project.
Can someone help me with this issue please? Will appriciated!