[TikiWiki-commits] [Git][tikiwiki/tiki][master] [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <69cfa99258c8d_3b19058c5041d@gitlab-sidekiq-low-urgency-cpu-bound-v2-6b67458b4c-t5wmg.mail> |
Victor Emanouilov pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
616e91b6 by Jean-Marc Kadimba at 2026-04-03T11:42:54+00:00
[NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
---
* [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
* [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
* [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
* [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
* Fix pipeline
* Fix pipeline
* [NEW] External Feeds: Add support for proxy configuration specifically for RSS feeds.
See merge request tikiwiki/tiki!9901
- - - - -
6 changed files:
- + lib/prefs/rssproxy.php
- lib/prefs/use.php
- lib/rss/rsslib.php
- lib/setup/prefs.php
- lib/tikilib.php
- templates/admin/include_general.tpl
Changes:
=====================================
lib/prefs/rssproxy.php
=====================================
@@ -0,0 +1,47 @@
+<?php
+
+// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
+//
+// All Rights Reserved. See copyright.txt for details and a complete list of authors.
+// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
+function prefs_rssproxy_list()
+{
+ return [
+ 'rssproxy_host' => [
+ 'name' => tra('Proxy host name'),
+ 'description' => tra('Proxy host - without http:// or similar, just the host name'),
+ 'type' => 'text',
+ 'size' => '20',
+ 'filter' => 'url',
+ 'dependencies' => [
+ 'use_rss_proxy',
+ ],
+ 'default' => '',
+ ],
+ 'rssproxy_port' => [
+ 'name' => tra('Port'),
+ 'description' => tra('Proxy port'),
+ 'type' => 'text',
+ 'filter' => 'digits',
+ 'size' => '5',
+ 'dependencies' => [
+ 'use_rss_proxy',
+ ],
+ 'default' => '',
+ ],
+ 'rssproxy_user' => [
+ 'name' => tra('Proxy username'),
+ 'type' => 'text',
+ 'size' => 10,
+ 'filter' => 'none',
+ 'default' => '',
+ ],
+ 'rssproxy_pass' => [
+ 'name' => tra('Proxy password'),
+ 'type' => 'text',
+ 'size' => 10,
+ 'filter' => 'none',
+ 'default' => '',
+ ],
+ ];
+}
=====================================
lib/prefs/use.php
=====================================
@@ -22,6 +22,13 @@ function prefs_use_list()
'perspective' => false,
'default' => 'n',
],
+ 'use_rss_proxy' => [
+ 'name' => tra('Use RSS proxy'),
+ 'description' => tra('Specify if external feeds requires a proxy to access the internet. If enabled, the proxy Host name (either with or without the http:// prefix), Port settings, Username, and Password can be specified.'),
+ 'type' => 'flag',
+ 'perspective' => false,
+ 'default' => 'n',
+ ],
// FIXME: These 2 have misleading names. Actions will use context menus even if (only) one is disabled. Do we really need to have 2 preferences for this? Surely if we have context menus they should have both icons and text. Chealer 2017-07-03
'use_context_menu_icon' => [
=====================================
lib/rss/rsslib.php
=====================================
@@ -1072,9 +1072,14 @@ class RSSLib extends TikiDb_Bridge
private function fetchFeed(string $url)
{
- global $tikilib;
+ global $tikilib, $prefs;
try {
- $content = $tikilib->httprequest($url);
+ if (isset($prefs['use_rss_proxy']) && $prefs['use_rss_proxy'] == 'y') {
+ $content = $tikilib->httprequest($url, useRssProxy: true);
+ } else {
+ $content = $tikilib->httprequest($url);
+ }
+
if ($content) {
return Laminas\Feed\Reader\Reader::importString($content);
}
=====================================
lib/setup/prefs.php
=====================================
@@ -200,6 +200,7 @@ function get_default_prefs()
'shoutbox_autolink' => 'n',
'show_comzone' => 'n',
'use_proxy' => 'n',
+ 'use_rss_proxy' => 'n',
'webserverauth' => 'n',
'feature_intertiki_imported_groups' => '',
=====================================
lib/tikilib.php
=====================================
@@ -228,7 +228,7 @@ class TikiLib extends TikiDb_Bridge
* @param array $options
* @return mixed|Laminas\Http\Client
*/
- public function get_http_client($url = false, $options = null, $user = null)
+ public function get_http_client($url = false, $options = null, $user = null, $useRssProxy = false)
{
global $prefs;
@@ -251,6 +251,17 @@ class TikiLib extends TikiDb_Bridge
$config['adapter'] = 'Laminas\Http\Client\Adapter\Curl';
}
+ if ($useRssProxy) {
+ $config['adapter'] = 'Laminas\Http\Client\Adapter\Proxy';
+ $config["proxy_host"] = $prefs['rssproxy_host'];
+ $config["proxy_port"] = $prefs['rssproxy_port'];
+
+ if ($prefs['rssproxy_user'] || $prefs['rssproxy_pass']) {
+ $config["proxy_user"] = $prefs['rssproxy_user'];
+ $config["proxy_pass"] = $prefs['rssproxy_pass'];
+ }
+ }
+
if (($prefs['http_sslverifypeer'] ?? 'n') === 'y') {
$config['sslverifypeer'] = true;
} else {
@@ -498,7 +509,7 @@ class TikiLib extends TikiDb_Bridge
* @param string $reqmethod
* @return bool
*/
- public function httprequest($url, $reqmethod = "GET")
+ public function httprequest($url, $reqmethod = "GET", $useRssProxy = false)
{
// test url :
// rewrite url if sloppy # added a case for https urls
@@ -510,7 +521,7 @@ class TikiLib extends TikiDb_Bridge
}
try {
- $client = $this->get_http_client($url);
+ $client = $this->get_http_client($url, useRssProxy: $useRssProxy);
/* @var $response Laminas\Http\Response */
$response = $this->http_perform_request($client);
=====================================
templates/admin/include_general.tpl
=====================================
@@ -234,6 +234,13 @@
{preference name=proxy_user}
{preference name=proxy_pass}
</div>
+ {preference name=use_rss_proxy}
+ <div class="adminoptionboxchild" id="use_rss_proxy_childcontainer">
+ {preference name=rssproxy_host}
+ {preference name=rssproxy_port}
+ {preference name=rssproxy_user}
+ {preference name=rssproxy_pass}
+ </div>
{preference name=http_skip_frameset}
{preference name=feature_loadbalancer}
{preference name=feature_port_rewriting}
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/616e91b6c090bc838f23cfee9f87ae28beeb8e33
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/616e91b6c090bc838f23cfee9f87ae28beeb8e33
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs