iteration

This commit is contained in:
Layla 2023-10-08 02:36:02 -04:00
parent 1f180d0627
commit 22743c248c
2 changed files with 15 additions and 0 deletions

View File

@ -79,6 +79,7 @@ if action == "login" then
end
settings.set("auth.token", token)
settings.save()
io.write("Logged in as " .. username .. "\n")
return
end

View File

@ -26,6 +26,13 @@ settings.define("lns_server.auth_server", {
})
auth_server = settings.get("lns_server.auth_server")
settings.define("lns_server.log_level", {
description = "Log Level",
type = "string",
default = "info"
})
log_level = settings.get("lns_server.log_level")
rednet.host("lns", settings.get("lns_server.rednet_hostname"))
rednet.open(modem_location)
@ -36,6 +43,12 @@ function log(str)
io.write("[" .. os.time() .. "] " .. str .. "\n")
end
function log_debug(str)
if log_level == "debug" then
log(str)
end
end
function save_data()
db = fs.open("lns.db", "w")
db.write(textutils.serialize(data))
@ -103,6 +116,7 @@ while true do
})
local auth_response = rednet.receive()
log_debug("Auth response: " .. auth_response)
local errorPos, errorEnd = string.find(auth_response, "invalid")
if errorPos then
log("Error: " .. auth_response)