diff --git a/provision/hosts/torus/rss-bridge.nix b/provision/hosts/torus/rss-bridge.nix index fdbc42d2..b508ded6 100644 --- a/provision/hosts/torus/rss-bridge.nix +++ b/provision/hosts/torus/rss-bridge.nix @@ -95,6 +95,7 @@ in }; systemd.tmpfiles.rules = [ "d '${cfg.dataDir}/cache' 0750 ${cfg.user} ${cfg.group} - -" + "d '${cfg.dataDir}/bridges' 0750 ${cfg.user} ${cfg.group} - -" (mkIf (cfg.whitelist != []) "L+ ${cfg.dataDir}/whitelist.txt - - - - ${whitelist}") "z '${cfg.dataDir}/config.ini.php' 0750 ${cfg.user} ${cfg.group} - -" ]; diff --git a/provision/pkgs/rss-bridge/default.nix b/provision/pkgs/rss-bridge/default.nix index 86e71626..9e4fe5ff 100644 --- a/provision/pkgs/rss-bridge/default.nix +++ b/provision/pkgs/rss-bridge/default.nix @@ -5,7 +5,7 @@ stdenv.mkDerivation rec { version = "b037d1b4d1f0b0f422e21125ddef00a58e185ed1"; src = fetchFromGitHub { - owner = "starr-dusT"; + owner = "RSS-Bridge"; repo = "rss-bridge"; rev = version; sha256 = "sha256-zyWnjSYE2NFK/OJLnsFsE5oEyf+yrJe8TT6MH4roBwU="; @@ -13,7 +13,6 @@ stdenv.mkDerivation rec { patches = [ ./paths.patch - ./youtube_time_hack.patch ]; installPhase = '' @@ -23,7 +22,7 @@ stdenv.mkDerivation rec { meta = with lib; { description = "The RSS feed for websites missing it"; - homepage = "https://github.com/starr-dusT/rss-bridge"; + homepage = "https://github.com/RSS-Bridge/rss-bridge"; license = licenses.unlicense; maintainers = with maintainers; [ starr-dusT ]; platforms = platforms.all; diff --git a/provision/pkgs/rss-bridge/paths.patch b/provision/pkgs/rss-bridge/paths.patch old mode 100644 new mode 100755 index db4a617c..c4c8b49c --- a/provision/pkgs/rss-bridge/paths.patch +++ b/provision/pkgs/rss-bridge/paths.patch @@ -3,7 +3,7 @@ index 123f6ecd..69071aa2 100644 --- a/index.php +++ b/index.php @@ -8,8 +8,8 @@ require_once __DIR__ . '/lib/bootstrap.php'; - + Configuration::verifyInstallation(); $customConfig = []; -if (file_exists(__DIR__ . '/config.ini.php')) { @@ -12,16 +12,39 @@ index 123f6ecd..69071aa2 100644 + $customConfig = parse_ini_file(getenv('RSSBRIDGE_DATA') . '/config.ini.php', true, INI_SCANNER_TYPED); } Configuration::loadConfiguration($customConfig, getenv()); - -diff --git a/lib/Configuration.php b/lib/Configuration.php -index d699178f..5431f345 100644 ---- a/lib/Configuration.php -+++ b/lib/Configuration.php -@@ -91,9 +91,8 @@ final class Configuration - self::setConfig('system', 'debug_mode_whitelist', explode("\n", str_replace("\r", '', $debug))); + +diff --git a/lib/BridgeFactory.php b/lib/BridgeFactory.php +index ad433287..195c7af1 100644 +--- a/lib/BridgeFactory.php ++++ b/lib/BridgeFactory.php +@@ -13,12 +13,18 @@ final class BridgeFactory + $this->cache = RssBridge::getCache(); + $this->logger = RssBridge::getLogger(); + +- // Create all possible bridge class names from fs ++ // Create all possible bridge class names from original fs + foreach (scandir(__DIR__ . '/../bridges/') as $file) { + if (preg_match('/^([^.]+Bridge)\.php$/U', $file, $m)) { + $this->bridgeClassNames[] = $m[1]; } } -- ++ // Create all possible bridge class names from additional fs ++ foreach (scandir(PATH_BRIDGES) as $file) { ++ if (preg_match('/^([^.]+Bridge)\.php$/U', $file, $m)) { ++ $this->bridgeClassNames[] = $m[1]; ++ } ++ } + + $enabledBridges = Configuration::getConfig('system', 'enabled_bridges'); + if ($enabledBridges === null) { +diff --git a/lib/Configuration.php b/lib/Configuration.php +index c6fed0fd..672a5699 100644 +--- a/lib/Configuration.php ++++ b/lib/Configuration.php +@@ -92,8 +92,8 @@ final class Configuration + } + } + - if (file_exists(__DIR__ . '/../whitelist.txt')) { - $enabledBridges = trim(file_get_contents(__DIR__ . '/../whitelist.txt')); + if (file_exists(getenv('RSSBRIDGE_DATA') . '/whitelist.txt')) { @@ -30,15 +53,26 @@ index d699178f..5431f345 100644 self::setConfig('system', 'enabled_bridges', ['*']); } else { diff --git a/lib/bootstrap.php b/lib/bootstrap.php -index a95de9dd..78153a65 100644 +index a95de9dd..e8ed317f 100644 --- a/lib/bootstrap.php +++ b/lib/bootstrap.php -@@ -7,7 +7,7 @@ const PATH_LIB_FORMATS = __DIR__ . '/../formats/'; +@@ -7,7 +7,10 @@ const PATH_LIB_FORMATS = __DIR__ . '/../formats/'; const PATH_LIB_CACHES = __DIR__ . '/../caches/'; - + /** Path to the cache folder */ -const PATH_CACHE = __DIR__ . '/../cache/'; +define('PATH_CACHE', getenv('RSSBRIDGE_DATA') . '/cache/'); - ++ ++/** Path to extra bridge files */ ++define('PATH_BRIDGES', getenv('RSSBRIDGE_DATA') . '/bridges/'); + /** URL to the RSS-Bridge repository */ const REPOSITORY = 'https://github.com/RSS-Bridge/rss-bridge/'; +@@ -41,6 +44,7 @@ spl_autoload_register(function ($className) { + __DIR__ . '/../caches/', + __DIR__ . '/../formats/', + __DIR__ . '/../lib/', ++ PATH_BRIDGES, + ]; + foreach ($folders as $folder) { + $file = $folder . $className . '.php'; diff --git a/provision/pkgs/rss-bridge/youtube_time_hack.patch b/provision/pkgs/rss-bridge/youtube_time_hack.patch deleted file mode 100644 index 59fbf12c..00000000 --- a/provision/pkgs/rss-bridge/youtube_time_hack.patch +++ /dev/null @@ -1,74 +0,0 @@ -diff --git a/bridges/YoutubeBridge.php b/bridges/YoutubeBridge.php -index 993f8c90..b000a9ff 100644 ---- a/bridges/YoutubeBridge.php -+++ b/bridges/YoutubeBridge.php -@@ -134,26 +134,20 @@ class YoutubeBridge extends BridgeAbstract - $url_feed = $jsonData->metadata->channelMetadataRenderer->rssUrl; - $this->feedIconUrl = $jsonData->metadata->channelMetadataRenderer->avatar->thumbnails[0]->url; - } -- if ($filterByDuration) { -- if (!$custom) { -- // Fetch the html page -- $html = $this->fetch($url_listing); -- $jsonData = $this->extractJsonFromHtml($html); -- } -- $channel_id = ''; -- if (isset($jsonData->contents)) { -- $channel_id = $jsonData->metadata->channelMetadataRenderer->externalId; -- $jsonData = $jsonData->contents->twoColumnBrowseResultsRenderer->tabs[1]; -- $jsonData = $jsonData->tabRenderer->content->richGridRenderer->contents; -- // $jsonData = $jsonData->itemSectionRenderer->contents[0]->gridRenderer->items; -- $this->fetchItemsFromFromJsonData($jsonData); -- } else { -- returnServerError('Unable to get data from YouTube'); -- } -+ if (!$custom) { -+ // Fetch the html page -+ $html = $this->fetch($url_listing); -+ $jsonData = $this->extractJsonFromHtml($html); -+ } -+ $channel_id = ''; -+ if (isset($jsonData->contents)) { -+ $channel_id = $jsonData->metadata->channelMetadataRenderer->externalId; -+ $jsonData = $jsonData->contents->twoColumnBrowseResultsRenderer->tabs[1]; -+ $jsonData = $jsonData->tabRenderer->content->richGridRenderer->contents; -+ // $jsonData = $jsonData->itemSectionRenderer->contents[0]->gridRenderer->items; -+ $this->fetchItemsFromFromJsonData($jsonData); - } else { -- // Fetch the xml feed -- $html = $this->fetch($url_feed); -- $this->extractItemsFromXmlFeed($html); -+ returnServerError('Unable to get data from YouTube'); - } - $this->feedName = str_replace(' - YouTube', '', $html->find('title', 0)->plaintext); - } elseif ($playlist) { -@@ -496,24 +490,23 @@ class YoutubeBridge extends BridgeAbstract - continue; - } - } -- if (!$description || !$timestamp) { -- $this->fetchVideoDetails($videoId, $author, $description, $timestamp); -- } -- $this->addItem($videoId, $title, $author, $description, $timestamp); -+ # Re-fetch better details from xml -+ $this->fetchVideoDetails($videoId, $author, $description, $timestamp); -+ $this->addItem($videoId, $title, $author, $description, $timestamp, $durationText); - if (count($this->items) >= 99) { - break; - } - } - } - -- private function addItem($videoId, $title, $author, $description, $timestamp, $thumbnail = '') -+ private function addItem($videoId, $title, $author, $description, $timestamp, $durationText, $thumbnail = '') - { - $description = nl2br($description); - - $item = []; - // This should probably be uid? - $item['id'] = $videoId; -- $item['title'] = $title; -+ $item['title'] = $title . " [" . $durationText . "]"; - $item['author'] = $author ?? ''; - $item['timestamp'] = $timestamp; - $item['uri'] = self::URI . '/watch?v=' . $videoId;