diff --git a/xExtension-RssBridge/README.md b/xExtension-RssBridge/README.md index 6a3f54b..cd3714d 100644 --- a/xExtension-RssBridge/README.md +++ b/xExtension-RssBridge/README.md @@ -7,6 +7,7 @@ To use it, upload this entire directory to the FreshRSS `./extensions` directory ## Configuration settings * `rss_bridge_url`: the URL for an RSS-Bridge instance e.g. `https://example.com/rss-bridge/` +* `rss_bridge_token`: (optional) authentication token for secured RSS-Bridge instances ## Bridge availability diff --git a/xExtension-RssBridge/configure.phtml b/xExtension-RssBridge/configure.phtml index 0202c00..520c1f8 100644 --- a/xExtension-RssBridge/configure.phtml +++ b/xExtension-RssBridge/configure.phtml @@ -7,6 +7,13 @@ +
tag + $error_message = ''; + if (!empty($response_body) && preg_match('/
]*>(.*?)<\/p>/s', $response_body, $matches)) { + $error_message = trim(strip_tags($matches[1])); + } + + // Log specific response cases with extracted error messages + if (strpos($headers[0], '401') !== false) { + $log_msg = '[RSS-Bridge extension] Authentication failed: '; + if ($error_message && stripos($error_message, 'token') !== false) { + $log_msg .= $error_message; + } else { + $log_msg .= 'Server uses an unsupported authentication method'; // (' . $error_message . ') + } + Minz_Log::warning($log_msg); + } else if (strpos($headers[0], '404') !== false) { + Minz_Log::warning('[RSS-Bridge extension] (404) RSS-Bridge endpoint not found - check configuration'); + } else if (strpos($headers[0], '200') !== false) { + // Log when RSS-Bridge can't handle the URL (comment out if too noisy) + $log_msg = '[RSS-Bridge extension] ' . ($error_message ?: '(200) RSS-Bridge unable to handle request for unknown reason'); + Minz_Log::warning($log_msg); + } else { + // Check if this was actually a connection failure + if ($response_body === false) { + $error = error_get_last(); + $error_message_raw = $error['message'] ?? 'unknown reason'; + Minz_Log::warning('[RSS-Bridge extension] Connection to RSS-Bridge endpoint failed: ' . $error_message_raw); + } else { + // Log other unexpected responses + $log_msg = '[RSS-Bridge extension] Unexpected response: ' . trim($headers[0]); + if ($error_message) { + $log_msg .= ' (message: ' . $error_message . ')'; + } + Minz_Log::warning($log_msg); + } + } } + + // Log that we're passing through the original URL (comment out if too noisy) + Minz_Log::warning('[RSS-Bridge extension] Passing through original URL: ' . $url); + + return $url; } } diff --git a/xExtension-RssBridge/i18n/en/ext.php b/xExtension-RssBridge/i18n/en/ext.php index 3df1063..a4dde6a 100644 --- a/xExtension-RssBridge/i18n/en/ext.php +++ b/xExtension-RssBridge/i18n/en/ext.php @@ -3,5 +3,6 @@ return array( 'rssbridge' => array( 'url' => 'RSS-Bridge URL', + 'token' => 'Authentication Token', ), ); diff --git a/xExtension-RssBridge/metadata.json b/xExtension-RssBridge/metadata.json index 6db3b13..d22d5ac 100644 --- a/xExtension-RssBridge/metadata.json +++ b/xExtension-RssBridge/metadata.json @@ -1,8 +1,8 @@ { "name": "RSS-Bridge", "author": "Devon Hess", - "description": "Run URLs through RSS-Bridge detection.", - "version": 1.1, + "description": "Run URLs through RSS-Bridge detection with token authentication support.", + "version": 1.2, "entrypoint": "RssBridge", "type": "system" }