mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-25 00:35:40 -04:00
Add an option to set a custom user agent to retrieve individual feeds (#3494)
* Add an option to set a custom user agent to retrieve individual feeds This allows retrieving the original RSS feed when websites use services like FeedBurner. * Use !== instead of != in subscriptionController.php * Add proxy and user-agent to subscription/add Co-authored-by: Georgelemental <georgelemental@gmail.com> Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
This commit is contained in:
@@ -96,7 +96,7 @@ class FreshRSS_subscription_Controller extends Minz_ActionController {
|
||||
$pass = trim(Minz_Request::param('http_pass_feed' . $id, ''));
|
||||
|
||||
$httpAuth = '';
|
||||
if ($user != '' && $pass != '') { //TODO: Sanitize
|
||||
if ($user !== '' && $pass !== '') { //TODO: Sanitize
|
||||
$httpAuth = $user . ':' . $pass;
|
||||
}
|
||||
|
||||
@@ -113,16 +113,20 @@ class FreshRSS_subscription_Controller extends Minz_ActionController {
|
||||
$feed->_attributes('clear_cache', Minz_Request::paramTernary('clear_cache'));
|
||||
|
||||
$cookie = Minz_Request::param('curl_params_cookie', '');
|
||||
$useragent = Minz_Request::param('curl_params_useragent', '');
|
||||
$proxy_address = Minz_Request::param('curl_params', '');
|
||||
$proxy_type = Minz_Request::param('proxy_type', '');
|
||||
$opts = [];
|
||||
if ($proxy_address != '' && $proxy_type != '' && in_array($proxy_type, [0, 2, 4, 5, 6, 7])) {
|
||||
if ($proxy_address !== '' && $proxy_type !== '' && in_array($proxy_type, [0, 2, 4, 5, 6, 7])) {
|
||||
$opts[CURLOPT_PROXY] = $proxy_address;
|
||||
$opts[CURLOPT_PROXYTYPE] = intval($proxy_type);
|
||||
}
|
||||
if ($cookie != '') {
|
||||
if ($cookie !== '') {
|
||||
$opts[CURLOPT_COOKIE] = $cookie;
|
||||
}
|
||||
if ($useragent !== '') {
|
||||
$opts[CURLOPT_USERAGENT] = $useragent;
|
||||
}
|
||||
$feed->_attributes('curl_params', empty($opts) ? null : $opts);
|
||||
|
||||
$feed->_attributes('content_action', Minz_Request::param('content_action', 'replace'));
|
||||
|
||||
Reference in New Issue
Block a user