mirror of
https://github.com/CFC-Servers/cfc_cl_http_whitelist.git
synced 2025-03-04 03:03:18 -05:00
hotfix save button for config
This commit is contained in:
parent
13e6c8ef80
commit
4733bf1de8
@ -8,7 +8,7 @@ local function removeByValue( listView, value )
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function populatePanel( form )
|
local function populatePanel( form )
|
||||||
local warning = vgui.Create( "DLabel" )
|
local warning = vgui.Create( "DLabel" )
|
||||||
warning:SetText( "Adding a domain here could expose your ip to other players (and other vulnerabilities)" )
|
warning:SetText( "Adding a domain here could expose your ip to other players (and other vulnerabilities)" )
|
||||||
warning:SetColor( Color( 255, 0, 0 ) )
|
warning:SetColor( Color( 255, 0, 0 ) )
|
||||||
warning:SetFont( "GModToolHelp" )
|
warning:SetFont( "GModToolHelp" )
|
||||||
@ -30,7 +30,7 @@ local function populatePanel( form )
|
|||||||
form:AddItem( list )
|
form:AddItem( list )
|
||||||
|
|
||||||
for k, v in pairs( CFCHTTP.config.addresses ) do
|
for k, v in pairs( CFCHTTP.config.addresses ) do
|
||||||
list:AddLine( k, ( v and v.allowed ) and "yes" or "no" )
|
list:AddLine( k, (v and v.allowed) and "yes" or "no" )
|
||||||
end
|
end
|
||||||
|
|
||||||
local textEntry, _ = form:TextEntry( "Address" )
|
local textEntry, _ = form:TextEntry( "Address" )
|
||||||
@ -67,13 +67,13 @@ local function populatePanel( form )
|
|||||||
|
|
||||||
local save = form:Button( "Save" )
|
local save = form:Button( "Save" )
|
||||||
save.DoClick = function()
|
save.DoClick = function()
|
||||||
local conf = CFCHTTP.copyConfig( CFCHTTP.config )
|
local conf = CFCHTTP.CopyConfig( CFCHTTP.config )
|
||||||
for addr, options in pairs( conf.addresses ) do
|
for addr, options in pairs( conf.addresses ) do
|
||||||
if not options._edited then
|
if not options._edited then
|
||||||
conf.addresses[addr] = nil
|
conf.addresses[addr] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
CFCHTTP.saveFileConfig( {
|
CFCHTTP.SaveFileConfig( {
|
||||||
version = "1",
|
version = "1",
|
||||||
addresses = conf.addresses
|
addresses = conf.addresses
|
||||||
} )
|
} )
|
||||||
|
Loading…
Reference in New Issue
Block a user