added global property to disable auth

This commit is contained in:
bvn13 2024-12-29 23:21:44 +03:00
parent f9fb013ae0
commit 39ff8ece65

View File

@ -65,6 +65,7 @@ mineysocket.log("action", os.getenv("IPV4"))
-- configuration -- configuration
mineysocket.host_ip = minetest.settings:get("mineysocket.host_ip") mineysocket.host_ip = minetest.settings:get("mineysocket.host_ip")
mineysocket.host_port = minetest.settings:get("mineysocket.host_port") mineysocket.host_port = minetest.settings:get("mineysocket.host_port")
mineysocket.auth = minetest.settings:get("mineysocket.auth")
-- Workaround for bug, where default values return only nil -- Workaround for bug, where default values return only nil
if not mineysocket.host_ip then if not mineysocket.host_ip then
@ -73,6 +74,9 @@ end
if not mineysocket.host_port then if not mineysocket.host_port then
mineysocket.host_port = 29999 mineysocket.host_port = 29999
end end
if not mineysocket.auth then
mineysocket.auth = true
end
mineysocket.debug = false -- set to true to show all log levels mineysocket.debug = false -- set to true to show all log levels
mineysocket.max_clients = 10 mineysocket.max_clients = 10
@ -149,7 +153,7 @@ mineysocket.receive = function()
mineysocket["socket_clients"][clientid].buffer = "" mineysocket["socket_clients"][clientid].buffer = ""
mineysocket["socket_clients"][clientid].eom = nil mineysocket["socket_clients"][clientid].eom = nil
if ip == "127.0.0.1" then -- skip authentication for 127.0.0.1 if not mineysocket.auth or ip == "127.0.0.1" then -- skip authentication for 127.0.0.1
mineysocket["socket_clients"][clientid].auth = true mineysocket["socket_clients"][clientid].auth = true
mineysocket["socket_clients"][clientid].playername = "localhost" mineysocket["socket_clients"][clientid].playername = "localhost"
mineysocket["socket_clients"][clientid].events = {} mineysocket["socket_clients"][clientid].events = {}