mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 21:17:34 +00:00
Merge config changes and update WebSocket usage
This commit is contained in:
parent
d1b3876574
commit
32e3310f65
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user