Merge config changes and update WebSocket usage

This commit is contained in:
Linventif 2024-01-15 05:51:06 +01:00
parent d1b3876574
commit 32e3310f65
3 changed files with 3 additions and 11 deletions

View File

@ -27,13 +27,8 @@ local function loadConfig()
local oldConfig = util.JSONToTable(file.Read("gm_integration/config.json", "DATA"))
if (!oldConfig.version || (oldConfig.version < gmInte.version)) then
if (oldConfig.version && (oldConfig.version < "0.1.2")) then
gmInte.config.id = oldConfig.id
gmInte.config.token = oldConfig.token
else
print(" | Merging Config | gmod_integration/sv_config.lua")
table.Merge(gmInte.config, oldConfig)
end
print(" | Merging Config | gmod_integration/sv_config.lua")
table.Merge(gmInte.config, oldConfig)
gmInte.config.version = gmInte.version
file.Write("gm_integration/config.json", util.TableToJSON(gmInte.config, true))
else

View File

@ -15,7 +15,6 @@ for k, v in pairs(websocketFeature) do
end
if (!useWebsocket) then
gmInte.config.websocket = false
return gmInte.log("WebSocket is not used")
end
@ -27,10 +26,7 @@ if (!GWSockets) then
gmInte.logError("GWSockets is not installed! Please install it from https://github.com/FredyH/GWSockets/releases")
end
end)
gmInte.config.websocket = false
return
else
gmInte.config.websocket = true
end
local socket = GWSockets.createWebSocket("wss://ws.gmod-integration.com")

View File

@ -256,6 +256,7 @@ end
function gmInte.superadminGetConfig(ply)
if (!gmInte.plyValid(ply) || !ply:IsSuperAdmin()) then return end
gmInte.config.websocket = GWSockets && true || false
gmInte.SendNet(2, gmInte.config, ply)
end