mirror of
https://github.com/CFC-Servers/cfc_cl_http_whitelist.git
synced 2025-03-04 03:03:18 -05:00
remove unused file
This commit is contained in:
parent
31781f9ffb
commit
75dbfb1c7e
@ -17,5 +17,6 @@ include( "cfc_http_restrictions/config_loader.lua" )
|
||||
includeShared( "cfc_http_restrictions/shared/filetypes.lua" )
|
||||
includeShared( "cfc_http_restrictions/config_loader.lua" )
|
||||
includeShared( "cfc_http_restrictions/shared/list_manager.lua" )
|
||||
includeShared( "cfc_http_restrictions/shared/url.lua" )
|
||||
includeClient( "cfc_http_restrictions/client/list_view.lua" )
|
||||
includeClient( "cfc_http_restrictions/client/wrap_functions.lua" )
|
||||
|
@ -1,69 +0,0 @@
|
||||
CFCHTTP.version = "1.0.0"
|
||||
|
||||
local messages = {}
|
||||
hook.Add( "PlayerInitialSpawn", "myAddonName/Load", function( ply )
|
||||
if ply:IsSuperAdmin() then
|
||||
timer.Simple( 30, function()
|
||||
for _, msg in ipairs( messages ) do
|
||||
ply:ChatPrint( msg )
|
||||
end
|
||||
end )
|
||||
end
|
||||
end )
|
||||
|
||||
local function notify( msg )
|
||||
table.insert( messages, msg )
|
||||
end
|
||||
|
||||
---@param v string
|
||||
---@param v2 string
|
||||
---@return boolean
|
||||
--- returns true if v is newer than v2
|
||||
local function isVersionNewer( v, v2 )
|
||||
local splitNewVersion = string.Split( v, "." )
|
||||
local newMajor, newMinor, newPatch = tonumber( splitNewVersion[1] ), tonumber( splitNewVersion[2] ), tonumber( splitNewVersion[3] )
|
||||
local splitOldVersion = string.Split( v2, "." )
|
||||
local oldMajor, oldMinor, oldPatch = tonumber( splitOldVersion[1] ), tonumber( splitOldVersion[2] ), tonumber( splitOldVersion[3] )
|
||||
|
||||
if newMajor ~= oldMajor then
|
||||
return newMajor > oldMajor
|
||||
end
|
||||
|
||||
if newMinor ~= oldMinor then
|
||||
return newMinor > oldMinor
|
||||
end
|
||||
|
||||
if newPatch ~= oldPatch then
|
||||
return newPatch > oldPatch
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
hook.Add( "Think", "CFCHTTP_UpdateCheck", function()
|
||||
hook.Remove( "Think", "CFCHTTP_UpdateCheck" )
|
||||
|
||||
local http = _HTTP or HTTP
|
||||
http {
|
||||
url = "https://raw.githubusercontent.com/CFC-Servers/cfc_cl_http_whitelist/main/update.json",
|
||||
method = "GET",
|
||||
success = function( code, body, headers )
|
||||
local data = util.JSONToTable( body )
|
||||
if not data then return end
|
||||
if not data.version then
|
||||
return
|
||||
end
|
||||
if data.version == CFCHTTP.version then
|
||||
return
|
||||
end
|
||||
if not isVersionNewer( data.minimumVersion, CFCHTTP.version ) then
|
||||
return
|
||||
end
|
||||
notify( "\n" )
|
||||
notify( "Your version of CFC HTTP Whitelist is bellow the minimum safe version." )
|
||||
notify( "Please update to the latest version." )
|
||||
notify( "\n" )
|
||||
end
|
||||
|
||||
}
|
||||
end )
|
Loading…
Reference in New Issue
Block a user