From 338a58e08de7f77ad9063e26d825b11c1224df78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Gr=C3=BCttemeier?= Date: Sat, 9 May 2020 21:39:13 +0200 Subject: [PATCH] Bugfix #22 - Fixed bug #22 - Fixed a bug that caused the MySQL password to be deleted after opening the MSync GUI again --- lua/msync/client_gui/cl_admin_gui.lua | 9 ++++++--- lua/msync/client_gui/cl_modules.lua | 13 +++++++------ lua/msync/server/sv_init.lua | 2 +- lua/msync/server/sv_net.lua | 3 +-- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lua/msync/client_gui/cl_admin_gui.lua b/lua/msync/client_gui/cl_admin_gui.lua index 30315d7..ef16f88 100644 --- a/lua/msync/client_gui/cl_admin_gui.lua +++ b/lua/msync/client_gui/cl_admin_gui.lua @@ -226,9 +226,12 @@ function MSync.AdminPanel.InitModuleSettings( sheet ) for k, v in pairs(files) do local info = include("msync/client_gui/modules/"..v) - MSync.modules[info.ModuleIdentifier]["init"]() - MSync.modules[info.ModuleIdentifier]["net"]() - pnl:AddSheet( info.Name, MSync.modules[info.ModuleIdentifier].adminPanel(pnl)) + + if MSync.moduleState[info["ModuleIdentifier"]] then + MSync.modules[info.ModuleIdentifier]["init"]() + MSync.modules[info.ModuleIdentifier]["net"]() + pnl:AddSheet( info.Name, MSync.modules[info.ModuleIdentifier].adminPanel(pnl)) + end end return pnl diff --git a/lua/msync/client_gui/cl_modules.lua b/lua/msync/client_gui/cl_modules.lua index 3773399..81ee7a4 100644 --- a/lua/msync/client_gui/cl_modules.lua +++ b/lua/msync/client_gui/cl_modules.lua @@ -22,12 +22,13 @@ end function MSync.initModules() for k,v in pairs(MSync.modules) do - if not MSync.moduleState[v["info"]["ModuleIdentifier"]] then return end; - v["init"]() - v["net"]() - v["ulx"]() - v["hooks"]() - print("["..v["info"]["Name"].."] Module loaded") + if MSync.moduleState[v["info"]["ModuleIdentifier"]] then + v["init"]() + v["net"]() + v["ulx"]() + v["hooks"]() + print("["..v["info"]["Name"].."] Module loaded") + end end end diff --git a/lua/msync/server/sv_init.lua b/lua/msync/server/sv_init.lua index efd12ac..e8cc06b 100644 --- a/lua/msync/server/sv_init.lua +++ b/lua/msync/server/sv_init.lua @@ -100,7 +100,7 @@ end Returns: safe settings table ]] function MSync.func.getSafeSettings() - local settings = MSync.settings.data + local settings = table.Copy(MSync.settings.data) settings.mysql.password = nil return settings diff --git a/lua/msync/server/sv_net.lua b/lua/msync/server/sv_net.lua index 1773ce3..90ee9a0 100644 --- a/lua/msync/server/sv_net.lua +++ b/lua/msync/server/sv_net.lua @@ -103,7 +103,6 @@ end ) util.AddNetworkString("msync.getSettings") net.Receive("msync.getSettings", function(len, ply) if not ply:query("msync.getSettings") then return end - MSync.net.sendTable(ply, "settings", MSync.func.getSafeSettings()) end ) @@ -126,9 +125,9 @@ util.AddNetworkString("msync.toggleModule") net.Receive("msync.toggleModule", function(len, ply) if not ply:query("msync.toggleModule") then return end + local ident = net.ReadString() local state = net.ReadString() - if state == "Enable" then MSync.settings.data.enabledModules[ident] = true elseif state == "Disable" then