mirror of
https://github.com/CFC-Servers/cfc_cl_http_whitelist.git
synced 2025-03-04 03:03:18 -05:00
use url encoding instead base64 (#37)
This commit is contained in:
parent
74f9be20b2
commit
be7f5b520b
@ -1,4 +1,4 @@
|
||||
CFCHTTP.FileTypes = CFCHTTP.FIleTypes or {}
|
||||
CFCHTTP.FileTypes = CFCHTTP.FileTypes or {}
|
||||
|
||||
local files, _ = file.Find( "cfc_http_restrictions/shared/filetypes/*.lua", "LUA" )
|
||||
for _, f in pairs( files ) do
|
||||
|
@ -39,7 +39,7 @@ end
|
||||
---@param body string
|
||||
---@return boolean
|
||||
function PLS.IsFileData( body )
|
||||
if string.find( body, "%[playlist%]" ) then return true end
|
||||
if string.find( body, "[playlist]", 1, true ) then return true end
|
||||
return false
|
||||
end
|
||||
|
||||
|
@ -34,10 +34,20 @@ function CFCHTTP.FindURLs( text )
|
||||
return urls
|
||||
end
|
||||
|
||||
---@param url string
|
||||
---@return string
|
||||
function CFCHTTP.URLEncode( url )
|
||||
url = url:gsub( "[^%w ]", function( c )
|
||||
return string.format( "%%%02X", string.byte( c ) )
|
||||
end )
|
||||
return url
|
||||
end
|
||||
|
||||
function CFCHTTP.GetRedirectURL( url )
|
||||
url = string.Replace( url, "\n", "" )
|
||||
url = string.Trim( url )
|
||||
local b64 = util.Base64Encode( url, true )
|
||||
local b64 = CFCHTTP.URLEncode( url )
|
||||
|
||||
return "https://gmhttp.pages.dev/redirect?url=" .. b64
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user