mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:27:34 +00:00
fix: version + config
This commit is contained in:
parent
96fa9f1190
commit
843b1ddfcf
|
@ -45,5 +45,5 @@ function gmInte.applyPaint(element, id)
|
|||
end
|
||||
|
||||
function gmInte.getFrameName(name)
|
||||
return "Gmod Integration v" .. gmInte.config.version .. " - " .. name
|
||||
return "Gmod Integration v" .. (gmInte.version || "0.0.0") .. " - " .. name
|
||||
end
|
|
@ -355,6 +355,9 @@ end
|
|||
function gmInte.openConfigMenu(data)
|
||||
local needRestart = false
|
||||
|
||||
if (gmInte.openAdminPanel) then return end
|
||||
gmInte.openAdminPanel = true
|
||||
|
||||
local frame = vgui.Create("DFrame")
|
||||
frame:SetSize(400, (600 / 1080) * ScrH())
|
||||
frame:Center()
|
||||
|
@ -507,6 +510,7 @@ function gmInte.openConfigMenu(data)
|
|||
end
|
||||
|
||||
frame.OnClose = function()
|
||||
gmInte.openAdminPanel = false
|
||||
if (needRestart) then gmInte.needRestart() end
|
||||
end
|
||||
end
|
||||
|
@ -515,5 +519,5 @@ end
|
|||
// Concommands
|
||||
//
|
||||
|
||||
concommand.Add("gmod_integration_admin", gmInte.openAdminConfig)
|
||||
concommand.Add("gmi_admin", gmInte.openAdminConfig)
|
||||
concommand.Add("gmod_integration_admin", function() gmInte.SendNet("getConfig") end)
|
||||
concommand.Add("gmi_admin", function() gmInte.SendNet("getConfig") end)
|
|
@ -36,6 +36,7 @@ local netReceive = {
|
|||
end,
|
||||
[5] = function(data)
|
||||
gmInte.config = table.Merge(gmInte.config, data.config)
|
||||
gmInte.version = data.other.version
|
||||
if (!data.other.aprovedCredentials) then RunConsoleCommand("gmod_integration_admin") end
|
||||
end,
|
||||
[6] = function(data)
|
||||
|
|
|
@ -15,10 +15,10 @@ function gmInte.saveSetting(setting, value)
|
|||
file.Write("gm_integration/config.json", util.TableToJSON(gmInte.config, true))
|
||||
gmInte.log("Setting Saved")
|
||||
|
||||
// send to all players if it's a public setting
|
||||
// send to all players the new public config
|
||||
for _, ply in pairs(player.GetAll()) do
|
||||
if (ply:IsValid() && ply:IsPlayer(ply)) then
|
||||
gmInte.log("Sending new Public Config to " .. ply:Nick())
|
||||
gmInte.log("Sending new Public Config to " .. ply:Nick(), true)
|
||||
gmInte.publicGetConfig(ply)
|
||||
end
|
||||
end
|
||||
|
@ -69,10 +69,10 @@ function gmInte.publicGetConfig(ply)
|
|||
["debug"] = gmInte.config.debug,
|
||||
["apiFQDN"] = gmInte.config.apiFQDN,
|
||||
["websocketFQDN"] = gmInte.config.websocketFQDN,
|
||||
["version"] = gmInte.config.version,
|
||||
},
|
||||
["other"] = {
|
||||
["aprovedCredentials"] = gmInte.aprovedCredentials,
|
||||
["version"] = gmInte.version,
|
||||
}
|
||||
}, ply)
|
||||
end
|
||||
|
|
|
@ -33,7 +33,7 @@ function gmInte.http.requestAPI(params)
|
|||
local method = params.method || "GET"
|
||||
local success = params.success || function() end
|
||||
local failed = params.failed || function() end
|
||||
local version = gmInte.config.version || "Unknown"
|
||||
local version = gmInte.version || "Unknown"
|
||||
local showableBody = showableBody(params.endpoint)
|
||||
local localRequestID = util.CRC(tostring(SysTime()))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user