mirror of
https://github.com/CFC-Servers/cfc_cl_http_whitelist.git
synced 2025-03-04 03:03:18 -05:00
fix error when server has no client config (#51)
This commit is contained in:
parent
abf9c40af5
commit
3a2b30e4e0
@ -14,11 +14,12 @@ end
|
||||
|
||||
net.Receive( "CFCHTTP_ConfigUpdate", function()
|
||||
local l = net.ReadDouble()
|
||||
local config = util.JSONToTable( util.Decompress( net.ReadData( l ) ) )
|
||||
CFCHTTP.networkedConfig = config
|
||||
|
||||
loadConfigsClient()
|
||||
CFCHTTP.repopulateListPanel()
|
||||
if l > 0 then
|
||||
local config = util.JSONToTable( util.Decompress( net.ReadData( l ) ) )
|
||||
CFCHTTP.networkedConfig = config
|
||||
loadConfigsClient()
|
||||
CFCHTTP.repopulateListPanel()
|
||||
end
|
||||
end )
|
||||
|
||||
loadConfigsClient()
|
||||
|
@ -2,6 +2,12 @@ util.AddNetworkString( "CFCHTTP_ConfigUpdate" )
|
||||
util.AddNetworkString( "CFCHTTP_RequestConfig" )
|
||||
|
||||
local function sendClientConfig( ply )
|
||||
if not CFCHTTP.networkedClientConfig then
|
||||
net.Start( "CFCHTTP_ConfigUpdate" )
|
||||
net.WriteDouble( 0 )
|
||||
net.Send( ply )
|
||||
end
|
||||
|
||||
local data = util.Compress( util.TableToJSON( CFCHTTP.networkedClientConfig ) )
|
||||
net.Start( "CFCHTTP_ConfigUpdate" )
|
||||
net.WriteDouble( #data )
|
||||
@ -21,7 +27,7 @@ local function loadConfigsServer()
|
||||
} )
|
||||
|
||||
local data = file.Read( CFCHTTP.filenames.serverClientJsonConfig, "DATA" )
|
||||
CFCHTTP.networkedClientConfig = data and util.JSONToTable( data ) or {}
|
||||
CFCHTTP.networkedClientConfig = data and util.JSONToTable( data )
|
||||
end
|
||||
|
||||
local function addCSLuaConfigs( dir )
|
||||
|
Loading…
Reference in New Issue
Block a user