mirror of
https://github.com/Grocel/3D-Stream-Radio.git
synced 2025-03-04 03:03:07 -05:00
Updated help texts, changed whitelist logic
- Updated help and description texts to reflect the latest changes. Spelling and grammar fixes. - Added info buttons and new options to admin panel - Updated help links in whitelisting errors - CFC Whitelist and built-in whitelist logic are completely separated now - Added ConVar `sv_streamradio_url_whitelist_enable_on_cfcwhitelist`. Built-in whitelist is disabled by default if CFC Whitelist is installed to improve radio usability. Use added ConVar to change this behavior. It's safe to change.
This commit is contained in:
parent
190039d575
commit
7959186671
@ -38,7 +38,10 @@ The 3D Stream Radio is available on the Steam Workshop! Go to [its Workshop page
|
||||
- Duplicator support
|
||||
- Supports local files (inside the ".../garrysmod/sound/" folder)
|
||||
- Clientside performance settings
|
||||
- An API for developers.
|
||||
- Server settings for admins
|
||||
- [Serverside URL Whitelist][]
|
||||
- [CFC Client HTTP Whitelist][] support
|
||||
- An API for developers
|
||||
|
||||
# Credits
|
||||
- Code: Grocel
|
||||
@ -49,7 +52,7 @@ The 3D Stream Radio is available on the Steam Workshop! Go to [its Workshop page
|
||||
|
||||
[Garry's Mod]: <http://garrysmod.com/>
|
||||
[Wiremod]: <https://github.com/wiremod/wire>
|
||||
[GM_BASS3]: <https://gmod.facepunch.com/f/gmodaddon/jina/gm-bass3-A-cross-plattform-shared-Lua-API-to-BASS/1/>
|
||||
[GM_BASS3]: <https://github.com/Grocel/GMod_Modules/tree/master/gm_bass3>
|
||||
[workshop]: <https://steamcommunity.com/sharedfiles/filedetails/?id=246756300>
|
||||
|
||||
[Web Radio]: <https://steamcommunity.com/sharedfiles/filedetails/?id=314470705>
|
||||
@ -61,3 +64,5 @@ The 3D Stream Radio is available on the Steam Workshop! Go to [its Workshop page
|
||||
[ZENITH Trans-Oceanic H500]: <https://steamcommunity.com/sharedfiles/filedetails/?id=1652510511>
|
||||
|
||||
[CPPI]: <http://ulyssesmod.net/archive/CPPI_v1-3.pdf>
|
||||
[Serverside URL Whitelist]: <https://github.com/Grocel/3D-Stream-Radio/wiki/Whitelisting-of-online-content>
|
||||
[CFC Client HTTP Whitelist]: <https://github.com/Grocel/3D-Stream-Radio/wiki/CFC-Client-HTTP-Whitelist-integration>
|
||||
|
@ -61,6 +61,7 @@ function ENT:Initialize( )
|
||||
self:SetCLVolume(1)
|
||||
|
||||
self:AddWireInput("Stream URL", "STRING")
|
||||
|
||||
self:AddWireInput("Play", "NORMAL")
|
||||
self:AddWireInput("Pause", "NORMAL")
|
||||
self:AddWireInput("Mute", "NORMAL")
|
||||
@ -289,7 +290,7 @@ function ENT:WiremodThink()
|
||||
LIBUtil.EmptyTableSafe(self._spectrum)
|
||||
|
||||
if hasadvoutputs then
|
||||
self._spectrum[1] = "Standby mode: Connect to this Output to aktivate it."
|
||||
self._spectrum[1] = "Standby mode: Connect to this Output to activate it."
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -120,7 +120,7 @@ local function addCfcErrorCodes()
|
||||
id = CFCHTTP.BASS_ERROR_BLOCKED_URI,
|
||||
name = "STREAM_ERROR_CFCHTTP_BLOCKED_URI",
|
||||
description = "[CFC HTTP Whitelist] URI has been blocked",
|
||||
helpurl = "https://github.com/CFC-Servers/cfc_cl_http_whitelist",
|
||||
helpurl = "https://steamcommunity.com/workshop/filedetails/discussion/246756300/3884977551668766829/",
|
||||
helptext = [[
|
||||
On this server you are protected by CFC HTTP Whitelist.
|
||||
|
||||
@ -140,7 +140,7 @@ Keep in mind that there probably is a reason why it has not been whitelisted on
|
||||
id = CFCHTTP.BASS_ERROR_BLOCKED_CONTENT,
|
||||
name = "STREAM_ERROR_CFCHTTP_BLOCKED_CONTENT",
|
||||
description = "[CFC HTTP Whitelist] Content has been blocked",
|
||||
helpurl = "https://github.com/CFC-Servers/cfc_cl_http_whitelist",
|
||||
helpurl = "https://steamcommunity.com/workshop/filedetails/discussion/246756300/3884977551668766829/",
|
||||
helptext = [[
|
||||
On this server you are protected by CFC HTTP Whitelist.
|
||||
|
||||
@ -157,45 +157,12 @@ Keep in mind that there probably is a reason why it has not been whitelisted on
|
||||
end
|
||||
end
|
||||
|
||||
local function addCfcHttpWhitelist()
|
||||
StreamRadioLib.Whitelist.AddCheckFunction("cfcHttpWhitelist", function(url)
|
||||
if not LIB.CanCheckWhitelist() then
|
||||
return nil
|
||||
end
|
||||
|
||||
if StreamRadioLib.Url.IsCustomProtocolURL(url) then
|
||||
-- This addon has custom protocols such as "dropbox://" or "shoutcast://"
|
||||
-- Those will be converted to normal URLs and checked by CFC later, so we can safely skip them here.
|
||||
return nil
|
||||
end
|
||||
|
||||
if not LIB.IsAllowedSync(url, false) then
|
||||
return nil
|
||||
end
|
||||
|
||||
--[[
|
||||
If the URL is allowed by the CFC HTTP Whitelist, we also give it a pass.
|
||||
Effectively we extend our playlist based whitelist by the CFC one.
|
||||
Hopefully this makes radios a little bit more user friendly on protected servers.
|
||||
|
||||
Note: This addon does not affect the CFC HTTP protection. CFC HTTP still checks all requests of this and other addons!
|
||||
So if an URL passes THIS test, it doesn't mean it will be passed by CFC HTTP altogether.
|
||||
]]
|
||||
|
||||
return true
|
||||
end)
|
||||
end
|
||||
|
||||
function LIB.Load()
|
||||
if not LIB.IsInstalled() then
|
||||
return
|
||||
end
|
||||
|
||||
addCfcErrorCodes()
|
||||
|
||||
if CLIENT then
|
||||
addCfcHttpWhitelist()
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
|
@ -97,7 +97,7 @@ function LIB.GetLinkButton(text, urlStr)
|
||||
return button
|
||||
end
|
||||
|
||||
function LIB.GetAdminButton(label)
|
||||
function LIB.GetAdminButton(label, ignoreVR)
|
||||
local button = vgui.Create("DButton")
|
||||
|
||||
local function handleAdmin(this)
|
||||
@ -110,6 +110,10 @@ function LIB.GetAdminButton(label)
|
||||
end
|
||||
|
||||
local function handleVR(this)
|
||||
if not ignoreVR then
|
||||
return false, false
|
||||
end
|
||||
|
||||
local lastIsVR = this._isVR
|
||||
|
||||
local isVR = StreamRadioLib.VR.IsActive()
|
||||
@ -212,7 +216,7 @@ function LIB.GetWhitelistEnabledLabel(text)
|
||||
local function handleWhitelistEnabled(this)
|
||||
local lastisUrlWhitelistEnabled = this._isUrlWhitelistEnabled
|
||||
|
||||
local isUrlWhitelistEnabled = StreamRadioLib.IsUrlWhitelistEnabled()
|
||||
local isUrlWhitelistEnabled = StreamRadioLib.IsUrlWhitelistEnabled() or StreamRadioLib.Cfchttp.CanCheckWhitelist()
|
||||
this._isUrlWhitelistEnabled = isUrlWhitelistEnabled
|
||||
|
||||
return lastisUrlWhitelistEnabled == isUrlWhitelistEnabled, isUrlWhitelistEnabled
|
||||
@ -310,6 +314,16 @@ function LIB.GetFAQButton()
|
||||
return button
|
||||
end
|
||||
|
||||
function LIB.GetWhitelistFAQButton()
|
||||
local button = LIB.GetLinkButton("Show Whitelist Info (Workshop)", "https://steamcommunity.com/workshop/filedetails/discussion/246756300/3884977551668761564/")
|
||||
return button
|
||||
end
|
||||
|
||||
function LIB.GetCFCWhitelistFAQButton()
|
||||
local button = LIB.GetLinkButton("Show CFC HTTP Whitelist Info (Workshop)", "https://steamcommunity.com/workshop/filedetails/discussion/246756300/3884977551668766829/")
|
||||
return button
|
||||
end
|
||||
|
||||
function LIB.GetVRFAQButton()
|
||||
local button = LIB.GetLinkButton("Show VR FAQ (Workshop)", "https://steamcommunity.com/workshop/filedetails/discussion/246756300/2247805152838837222/")
|
||||
return button
|
||||
@ -352,6 +366,12 @@ function LIB.GetOpenToolButton()
|
||||
|
||||
button.DoClick = function(this)
|
||||
spawnmenu.ActivateTool("streamradio", false)
|
||||
|
||||
local parent = this:GetParent()
|
||||
if IsValid(parent) then
|
||||
parent:InvalidateLayout()
|
||||
StreamRadioLib.VR.RenderMenu(parent)
|
||||
end
|
||||
end
|
||||
|
||||
button:SetTooltip(maintext)
|
||||
@ -367,6 +387,12 @@ function LIB.GetOpenSettingsButton()
|
||||
|
||||
button.DoClick = function(this)
|
||||
spawnmenu.ActivateTool("StreamRadioSettingsPanel_general", true)
|
||||
|
||||
local parent = this:GetParent()
|
||||
if IsValid(parent) then
|
||||
parent:InvalidateLayout()
|
||||
StreamRadioLib.VR.RenderMenu(parent)
|
||||
end
|
||||
end
|
||||
|
||||
button:SetTooltip(maintext)
|
||||
@ -376,10 +402,16 @@ function LIB.GetOpenSettingsButton()
|
||||
end
|
||||
|
||||
function LIB.GetOpenAdminSettingsButton()
|
||||
local button = LIB.GetAdminButton("Admin Settings")
|
||||
local button = LIB.GetAdminButton("Admin Settings", true)
|
||||
|
||||
button.DoClick = function(this)
|
||||
spawnmenu.ActivateTool("StreamRadioSettingsPanel_admin", true)
|
||||
|
||||
local parent = this:GetParent()
|
||||
if IsValid(parent) then
|
||||
parent:InvalidateLayout()
|
||||
StreamRadioLib.VR.RenderMenu(parent)
|
||||
end
|
||||
end
|
||||
|
||||
return button
|
||||
|
@ -720,7 +720,7 @@ local function createpresets( ply, cmd, args )
|
||||
file.Write( "presets_test/streamradio_gui_color_global.txt", Data )
|
||||
end
|
||||
|
||||
concommand.Add( "streamradio_convertpresets", createpresets ) -- ]]
|
||||
concommand.Add( "debug_streamradio_convertpresets", createpresets ) -- ]]
|
||||
|
||||
return true
|
||||
|
||||
|
@ -105,6 +105,8 @@ local function AddSecurityMenuPanel(CPanel)
|
||||
|
||||
subpanel:AddItem(LIBMenu.GetWarnLabel("CAUTION: This affects the server security of this addon.\nOnly disable the whitelist if you know what you are doing!\nBetter you never turn this off!"))
|
||||
|
||||
subpanel:AddItem(LIBMenu.GetSpacerLine())
|
||||
|
||||
local urlWhitelistCombobox, urlWhitelistLabel = subpanel:ComboBox(
|
||||
"URL Whitelist",
|
||||
"sv_streamradio_url_whitelist_enable"
|
||||
@ -116,7 +118,25 @@ local function AddSecurityMenuPanel(CPanel)
|
||||
urlWhitelistCombobox:AddChoice("Disable Stream URL whitelist (dangerous)", 0, false, "icon16/exclamation.png")
|
||||
|
||||
subpanel:AddItem(LIBMenu.GetLabel("The whitelist is based of the installed playlists. Edit them to change the whitelist or use the quick whitelist options on a radio entity."))
|
||||
subpanel:AddItem(LIBMenu.GetLabel("You can safely turn this off if your server is protected by the CFC HTTP Whitelist addon. It is always disabled on single player."))
|
||||
subpanel:AddItem(LIBMenu.GetLabel("It is always disabled on single player."))
|
||||
|
||||
subpanel:AddItem(LIBMenu.GetSpacer())
|
||||
|
||||
subpanel:AddItem(LIBMenu.GetWhitelistFAQButton())
|
||||
|
||||
subpanel:AddItem(LIBMenu.GetSpacerLine())
|
||||
|
||||
subpanel:AddItem(LIBMenu.GetLabel("If the server has the addon 'CFC Client HTTP Whitelist' installed, the built-in whitelist is disabled automatically for better useability."))
|
||||
subpanel:AddItem(LIBMenu.GetLabel("If the box is checked, the built-in whitelist will be always active. Both options are safe to use."))
|
||||
|
||||
subpanel:CheckBox(
|
||||
"Enable the build-in whitelist even if CFC Whitelist is installed",
|
||||
"sv_streamradio_url_whitelist_enable_on_cfcwhitelist"
|
||||
)
|
||||
|
||||
subpanel:AddItem(LIBMenu.GetSpacer())
|
||||
|
||||
subpanel:AddItem(LIBMenu.GetCFCWhitelistFAQButton())
|
||||
|
||||
subpanel:AddItem(LIBMenu.GetSpacerLine())
|
||||
|
||||
|
@ -13,7 +13,7 @@ local g_rendertarget = true
|
||||
local g_rendertarget_fps = 10
|
||||
local g_3dsound = true
|
||||
local g_key = 0
|
||||
local g_vehiclekey = 0
|
||||
local g_key_vehicle = 0
|
||||
local g_volume = 1
|
||||
local g_coveredvolume = 0
|
||||
|
||||
@ -109,7 +109,7 @@ LIB.AddConVar("general", "key", "cl_streamradio_key", KEY_E, {
|
||||
type = "numpad",
|
||||
})
|
||||
|
||||
LIB.AddConVar("general", "vehiclekey", "cl_streamradio_vehiclekey", MOUSE_LEFT, {
|
||||
LIB.AddConVar("general", "key_vehicle", "cl_streamradio_key_vehicle", MOUSE_LEFT, {
|
||||
label = "Radio control/use key while in vehicles",
|
||||
help = "",
|
||||
type = "numpad",
|
||||
@ -146,7 +146,7 @@ LIB.AddConVar("general", "no3dsound", "cl_streamradio_no3dsound", "0", {
|
||||
|
||||
LIB.AddConVar("general", "bass3_enable", "cl_streamradio_bass3_enable", "1", {
|
||||
label = "Use GM_BASS3 if installed",
|
||||
help = "When set to 1, it uses GM_BASS3 if installed and allowed on the server. Default: 1",
|
||||
help = "When set to 1, it uses GM_BASS3 if installed on client and allowed on the server. Default: 1",
|
||||
type = "bool",
|
||||
})
|
||||
|
||||
@ -234,7 +234,7 @@ function StreamRadioLib.GetControlKey()
|
||||
end
|
||||
|
||||
function StreamRadioLib.GetControlKeyVehicle()
|
||||
return g_vehiclekey
|
||||
return g_key_vehicle
|
||||
end
|
||||
|
||||
function StreamRadioLib.GetGlobalVolume()
|
||||
@ -286,7 +286,7 @@ StreamRadioLib.Hook.Add("Think", "SettingsUpdate", function()
|
||||
end
|
||||
|
||||
g_key = LIB.GetConVarValue("key")
|
||||
g_vehiclekey = LIB.GetConVarValue("vehiclekey")
|
||||
g_key_vehicle = LIB.GetConVarValue("key_vehicle")
|
||||
g_volume = LIB.GetConVarValue("volume")
|
||||
g_coveredvolume = LIB.GetConVarValue("coveredvolume")
|
||||
end)
|
||||
|
@ -2,6 +2,7 @@ local StreamRadioLib = StreamRadioLib
|
||||
|
||||
local g_allowSpectrum = false
|
||||
local g_enableUrlWhitelist = true
|
||||
local g_enableUrlWhitelistOnCFCWhitelist = true
|
||||
|
||||
local g_lastThink = 0
|
||||
|
||||
@ -16,7 +17,14 @@ local g_cvUrlWhitelistEnable = CreateConVar(
|
||||
"sv_streamradio_url_whitelist_enable",
|
||||
"1",
|
||||
bit.bor( FCVAR_NOTIFY, FCVAR_ARCHIVE, FCVAR_GAMEDLL, FCVAR_REPLICATED ),
|
||||
"Disables or enables the Stream URL whitelist. When enabled only URLs listed in playlists can be played. DATA SECURITY: Keep it enabled for better server security. 1 = Enable, 0 = Disable, Default: 0"
|
||||
"Enables the Stream URL whitelist. When enabled only URLs listed in playlists can be played. DATA SECURITY: Keep it enabled for better server security. Only turn it off if you know what you are doing! 0 = Disable, 1 = Enable, Default: 1"
|
||||
)
|
||||
|
||||
local g_cvUrlWhitelistEnableOnCFCWhitelist = CreateConVar(
|
||||
"sv_streamradio_url_whitelist_enable_on_cfcwhitelist",
|
||||
"0",
|
||||
bit.bor( FCVAR_NOTIFY, FCVAR_ARCHIVE, FCVAR_GAMEDLL, FCVAR_REPLICATED ),
|
||||
"Enables built-in Stream URL whitelist even if 'CFC Client HTTP Whitelist' is installed and 'sv_streamradio_url_whitelist_enable' is on. Otherwise built-in whitelist stays inactive as long CFC's one is active. 0 = Disable, 1 = Enable, Default: 0"
|
||||
)
|
||||
|
||||
local g_cvRebuildCommunityPlaylists = CreateConVar(
|
||||
@ -39,7 +47,7 @@ CreateConVar(
|
||||
"sv_streamradio_bass3_enable",
|
||||
"1",
|
||||
bit.bor( FCVAR_NOTIFY, FCVAR_ARCHIVE, FCVAR_GAMEDLL ),
|
||||
"When set to 1, it uses GM_BASS3 on the server if installed. Default: 1",
|
||||
"Use GM_BASS3 on the server if installed and when the ConVar is set to 1. Default: 1",
|
||||
0,
|
||||
1
|
||||
)
|
||||
@ -53,6 +61,11 @@ function StreamRadioLib.IsUrlWhitelistEnabled()
|
||||
return true
|
||||
end
|
||||
|
||||
function StreamRadioLib.IsUrlWhitelistEnabledOnCFCWhitelist()
|
||||
if not g_enableUrlWhitelistOnCFCWhitelist then return false end
|
||||
return true
|
||||
end
|
||||
|
||||
function StreamRadioLib.GetRebuildCommunityPlaylistsMode()
|
||||
local mode = g_cvRebuildCommunityPlaylists:GetInt()
|
||||
|
||||
@ -75,6 +88,23 @@ local function calcUrlWhitelistEnabled()
|
||||
if game.SinglePlayer() then return false end
|
||||
if not g_cvUrlWhitelistEnable:GetBool() then return false end
|
||||
|
||||
if g_enableUrlWhitelistOnCFCWhitelist then
|
||||
-- We always enable the built-in whitelist then
|
||||
return true
|
||||
end
|
||||
|
||||
if StreamRadioLib.Cfchttp.CanCheckWhitelist() then
|
||||
-- CFC Client HTTP whitelist is available, disable our's then.
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local function calcUrlWhitelistEnabledOnCFCWhitelist()
|
||||
if game.SinglePlayer() then return false end
|
||||
if not g_cvUrlWhitelistEnableOnCFCWhitelist:GetBool() then return false end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
@ -91,9 +121,12 @@ StreamRadioLib.Hook.Add("Think", "ConvarsUpdate", function()
|
||||
g_allowSpectrum = calcAllowSpectrum()
|
||||
|
||||
local old_enableUrlWhitelist = g_enableUrlWhitelist
|
||||
local old_enableUrlWhitelistOnCFCWhitelist = g_enableUrlWhitelistOnCFCWhitelist
|
||||
|
||||
g_enableUrlWhitelistOnCFCWhitelist = calcUrlWhitelistEnabledOnCFCWhitelist()
|
||||
g_enableUrlWhitelist = calcUrlWhitelistEnabled()
|
||||
|
||||
if old_enableUrlWhitelist ~= g_enableUrlWhitelist then
|
||||
if old_enableUrlWhitelist ~= g_enableUrlWhitelist or old_enableUrlWhitelistOnCFCWhitelist ~= g_enableUrlWhitelistOnCFCWhitelist then
|
||||
updateUrlWhitelistEnabled()
|
||||
end
|
||||
|
||||
|
@ -655,11 +655,12 @@ LIB.AddStreamErrorCode({
|
||||
id = 1000,
|
||||
name = "STREAM_ERROR_URL_NOT_WHITELISTED",
|
||||
description = "This URL is not whitelisted on this server",
|
||||
helpurl = "https://steamcommunity.com/workshop/filedetails/discussion/246756300/3884977551668761564/",
|
||||
helptext = [[
|
||||
The server does not allow playback of this URL to prevent abuse.
|
||||
You can ask an admin to whitelist this URL by adding it to the playlists.
|
||||
|
||||
CAUTION: Please don't ask to the whitelist disabled. It is there for your own security.
|
||||
CAUTION: Please don't ask to have the whitelist disabled or removed. It is there for your own security.
|
||||
]],
|
||||
})
|
||||
|
||||
@ -678,7 +679,7 @@ LIB.AddStreamErrorCode({
|
||||
})
|
||||
|
||||
LIB.AddStreamErrorCode({
|
||||
id = 1100,
|
||||
id = 1003,
|
||||
name = "STREAM_ERROR_BAD_DRIVE_LETTER_PATH",
|
||||
description = "Drive letter paths are not supported, use relative paths",
|
||||
helptext = [[
|
||||
@ -695,7 +696,7 @@ This is NOT a relative path:
|
||||
})
|
||||
|
||||
LIB.AddStreamErrorCode({
|
||||
id = 1200,
|
||||
id = 1100,
|
||||
name = "PLAYLIST_ERROR_INVALID_FILE",
|
||||
description = "Invalid Playlist",
|
||||
helptext = [[
|
||||
@ -718,7 +719,7 @@ Hint: Use the playlist editor to make playlists.
|
||||
})
|
||||
|
||||
LIB.AddStreamErrorCode({
|
||||
id = 1300,
|
||||
id = 1200,
|
||||
name = "STREAM_SOUND_STOPPED", -- triggered by "stopsound" concommand
|
||||
description = "The sound has been stopped",
|
||||
helpmenu = false,
|
||||
|
@ -37,8 +37,6 @@ local DropboxURLs = {
|
||||
"//dl.dropboxusercontent.com/",
|
||||
}
|
||||
|
||||
StreamRadioLib.Url.AddCustomProtocol("dropbox")
|
||||
|
||||
function RADIOIFACE:CheckURL(url)
|
||||
for i, v in ipairs(DropboxURLs) do
|
||||
local result = string.find(string.lower(url), v, 1, true)
|
||||
|
@ -18,8 +18,6 @@ local LIBUrl = StreamRadioLib.Url
|
||||
local LIBString = StreamRadioLib.String
|
||||
local LIBError = StreamRadioLib.Error
|
||||
|
||||
LIBUrl.AddCustomProtocol("file")
|
||||
|
||||
function RADIOIFACE:CheckURL(url)
|
||||
if not LIBUrl.IsOfflineURL(url) then
|
||||
return false
|
||||
|
@ -37,8 +37,6 @@ local ShoutcastURLs = {
|
||||
"shoutcast://",
|
||||
}
|
||||
|
||||
StreamRadioLib.Url.AddCustomProtocol("shoutcast")
|
||||
|
||||
function RADIOIFACE:CheckURL(url)
|
||||
for i, v in ipairs(ShoutcastURLs) do
|
||||
local result = string.find(string.lower(url), v, 1, true)
|
||||
|
@ -41,9 +41,6 @@ local YoutubeURLs = {
|
||||
"://youtu.be",
|
||||
}
|
||||
|
||||
StreamRadioLib.Url.AddCustomProtocol("youtube")
|
||||
StreamRadioLib.Url.AddCustomProtocol("yt")
|
||||
|
||||
function RADIOIFACE:CheckURL(url)
|
||||
for i, v in ipairs(YoutubeURLs) do
|
||||
local result = string.find(string.lower(url), v, 1, true)
|
||||
|
@ -12,7 +12,6 @@ local LIBString = StreamRadioLib.String
|
||||
local g_sanitizeOnlineUrlCache = LIBUtil.CreateCacheArray(2048)
|
||||
local g_sanitizeOfflineUrlCache = LIBUtil.CreateCacheArray(2048)
|
||||
local g_isOfflineURLCache = LIBUtil.CreateCacheArray(2048)
|
||||
local g_isCustomProtocolURLCache = LIBUtil.CreateCacheArray(2048)
|
||||
|
||||
local g_customProtocols = {}
|
||||
|
||||
@ -88,45 +87,6 @@ function LIB.SplittProtocolAndPath(url)
|
||||
return SplittProtocolAndPath(url)
|
||||
end
|
||||
|
||||
function LIB.AddCustomProtocol(protocol)
|
||||
protocol = tostring(protocol or "")
|
||||
protocol = string.Trim(protocol)
|
||||
|
||||
if protocol == "" then
|
||||
return
|
||||
end
|
||||
|
||||
protocol = string.lower(protocol)
|
||||
|
||||
g_customProtocols[protocol] = protocol
|
||||
end
|
||||
|
||||
function LIB.IsCustomProtocolURL(url)
|
||||
url = tostring(url or "")
|
||||
|
||||
if url == "" then
|
||||
return false
|
||||
end
|
||||
|
||||
if g_isCustomProtocolURLCache:Has(url) then
|
||||
return g_isCustomProtocolURLCache:Get(url)
|
||||
end
|
||||
|
||||
local protocol = GetProtocol(url)
|
||||
g_isCustomProtocolURLCache:Set(url, false)
|
||||
|
||||
if protocol == "" then
|
||||
return false
|
||||
end
|
||||
|
||||
if not g_customProtocols[protocol] then
|
||||
return false
|
||||
end
|
||||
|
||||
g_isCustomProtocolURLCache:Set(url, true)
|
||||
return true
|
||||
end
|
||||
|
||||
function LIB.IsOfflineURL(url)
|
||||
url = tostring(url or "")
|
||||
|
||||
@ -346,7 +306,6 @@ function LIB.Load()
|
||||
g_sanitizeOnlineUrlCache:Empty()
|
||||
g_sanitizeOfflineUrlCache:Empty()
|
||||
g_isOfflineURLCache:Empty()
|
||||
g_isCustomProtocolURLCache:Empty()
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -85,7 +85,7 @@ if StreamRadioLib and StreamRadioLib.Loaded then
|
||||
StreamRadioLib.Tool.AddLocale(TOOL, "mute_volume_info", "NOTE: These are entity options too. So they only affect the radio they are applied on. The global settings for your client are at 'General Settings'.")
|
||||
StreamRadioLib.Tool.AddLocale(TOOL, "mute_volume_info.desc", "NOTE: These are entity options too. So they only affect the radio they are applied on. The global settings for your client are at 'General Settings'.")
|
||||
|
||||
StreamRadioLib.Tool.AddLocale(TOOL, "streamurl_whitelist_info", "Only whitelisted Stream URLs will work on this server!")
|
||||
StreamRadioLib.Tool.AddLocale(TOOL, "streamurl_whitelist_info", "Whitelist protected server: Only approved Stream URLs will work on this server!")
|
||||
|
||||
StreamRadioLib.Tool.Setup(TOOL)
|
||||
else
|
||||
@ -156,6 +156,8 @@ function TOOL:BuildToolPanel(CPanel)
|
||||
|
||||
self:AddLabel( CPanel, "mute_volume_info", true )
|
||||
|
||||
CPanel:AddPanel(StreamRadioLib.Menu.GetSpacer())
|
||||
|
||||
self:AddCheckbox( CPanel, "mute", false )
|
||||
|
||||
local VolumeNumSlider = self:AddNumSlider( CPanel, "volume", false )
|
||||
|
@ -1,2 +1,2 @@
|
||||
434
|
||||
1698342618
|
||||
435
|
||||
1698622804
|
||||
|
Loading…
Reference in New Issue
Block a user