From 628b30208ab8d268ab2fbaae2de7f19443baac27 Mon Sep 17 00:00:00 2001
From: Dag
Date: Sat, 23 Nov 2024 22:28:50 +0100
Subject: fix: dont aquire exclusive locks (#4340)
Due to bugs in logging/error-handling there sometimes are deadlocks
---
lib/logger.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'lib')
diff --git a/lib/logger.php b/lib/logger.php
index 74a0e713..9e5f6ce9 100644
--- a/lib/logger.php
+++ b/lib/logger.php
@@ -136,7 +136,7 @@ final class StreamHandler
$record['message'],
$context
);
- $bytes = file_put_contents($this->stream, $text, FILE_APPEND | LOCK_EX);
+ $bytes = file_put_contents($this->stream, $text, FILE_APPEND);
}
}
--
cgit v1.2.3
From 152e96d3d06b626574ecc79781479d46c7d9867d Mon Sep 17 00:00:00 2001
From: Dag
Date: Mon, 30 Dec 2024 00:19:18 +0100
Subject: fix: broken if_not_modified_since (#4377)
---
lib/contents.php | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
(limited to 'lib')
diff --git a/lib/contents.php b/lib/contents.php
index 56a3db20..752c0ff2 100644
--- a/lib/contents.php
+++ b/lib/contents.php
@@ -24,6 +24,13 @@ function getContents(
// TODO: consider url validation at this point
+ $config = [
+ 'useragent' => Configuration::getConfig('http', 'useragent'),
+ 'timeout' => Configuration::getConfig('http', 'timeout'),
+ 'retries' => Configuration::getConfig('http', 'retries'),
+ 'curl_options' => $curlOptions,
+ ];
+
$httpHeadersNormalized = [];
foreach ($httpHeaders as $httpHeader) {
$parts = explode(':', $httpHeader);
@@ -69,13 +76,7 @@ function getContents(
'TE' => 'trailers',
];
- $config = [
- 'useragent' => Configuration::getConfig('http', 'useragent'),
- 'timeout' => Configuration::getConfig('http', 'timeout'),
- 'retries' => Configuration::getConfig('http', 'retries'),
- 'headers' => array_merge($defaultHttpHeaders, $httpHeadersNormalized),
- 'curl_options' => $curlOptions,
- ];
+ $config['headers'] = array_merge($defaultHttpHeaders, $httpHeadersNormalized);
$maxFileSize = Configuration::getConfig('http', 'max_filesize');
if ($maxFileSize) {
--
cgit v1.2.3
From 7c6d4a932c7ce9678bdf3a5fcedf89a86d82ad44 Mon Sep 17 00:00:00 2001
From: Dag
Date: Fri, 3 Jan 2025 01:58:38 +0100
Subject: fix: upgrade hardcoded version number, fix #4382 (#4384)
---
lib/Configuration.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'lib')
diff --git a/lib/Configuration.php b/lib/Configuration.php
index 187848fb..c0cfe0c2 100644
--- a/lib/Configuration.php
+++ b/lib/Configuration.php
@@ -7,7 +7,7 @@
*/
final class Configuration
{
- private const VERSION = '2024-02-02';
+ private const VERSION = '2025-01-02';
private static $config = [];
--
cgit v1.2.3
From be51ba17df892fde0c371c181425dd636f0f4d37 Mon Sep 17 00:00:00 2001
From: Dag
Date: Fri, 3 Jan 2025 05:40:30 +0100
Subject: fix(url): disallowed wonky path (#4386)
---
bridges/RumbleBridge.php | 4 +---
lib/url.php | 3 +++
tests/UrlTest.php | 6 ++++++
3 files changed, 10 insertions(+), 3 deletions(-)
(limited to 'lib')
diff --git a/bridges/RumbleBridge.php b/bridges/RumbleBridge.php
index 11755b51..c1a565bb 100644
--- a/bridges/RumbleBridge.php
+++ b/bridges/RumbleBridge.php
@@ -74,9 +74,7 @@ class RumbleBridge extends BridgeAbstract
$item['timestamp'] = $publishedAt->getTimestamp();
}
- if (isset($publishedAt) && $publishedAt > new \DateTimeImmutable('2025-01-31')) {
- $href = ltrim($href, '/');
- }
+ $href = ltrim($href, '/');
$itemUrl = Url::fromString(self::URI . $href);
// Remove tracking parameter in query string
$item['uri'] = $itemUrl->withQueryString(null)->__toString();
diff --git a/lib/url.php b/lib/url.php
index 993fef96..9a1b59ad 100644
--- a/lib/url.php
+++ b/lib/url.php
@@ -111,6 +111,9 @@ final class Url
if (!str_starts_with($path, '/')) {
throw new UrlException(sprintf('Path must start with forward slash: %s', $path));
}
+ if (str_starts_with($path, '//')) {
+ throw new UrlException(sprintf('Illegal path (too many forward slashes): %s', $path));
+ }
$clone = clone $this;
$clone->path = $path;
return $clone;
diff --git a/tests/UrlTest.php b/tests/UrlTest.php
index d45f319b..72b9ac4c 100644
--- a/tests/UrlTest.php
+++ b/tests/UrlTest.php
@@ -36,6 +36,12 @@ class UrlTest extends TestCase
}
}
+ public function testIllegalPath()
+ {
+ $this->expectException(\UrlException::class);
+ Url::fromString('https://example.com//foo');
+ }
+
public function testMutation()
{
$this->assertSame('http://example.com/foo', (Url::fromString('http://example.com/'))->withPath('/foo')->__toString());
--
cgit v1.2.3
From 3fc38c15a3afa7e0377e3b6cb4ffec1335a36f63 Mon Sep 17 00:00:00 2001
From: Dag
Date: Fri, 3 Jan 2025 06:19:24 +0100
Subject: fix: cache 400 and 404, and refactor token auth (#4388)
* fix(cache): also cache 400 and 404 responses
* refactor(token_auth)
---
actions/DisplayAction.php | 2 +-
actions/FrontpageAction.php | 2 +-
lib/http.php | 2 +-
middlewares/CacheMiddleware.php | 9 +++++++--
middlewares/TokenAuthenticationMiddleware.php | 16 ++++++++++------
templates/token.html.php | 4 ++--
6 files changed, 22 insertions(+), 13 deletions(-)
(limited to 'lib')
diff --git a/actions/DisplayAction.php b/actions/DisplayAction.php
index 845bfd84..10af8ad7 100644
--- a/actions/DisplayAction.php
+++ b/actions/DisplayAction.php
@@ -23,7 +23,7 @@ class DisplayAction implements ActionInterface
$noproxy = $request->get('_noproxy');
if (!$bridgeName) {
- return new Response(render(__DIR__ . '/../templates/error.html.php', ['message' => 'Missing bridge parameter']), 400);
+ return new Response(render(__DIR__ . '/../templates/error.html.php', ['message' => 'Missing bridge name parameter']), 400);
}
$bridgeClassName = $this->bridgeFactory->createBridgeClassName($bridgeName);
if (!$bridgeClassName) {
diff --git a/actions/FrontpageAction.php b/actions/FrontpageAction.php
index 824441b2..79ffb4f5 100644
--- a/actions/FrontpageAction.php
+++ b/actions/FrontpageAction.php
@@ -12,7 +12,7 @@ final class FrontpageAction implements ActionInterface
public function __invoke(Request $request): Response
{
- $token = $request->attribute('token');
+ $token = $request->getAttribute('token');
$messages = [];
$activeBridges = 0;
diff --git a/lib/http.php b/lib/http.php
index d1043b33..15d6ebec 100644
--- a/lib/http.php
+++ b/lib/http.php
@@ -220,7 +220,7 @@ final class Request
return $clone;
}
- public function attribute(string $key, $default = null)
+ public function getAttribute(string $key, $default = null)
{
return $this->attributes[$key] ?? $default;
}
diff --git a/middlewares/CacheMiddleware.php b/middlewares/CacheMiddleware.php
index bffde4af..b8a34754 100644
--- a/middlewares/CacheMiddleware.php
+++ b/middlewares/CacheMiddleware.php
@@ -13,7 +13,7 @@ class CacheMiddleware implements Middleware
public function __invoke(Request $request, $next): Response
{
- $action = $request->attribute('action');
+ $action = $request->getAttribute('action');
if ($action !== 'DisplayAction') {
// We only cache DisplayAction (for now)
@@ -43,9 +43,14 @@ class CacheMiddleware implements Middleware
/** @var Response $response */
$response = $next($request);
- if (in_array($response->getCode(), [403, 429, 500, 503])) {
+ if ($response->getCode() === 200) {
+ // Do nothing because DisplayAction has already cached this on $cacheKey
+ } elseif (in_array($response->getCode(), [400, 403, 404, 429, 500, 503])) {
// Cache these responses for about ~10 mins on average
$this->cache->set($cacheKey, $response, 60 * 5 + rand(1, 60 * 10));
+ } else {
+ // Should never happen
+ $this->cache->set($cacheKey, $response, 60 * 5);
}
// For 1% of requests, prune cache
diff --git a/middlewares/TokenAuthenticationMiddleware.php b/middlewares/TokenAuthenticationMiddleware.php
index f8234629..31544ab7 100644
--- a/middlewares/TokenAuthenticationMiddleware.php
+++ b/middlewares/TokenAuthenticationMiddleware.php
@@ -10,20 +10,24 @@ class TokenAuthenticationMiddleware implements Middleware
return $next($request);
}
- // Always add token to request attribute
- $request = $request->withAttribute('token', $request->get('token'));
+ $token = $request->get('token');
- if (! $request->attribute('token')) {
+ if (! $token) {
return new Response(render(__DIR__ . '/../templates/token.html.php', [
- 'message' => 'Missing token',
+ 'message' => 'Missing token',
+ 'token' => '',
]), 401);
}
- if (! hash_equals(Configuration::getConfig('authentication', 'token'), $request->attribute('token'))) {
+
+ if (! hash_equals(Configuration::getConfig('authentication', 'token'), $token)) {
return new Response(render(__DIR__ . '/../templates/token.html.php', [
- 'message' => 'Invalid token',
+ 'message' => 'Invalid token',
+ 'token' => $token,
]), 401);
}
+ $request = $request->withAttribute('token', $token);
+
return $next($request);
}
}
diff --git a/templates/token.html.php b/templates/token.html.php
index 1a036dbb..43c60972 100644
--- a/templates/token.html.php
+++ b/templates/token.html.php
@@ -13,8 +13,8 @@
= e($message) ?>
-
--
cgit v1.2.3
From 1d02214e1253b86622262988ad7ecce1f5647006 Mon Sep 17 00:00:00 2001
From: Dag
Date: Sat, 4 Jan 2025 19:43:48 +0100
Subject: feat: extract simple_html_dom max_file_size to config (#4395)
---
bridges/YoutubeBridge.php | 7 -------
config.default.ini.php | 9 +++++++++
lib/bootstrap.php | 4 ----
lib/simplehtmldom/simple_html_dom.php | 5 +++--
4 files changed, 12 insertions(+), 13 deletions(-)
(limited to 'lib')
diff --git a/bridges/YoutubeBridge.php b/bridges/YoutubeBridge.php
index 647b1c42..12cdaec4 100644
--- a/bridges/YoutubeBridge.php
+++ b/bridges/YoutubeBridge.php
@@ -1,12 +1,5 @@
10 MB)
+max_file_size = 10000000
+
[http]
+
; Operation timeout in seconds
timeout = 15
@@ -70,6 +74,7 @@ type = "file"
custom_timeout = false
[admin]
+
; Advertise an email address where people can reach the administrator.
; This address is displayed on the main page, visible to everyone!
; "" = Disabled (default)
@@ -86,6 +91,7 @@ telegram = ""
donations = true
[proxy]
+
; The HTTP proxy to tunnel requests through
; https://curl.se/libcurl/c/CURLOPT_PROXY.html
; "" = Proxy disabled (default)
@@ -135,6 +141,7 @@ report_limit = 1
; --- Cache specific configuration ---------------------------------------------
[FileCache]
+
; The root folder to store files in.
; "" = Use the cache folder in the repository (default)
path = ""
@@ -142,6 +149,7 @@ path = ""
enable_purge = true
[SQLiteCache]
+
; Filepath of the sqlite db file
file = "cache.sqlite"
; Whether to actually delete data when purging
@@ -150,6 +158,7 @@ enable_purge = true
timeout = 5000
[MemcachedCache]
+
host = "localhost"
port = 11211
diff --git a/lib/bootstrap.php b/lib/bootstrap.php
index 36b13e19..8a7c62a1 100644
--- a/lib/bootstrap.php
+++ b/lib/bootstrap.php
@@ -7,10 +7,6 @@ if (is_file(__DIR__ . '/../vendor/autoload.php')) {
const PATH_LIB_CACHES = __DIR__ . '/../caches/';
const PATH_CACHE = __DIR__ . '/../cache/';
-// Allow larger files for simple_html_dom
-// todo: extract to config (if possible)
-const MAX_FILE_SIZE = 10000000;
-
// Files
$files = [
__DIR__ . '/../lib/html.php',
diff --git a/lib/simplehtmldom/simple_html_dom.php b/lib/simplehtmldom/simple_html_dom.php
index 170f6fb0..e8b3a727 100644
--- a/lib/simplehtmldom/simple_html_dom.php
+++ b/lib/simplehtmldom/simple_html_dom.php
@@ -114,8 +114,9 @@ function str_get_html(
if (empty($str)) {
throw new \Exception('Refusing to parse empty string input');
}
- if (strlen($str) > MAX_FILE_SIZE) {
- throw new \Exception('Refusing to parse too big input');
+
+ if (strlen($str) > Configuration::getConfig('system', 'max_file_size')) {
+ throw new \Exception('simple_html_dom: Refusing to parse too big input: ' . strlen($str));
}
return $dom->load($str, $lowercase, $stripRN);
--
cgit v1.2.3
From cb65125dbd1fc5f82d16c036c00bcebc1a10d6de Mon Sep 17 00:00:00 2001
From: Dag
Date: Sat, 4 Jan 2025 20:34:36 +0100
Subject: feat: add section link to frontpage bridge card (#4396)
---
lib/BridgeCard.php | 4 ++++
static/style.css | 1 +
2 files changed, 5 insertions(+)
(limited to 'lib')
diff --git a/lib/BridgeCard.php b/lib/BridgeCard.php
index 855ddb93..2f171002 100644
--- a/lib/BridgeCard.php
+++ b/lib/BridgeCard.php
@@ -44,6 +44,10 @@ final class BridgeCard
data-short-name="$shortName"
>
+
+ #
+
+
{$description}
diff --git a/static/style.css b/static/style.css
index 4e6b1b2d..4c831534 100644
--- a/static/style.css
+++ b/static/style.css
@@ -186,6 +186,7 @@ section li {
margin-left: 1em;
}
.bridge-card {
+ position: relative;
text-align: center;
}
--
cgit v1.2.3
From dd8bc077edc5b1af664b4fae9d63a16467e02c17 Mon Sep 17 00:00:00 2001
From: Dag
Date: Sat, 25 Jan 2025 18:29:01 +0100
Subject: feat(FeedParser): recursively parse rss modules (#4422)
Also stop excluding the media module
fix #4415
---
lib/FeedParser.php | 12 ++++++--
tests/FeedParserTest.php | 79 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 88 insertions(+), 3 deletions(-)
(limited to 'lib')
diff --git a/lib/FeedParser.php b/lib/FeedParser.php
index 0ad90965..3b133b85 100644
--- a/lib/FeedParser.php
+++ b/lib/FeedParser.php
@@ -174,7 +174,7 @@ final class FeedParser
}
foreach ($namespaces as $namespaceName => $namespaceUrl) {
- if (in_array($namespaceName, ['', 'content', 'media'])) {
+ if (in_array($namespaceName, ['', 'content'])) {
continue;
}
$item[$namespaceName] = $this->parseModule($feedItem, $namespaceName, $namespaceUrl);
@@ -250,11 +250,17 @@ final class FeedParser
private function parseModule(\SimpleXMLElement $element, string $namespaceName, string $namespaceUrl): array
{
+ // Unfortunately this parses out only node values as string
+ // TODO: parse attributes too
+
$result = [];
$module = $element->children($namespaceUrl);
foreach ($module as $name => $value) {
- // todo: add custom parsing if it's something other than a string
- $result[$name] = (string) $value;
+ if (get_class($value) === 'SimpleXMLElement' && $value->count() !== 0) {
+ $result[$name] = $this->parseModule($value, $namespaceName, $namespaceUrl);
+ } else {
+ $result[$name] = (string) $value;
+ }
}
return $result;
}
diff --git a/tests/FeedParserTest.php b/tests/FeedParserTest.php
index 45dc1234..458bdb53 100644
--- a/tests/FeedParserTest.php
+++ b/tests/FeedParserTest.php
@@ -183,4 +183,83 @@ class FeedParserTest extends TestCase
];
$this->assertEquals($expected, $feed);
}
+
+ public function testYoutubeMediaModule()
+ {
+ $xml = <<
+
+
+ yt:channel:uCkxoKLYO_EQ2GeFtbM_bw
+ uCkxoKLYO_EQ2GeFtbM_bw
+ Half as Interesting
+
+
+ Half as Interesting
+ https://www.youtube.com/channel/UCuCkxoKLYO_EQ2GeFtbM_bw
+
+ 2017-08-26T20:06:05+00:00
+
+ yt:video:Upjg7F28DJw
+ Upjg7F28DJw
+ UCuCkxoKLYO_EQ2GeFtbM_bw
+ The Nuke-Proof US Military Base in a Mountain
+
+
+ Half as Interesting
+ https://www.youtube.com/channel/UCuCkxoKLYO_EQ2GeFtbM_bw
+
+ 2025-01-24T15:44:18+00:00
+ 2025-01-25T06:55:19+00:00
+
+ The Nuke-Proof US Military Base in a Mountain
+
+
+ Receive 10% off anything on bellroy.com: https://bit.ly/3HdOWu9
+
+
+
+
+
+
+
+ XML;
+
+ $feed = $this->sut->parseFeed($xml);
+ $expected = [
+ 'title' => 'Half as Interesting',
+ 'uri' => 'https://www.youtube.com/channel/UCuCkxoKLYO_EQ2GeFtbM_bw',
+ 'icon' => null,
+ 'items' => [
+ [
+ 'uri' => 'https://www.youtube.com/watch?v=Upjg7F28DJw',
+ 'title' => 'The Nuke-Proof US Military Base in a Mountain',
+ 'content' => '',
+ 'timestamp' => 1737788119,
+ 'author' => 'Half as Interesting',
+ 'id' => 'yt:video:Upjg7F28DJw',
+ 'published' => '2025-01-24T15:44:18+00:00',
+ 'updated' => '2025-01-25T06:55:19+00:00',
+ 'link' => '',
+ 'yt' => [
+ 'videoId' => 'Upjg7F28DJw',
+ 'channelId' => 'UCuCkxoKLYO_EQ2GeFtbM_bw',
+ ],
+ 'media' => [
+ 'group' => [
+ 'title' => 'The Nuke-Proof US Military Base in a Mountain',
+ 'content' => '',
+ 'thumbnail' => '',
+ 'description' => 'Receive 10% off anything on bellroy.com: https://bit.ly/3HdOWu9',
+ 'community' => [
+ 'starRating' => '',
+ 'statistics' => '',
+ ],
+ ],
+ ],
+ ]
+ ],
+ ];
+ $this->assertEquals($expected, $feed);
+ }
}
--
cgit v1.2.3
From 4da61b7922d0b93133a4ef74dd128864da64193f Mon Sep 17 00:00:00 2001
From: Dag
Date: Sun, 26 Jan 2025 11:16:35 +0100
Subject: chore: prepare 2025-01-26 release (#4424)
---
README.md | 32 ++++++++++++++------------------
config.default.ini.php | 13 ++++---------
lib/Configuration.php | 2 +-
3 files changed, 19 insertions(+), 28 deletions(-)
(limited to 'lib')
diff --git a/README.md b/README.md
index b3b12f0e..b813abf7 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@ Requires minimum PHP 7.4.
|||
|||
-## A subset of bridges (16/447)
+## A subset of bridges (15/447)
* `CssSelectorBridge`: [Scrape out a feed using CSS selectors](https://rss-bridge.org/bridge01/#bridge-CssSelectorBridge)
* `FeedMergeBridge`: [Combine multiple feeds into one](https://rss-bridge.org/bridge01/#bridge-FeedMergeBridge)
@@ -44,7 +44,6 @@ Requires minimum PHP 7.4.
* `ThePirateBayBridge:` [Fetches torrents by search/user/category](https://rss-bridge.org/bridge01/#bridge-ThePirateBayBridge)
* `TikTokBridge`: [Fetches posts by username](https://rss-bridge.org/bridge01/#bridge-TikTokBridge)
* `TwitchBridge`: [Fetches videos from channel](https://rss-bridge.org/bridge01/#bridge-TwitchBridge)
-* `VkBridge`: [Fetches posts from user/group](https://rss-bridge.org/bridge01/#bridge-VkBridge)
* `XPathBridge`: [Scrape out a feed using XPath expressions](https://rss-bridge.org/bridge01/#bridge-XPathBridge)
* `YoutubeBridge`: [Fetches videos by username/channel/playlist/search](https://rss-bridge.org/bridge01/#bridge-YoutubeBridge)
* `YouTubeCommunityTabBridge`: [Fetches posts from a channel's community tab](https://rss-bridge.org/bridge01/#bridge-YouTubeCommunityTabBridge)
@@ -72,27 +71,27 @@ useradd --shell /bin/bash --create-home rss-bridge
cd /var/www
-# Create folder and change ownership
+# Create folder and change its ownership to rss-bridge
mkdir rss-bridge && chown rss-bridge:rss-bridge rss-bridge/
-# Become user
+# Become rss-bridge
su rss-bridge
-# Fetch latest master
+# Clone master branch into existing folder
git clone https://github.com/RSS-Bridge/rss-bridge.git rss-bridge/
cd rss-bridge
-# Copy over the default config
+# Copy over the default config (OPTIONAL)
cp -v config.default.ini.php config.ini.php
-# Give full permissions only to owner (rss-bridge)
-chmod 700 -R ./
+# Recursively give full permissions to user/owner
+chmod 700 --recursive ./
-# Give read and execute to others (nginx and php-fpm)
+# Give read and execute to others on folder ./static
chmod o+rx ./ ./static
-# Give read to others (nginx)
-chmod o+r -R ./static
+# Recursively give give read to others on folder ./static
+chmod o+r --recursive ./static
```
Nginx config:
@@ -110,17 +109,14 @@ server {
error_log /var/log/nginx/rss-bridge.error.log;
log_not_found off;
- # Intentionally not setting a root folder here
-
- # autoindex is off by default but feels good to explicitly turn off
- autoindex off;
+ # Intentionally not setting a root folder
# Static content only served here
location /static/ {
alias /var/www/rss-bridge/static/;
}
- # Pass off to php-fpm when location is exactly /
+ # Pass off to php-fpm only when location is EXACTLY == /
location = / {
root /var/www/rss-bridge/;
include snippets/fastcgi-php.conf;
@@ -128,12 +124,12 @@ server {
fastcgi_pass unix:/run/php/rss-bridge.sock;
}
- # Reduce spam
+ # Reduce log noise
location = /favicon.ico {
access_log off;
}
- # Reduce spam
+ # Reduce log noise
location = /robots.txt {
access_log off;
}
diff --git a/config.default.ini.php b/config.default.ini.php
index 25f35508..886878a2 100644
--- a/config.default.ini.php
+++ b/config.default.ini.php
@@ -21,20 +21,15 @@
;enabled_bridges[] = ThePirateBay
;enabled_bridges[] = TikTokBridge
;enabled_bridges[] = Twitch
-;enabled_bridges[] = Vk
;enabled_bridges[] = XPathBridge
;enabled_bridges[] = Youtube
;enabled_bridges[] = YouTubeCommunityTabBridge
enabled_bridges[] = *
-; Defines the timezone used by RSS-Bridge
-; Find a list of supported timezones at
-; https://www.php.net/manual/en/timezones.php
-; timezone = "UTC" (default)
timezone = "UTC"
; Display a system message to users.
-message = ""
+;message = "Hello world"
; Whether to enable debug mode.
enable_debug_mode = false
@@ -52,12 +47,12 @@ max_file_size = 10000000
[http]
; Operation timeout in seconds
-timeout = 15
+timeout = 5
; Operation retry count in case of curl error
-retries = 2
+retries = 1
-; User agent
+; Curl user agent
useragent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0"
; Max http response size in MB
diff --git a/lib/Configuration.php b/lib/Configuration.php
index c0cfe0c2..60bf80fb 100644
--- a/lib/Configuration.php
+++ b/lib/Configuration.php
@@ -7,7 +7,7 @@
*/
final class Configuration
{
- private const VERSION = '2025-01-02';
+ private const VERSION = '2025-01-26';
private static $config = [];
--
cgit v1.2.3
From 824ac5e373563ac481a96c2b9d40999747654a48 Mon Sep 17 00:00:00 2001
From: Dag
Date: Sun, 26 Jan 2025 21:24:33 +0100
Subject: docs (#4427)
* docs
* docs
---
.github/ISSUE_TEMPLATE/bridge-request.md | 4 ++--
README.md | 5 ++---
config.default.ini.php | 2 +-
lib/contents.php | 4 +---
templates/frontpage.html.php | 2 +-
5 files changed, 7 insertions(+), 10 deletions(-)
(limited to 'lib')
diff --git a/.github/ISSUE_TEMPLATE/bridge-request.md b/.github/ISSUE_TEMPLATE/bridge-request.md
index 174dc095..088cc3d6 100644
--- a/.github/ISSUE_TEMPLATE/bridge-request.md
+++ b/.github/ISSUE_TEMPLATE/bridge-request.md
@@ -49,9 +49,9 @@ Please describe what you expect from the bridge. Whenever possible provide sampl
- _Default limit_: 5
- [ ] Load full articles
- _Cache articles_ (articles are stored in a local cache on first request): yes
- - _Cache timeout_ (max = 24 hours): 24 hours
+ - _Cache timeout_ : 24 hours
- [X] Balance requests (RSS-Bridge uses cached versions to reduce bandwith usage)
- - _Timeout_ (default = 5 minutes, max = 24 hours): 5 minutes
+ - _Timeout_ (default = 5 minutes): 5 minutes
diff --git a/README.md b/README.md
index b813abf7..dadf7094 100644
--- a/README.md
+++ b/README.md
@@ -150,11 +150,11 @@ listen = /run/php/rss-bridge.sock
listen.owner = www-data
listen.group = www-data
-# Create 10 workers standing by to serve requests
+; Create 10 workers standing by to serve requests
pm = static
pm.max_children = 10
-# Respawn worker after 500 requests (workaround for memory leaks etc.)
+; Respawn worker after 500 requests (workaround for memory leaks etc.)
pm.max_requests = 500
```
@@ -460,7 +460,6 @@ See [CONTRIBUTORS.md](CONTRIBUTORS.md)
RSS-Bridge uses caching to prevent services from banning your server for repeatedly updating feeds.
The specific cache duration can be different between bridges.
-Cached files are deleted automatically after 24 hours.
RSS-Bridge allows you to take full control over which bridges are displayed to the user.
That way you can host your own RSS-Bridge service with your favorite collection of bridges!
diff --git a/config.default.ini.php b/config.default.ini.php
index 886878a2..6d646fd5 100644
--- a/config.default.ini.php
+++ b/config.default.ini.php
@@ -75,7 +75,7 @@ custom_timeout = false
; "" = Disabled (default)
email = ""
-; Advertise a contact Telegram url e.g. "https://t.me/elegantobjects"
+; Advertise a contact URL (can be any URL!) e.g. "https://t.me/elegantobjects"
telegram = ""
; Show Donation information for bridges if available.
diff --git a/lib/contents.php b/lib/contents.php
index 752c0ff2..b4d70817 100644
--- a/lib/contents.php
+++ b/lib/contents.php
@@ -177,11 +177,9 @@ function getSimpleHTMLDOM(
}
/**
- * Gets contents from the Internet as simplhtmldom object. Contents are cached
+ * Fetch contents from the Internet as simplhtmldom object. Contents are cached
* and re-used for subsequent calls until the cache duration elapsed.
*
- * _Notice_: Cached contents are forcefully removed after 24 hours (86400 seconds).
- *
* @param string $url The URL.
* @param int $ttl Cache duration in seconds.
* @param array $header (optional) A list of cURL header.
diff --git a/templates/frontpage.html.php b/templates/frontpage.html.php
index c1182673..f285e8d6 100644
--- a/templates/frontpage.html.php
+++ b/templates/frontpage.html.php
@@ -52,7 +52,7 @@
--
cgit v1.2.3
From 935075072b7937583818677daff31cad5037362f Mon Sep 17 00:00:00 2001
From: Dag
Date: Thu, 30 Jan 2025 21:05:17 +0100
Subject: fix: set default cache ttl of 1d (#4434)
---
lib/BridgeAbstract.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'lib')
diff --git a/lib/BridgeAbstract.php b/lib/BridgeAbstract.php
index 23e90e13..b814097a 100644
--- a/lib/BridgeAbstract.php
+++ b/lib/BridgeAbstract.php
@@ -327,7 +327,7 @@ abstract class BridgeAbstract
return $this->cache->get($this->getShortName() . '_' . $key, $default);
}
- protected function saveCacheValue(string $key, $value, int $ttl = null)
+ protected function saveCacheValue(string $key, $value, int $ttl = 86400)
{
$this->cache->set($this->getShortName() . '_' . $key, $value, $ttl);
}
--
cgit v1.2.3