11local StreamRadioLib = StreamRadioLib
22
33local g_allowSpectrum = false
4- local g_enableUrlRequestLog = false
4+ local g_streamUrlLogMode = 1
55local g_enableUrlWhitelist = true
66local g_enableUrlWhitelistOnCFCWhitelist = true
77local g_enableUrlWhitelistTrustAdminRadios = true
@@ -15,11 +15,11 @@ local g_cvMaxServerSpectrum = CreateConVar(
1515 " Sets the maximum count of radios that can have advanced wire outputs such as FFT spectrum or song tags. 0 = Off, Default: 5"
1616)
1717
18- local g_cvUrlRequestLogEnable = CreateConVar (
19- " sv_streamradio_url_request_log_enable " ,
18+ local g_cvStreamUrlLogMode = CreateConVar (
19+ " sv_streamradio_url_log_mode " ,
2020 " 1" ,
2121 bit .bor ( FCVAR_NOTIFY , FCVAR_ARCHIVE , FCVAR_GAMEDLL , FCVAR_REPLICATED ),
22- " Log requested stream URLs to console. Always logs on developer > 0. 0 = Disable, 1 = Enable , Default: 1"
22+ " Log stream URLs to console. Always logs all URLs on developer > 0. 0 = Disable, 1 = Online URLs only, 2 = All URLs , Default: 1"
2323)
2424
2525local g_cvUrlWhitelistEnable = CreateConVar (
@@ -72,29 +72,24 @@ function StreamRadioLib.AllowSpectrum()
7272 return g_allowSpectrum
7373end
7474
75- function StreamRadioLib .IsUrlRequestLogEnabled ()
76- if not g_enableUrlRequestLog then return false end
77- return true
78- end
79-
8075function StreamRadioLib .IsUrlWhitelistEnabled ()
81- if not g_enableUrlWhitelist then return false end
82- return true
76+ return g_enableUrlWhitelist
8377end
8478
8579function StreamRadioLib .IsUrlWhitelistEnabledOnCFCWhitelist ()
86- if not g_enableUrlWhitelistOnCFCWhitelist then return false end
87- return true
80+ return g_enableUrlWhitelistOnCFCWhitelist
8881end
8982
9083function StreamRadioLib .IsUrlWhitelistAdminRadioTrusted ()
91- if not g_enableUrlWhitelistTrustAdminRadios then return false end
92- return true
84+ return g_enableUrlWhitelistTrustAdminRadios
85+ end
86+
87+ function StreamRadioLib .GetStreamLogMode ()
88+ return g_streamUrlLogMode
9389end
9490
9591function StreamRadioLib .GetRebuildCommunityPlaylistsMode ()
9692 local mode = g_cvRebuildCommunityPlaylists :GetInt ()
97-
9893 mode = math .Clamp (mode , 0 , 2 )
9994
10095 return mode
@@ -110,11 +105,15 @@ local function calcAllowSpectrum()
110105 return StreamRadioLib .GetStreamingRadioCount () < max
111106end
112107
113- local function calcEnableUrlRequestLog ()
114- if StreamRadioLib .Util .IsDebug () then return true end
115- if not g_cvUrlRequestLogEnable :GetBool () then return false end
108+ local function calcStreamUrlLogMode ()
109+ if StreamRadioLib .Util .IsDebug () then
110+ return StreamRadioLib .LOG_STREAM_URL_ALL
111+ end
116112
117- return true
113+ local mode = g_cvStreamUrlLogMode :GetInt ()
114+ mode = math .Clamp (mode , 0 , 2 )
115+
116+ return mode
118117end
119118
120119local function calcUrlWhitelistEnabled ()
@@ -159,7 +158,7 @@ StreamRadioLib.Hook.Add("Think", "ConvarsUpdate", function()
159158
160159 if g_lastThink < now then
161160 g_allowSpectrum = calcAllowSpectrum ()
162- g_enableUrlRequestLog = calcEnableUrlRequestLog ()
161+ g_streamUrlLogMode = calcStreamUrlLogMode ()
163162
164163 local old_enableUrlWhitelist = g_enableUrlWhitelist
165164 local old_enableUrlWhitelistOnCFCWhitelist = g_enableUrlWhitelistOnCFCWhitelist
0 commit comments