mirror of
https://github.com/CFC-Servers/cfc_cl_http_whitelist.git
synced 2025-03-04 03:03:18 -05:00
Add workflow and fix style (#16)
* Add workflow * Style, remove shadow bindings * Style, shadow bindings * Style * Style
This commit is contained in:
parent
b01f62a8fc
commit
f96cc1c991
10
.github/workflows/glua_lint.yml
vendored
Normal file
10
.github/workflows/glua_lint.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
name: GLuaFixer
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
Lint:
|
||||
uses: CFC-Servers/github_action_workflows/.github/workflows/lint_glua.yml@feature/shareable
|
||||
with:
|
||||
config: "https://cfc.gg/configs/gluafixer/glualint.json"
|
@ -7,7 +7,7 @@ function CFCHTTP.getAddress( url )
|
||||
if cached then return cached end
|
||||
|
||||
local pattern = "(%a+)://([%a%d%.-]+):?(%d*)/?.*"
|
||||
local _, _, protocol, addr, port = string.find( url, pattern )
|
||||
local _, _, _, addr, _ = string.find( url, pattern )
|
||||
parsedAddressCache[url] = addr
|
||||
|
||||
return addr
|
||||
@ -45,13 +45,13 @@ function CFCHTTP.getOptionsForURI(url)
|
||||
return options
|
||||
end
|
||||
|
||||
for allowedAddr, options in pairs( CFCHTTP.config.addresses ) do
|
||||
if not options.pattern then
|
||||
for allowedAddr, optionsAddr in pairs( CFCHTTP.config.addresses ) do
|
||||
if not optionsAddr.pattern then
|
||||
allowedAddr = escapeAddr( allowedAddr )
|
||||
end
|
||||
|
||||
if string.match( address, "^" .. allowedAddr .. "$" ) then
|
||||
return options
|
||||
return optionsAddr
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ local function populatePanel( form )
|
||||
|
||||
local textEntry, _ = form:TextEntry( "Address" )
|
||||
|
||||
list.OnRowSelected = function( self, index, pnl )
|
||||
list.OnRowSelected = function( _, _, pnl )
|
||||
textEntry:SetValue( pnl:GetColumnText( 1 ) )
|
||||
end
|
||||
|
||||
|
@ -157,7 +157,6 @@ local function wrapHTMLPanel( panelName )
|
||||
|
||||
_G[openURL]( self, url, ... )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
hook.Add( "Initialize", "CFC_HttpWhitelist_WrapHTML", function()
|
||||
|
@ -16,9 +16,9 @@ end
|
||||
-- LoadLuaConfigs loads the default config and then any lua files in the cfc_http_restrictions/configs directory
|
||||
function CFCHTTP.loadLuaConfigs()
|
||||
local files = file.Find( "cfc_http_restrictions/configs/*.lua", "LUA" )
|
||||
for _, file in pairs(files) do
|
||||
AddCSLuaFile("cfc_http_restrictions/configs/" .. file)
|
||||
local newConfig = include("cfc_http_restrictions/configs/" .. file)
|
||||
for _, fil in pairs( files ) do
|
||||
AddCSLuaFile( "cfc_http_restrictions/configs/" .. fil )
|
||||
local newConfig = include( "cfc_http_restrictions/configs/" .. fil )
|
||||
CFCHTTP.config = CFCHTTP.mergeConfigs( CFCHTTP.config, newConfig )
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user