ENV to change UA sent to outbound calls (Genius, Last.fm, LRCLIB)
This commit is contained in:
1 parent
9993e9927f
commit
6180d2f638
3 files changed
+11
-2
No files matched your search
@@ -217,3 +217,8 @@ MATOMO_SITE_ID=""
|
||||
TIMEZONE="UTC"
|
||||
DEBUG=false
|
||||
SHOW_ERRORS=false
|
||||
|
||||
# User-Agent sent with every outbound request this server makes (Genius,
|
||||
# Last.fm, LRCLIB, custom now-playing feeds). Override this per deployment if
|
||||
# you run more than one station and want each to identify itself distinctly.
|
||||
OUTBOUND_USER_AGENT="radio/2026.07 (+https://git.dou.bet/iamdoubz/radio)"
|
||||
+2
-2
@@ -51,7 +51,7 @@ function http_get($url, $timeout = 5, $headers = []) {
|
||||
CURLOPT_TIMEOUT => (int) $timeout,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_MAXREDIRS => 3,
|
||||
CURLOPT_USERAGENT => 'radio-site/1.0 (+https://github.com)',
|
||||
CURLOPT_USERAGENT => cfg('runtime.user_agent'),
|
||||
]);
|
||||
if (!empty($headers)) {
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
@@ -67,7 +67,7 @@ function http_get($url, $timeout = 5, $headers = []) {
|
||||
$ctx = stream_context_create([
|
||||
'http' => [
|
||||
'timeout' => (int) $timeout,
|
||||
'header' => implode("\r\n", $headers),
|
||||
'header' => implode("\r\n", array_merge(['User-Agent: ' . cfg('runtime.user_agent')], $headers)),
|
||||
'ignore_errors' => true,
|
||||
],
|
||||
'ssl' => ['verify_peer' => true, 'verify_peer_name' => true],
|
||||
|
||||
@@ -257,6 +257,10 @@ if (!defined('RADIO_CONFIG_LOADED')) {
|
||||
'timezone' => radio_env('TIMEZONE', 'UTC'),
|
||||
'debug' => radio_env_bool('DEBUG', false),
|
||||
'show_errors' => radio_env_bool('SHOW_ERRORS', false),
|
||||
// Sent with every outbound request this server makes (Genius,
|
||||
// Last.fm, LRCLIB, custom now-playing feeds). Override per
|
||||
// deployment so multiple stations identify themselves distinctly.
|
||||
'user_agent' => radio_env('OUTBOUND_USER_AGENT', 'radio/2026.07 (+https://git.dou.bet/iamdoubz/radio)'),
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
Reference in new issue
Block a user