mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-16 04: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"))
|
local oldConfig = util.JSONToTable(file.Read("gm_integration/config.json", "DATA"))
|
||||||
if (!oldConfig.version || (oldConfig.version < gmInte.version)) then
|
if (!oldConfig.version || (oldConfig.version < gmInte.version)) then
|
||||||
if (oldConfig.version && (oldConfig.version < "0.1.2")) then
|
print(" | Merging Config | gmod_integration/sv_config.lua")
|
||||||
gmInte.config.id = oldConfig.id
|
table.Merge(gmInte.config, oldConfig)
|
||||||
gmInte.config.token = oldConfig.token
|
|
||||||
else
|
|
||||||
print(" | Merging Config | gmod_integration/sv_config.lua")
|
|
||||||
table.Merge(gmInte.config, oldConfig)
|
|
||||||
end
|
|
||||||
gmInte.config.version = gmInte.version
|
gmInte.config.version = gmInte.version
|
||||||
file.Write("gm_integration/config.json", util.TableToJSON(gmInte.config, true))
|
file.Write("gm_integration/config.json", util.TableToJSON(gmInte.config, true))
|
||||||
else
|
else
|
||||||
|
|
|
@ -15,7 +15,6 @@ for k, v in pairs(websocketFeature) do
|
||||||
end
|
end
|
||||||
|
|
||||||
if (!useWebsocket) then
|
if (!useWebsocket) then
|
||||||
gmInte.config.websocket = false
|
|
||||||
return gmInte.log("WebSocket is not used")
|
return gmInte.log("WebSocket is not used")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -27,10 +26,7 @@ if (!GWSockets) then
|
||||||
gmInte.logError("GWSockets is not installed! Please install it from https://github.com/FredyH/GWSockets/releases")
|
gmInte.logError("GWSockets is not installed! Please install it from https://github.com/FredyH/GWSockets/releases")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
gmInte.config.websocket = false
|
|
||||||
return
|
return
|
||||||
else
|
|
||||||
gmInte.config.websocket = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local socket = GWSockets.createWebSocket("wss://ws.gmod-integration.com")
|
local socket = GWSockets.createWebSocket("wss://ws.gmod-integration.com")
|
||||||
|
|
|
@ -256,6 +256,7 @@ end
|
||||||
function gmInte.superadminGetConfig(ply)
|
function gmInte.superadminGetConfig(ply)
|
||||||
if (!gmInte.plyValid(ply) || !ply:IsSuperAdmin()) then return end
|
if (!gmInte.plyValid(ply) || !ply:IsSuperAdmin()) then return end
|
||||||
|
|
||||||
|
gmInte.config.websocket = GWSockets && true || false
|
||||||
gmInte.SendNet(2, gmInte.config, ply)
|
gmInte.SendNet(2, gmInte.config, ply)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user