diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/config.php | 9 | ||||
-rw-r--r-- | classes/urlhelper.php | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/classes/config.php b/classes/config.php index 4ae4a2407..be4ecde36 100644 --- a/classes/config.php +++ b/classes/config.php @@ -170,6 +170,9 @@ class Config { const AUTH_MIN_INTERVAL = "AUTH_MIN_INTERVAL"; // minimum amount of seconds required between authentication attempts + const HTTP_USER_AGENT = "HTTP_USER_AGENT"; + // http user agent (changing this is not recommended) + // default values for all of the above: private const _DEFAULTS = [ Config::DB_TYPE => [ "pgsql", Config::T_STRING ], @@ -224,6 +227,8 @@ class Config { Config::CHECK_FOR_PLUGIN_UPDATES => [ "true", Config::T_BOOL ], Config::ENABLE_PLUGIN_INSTALLER => [ "true", Config::T_BOOL ], Config::AUTH_MIN_INTERVAL => [ 5, Config::T_INT ], + Config::HTTP_USER_AGENT => [ 'Tiny Tiny RSS/%s (https://tt-rss.org/)', + Config::T_STRING ], ]; private static $instance; @@ -632,4 +637,8 @@ class Config { return $rv; } + + static function get_user_agent() { + return sprintf(self::get(self::HTTP_USER_AGENT), self::get_version()); + } } diff --git a/classes/urlhelper.php b/classes/urlhelper.php index 710b32b00..0e4834b72 100644 --- a/classes/urlhelper.php +++ b/classes/urlhelper.php @@ -281,8 +281,7 @@ class UrlHelper { curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); - curl_setopt($ch, CURLOPT_USERAGENT, $useragent ? $useragent : - SELF_USER_AGENT); + curl_setopt($ch, CURLOPT_USERAGENT, $useragent ? $useragent : Config::get_user_agent()); curl_setopt($ch, CURLOPT_ENCODING, ""); if ($http_referrer) |