1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-07-31 13:50:23 +02:00

feat: support itunes namespace in top channel feed (#3776)

Also preserves other properties.
This commit is contained in:
Dag
2024-01-09 20:18:33 +01:00
committed by GitHub
parent ea58c8d2bc
commit 3ce94409ab
22 changed files with 298 additions and 203 deletions

View File

@@ -40,9 +40,38 @@ abstract class BridgeAbstract
abstract public function collectData();
public function getItems()
public function getFeed(): array
{
return $this->items;
return [
'name' => $this->getName(),
'uri' => $this->getURI(),
'donationUri' => $this->getDonationURI(),
'icon' => $this->getIcon(),
];
}
public function getName()
{
return static::NAME;
}
public function getURI()
{
return static::URI ?? 'https://github.com/RSS-Bridge/rss-bridge/';
}
public function getDonationURI(): string
{
return static::DONATION_URI;
}
public function getIcon()
{
if (static::URI) {
// This favicon may or may not exist
return rtrim(static::URI, '/') . '/favicon.ico';
}
return '';
}
public function getOption(string $name)
@@ -50,6 +79,9 @@ abstract class BridgeAbstract
return $this->configuration[$name] ?? null;
}
/**
* The description is currently not used in feed production
*/
public function getDescription()
{
return static::DESCRIPTION;
@@ -60,29 +92,14 @@ abstract class BridgeAbstract
return static::MAINTAINER;
}
public function getName()
{
return static::NAME;
}
public function getIcon()
{
return static::URI . '/favicon.ico';
}
public function getParameters(): array
{
return static::PARAMETERS;
}
public function getURI()
public function getItems()
{
return static::URI;
}
public function getDonationURI(): string
{
return static::DONATION_URI;
return $this->items;
}
public function getCacheTimeout()

View File

@@ -9,10 +9,43 @@ abstract class FormatAbstract
protected string $charset = 'UTF-8';
protected array $items = [];
protected int $lastModified;
protected array $extraInfos = [];
protected array $feed = [];
abstract public function stringify();
public function setFeed(array $feed)
{
$default = [
'name' => '',
'uri' => '',
'icon' => '',
'donationUri' => '',
];
$this->feed = array_merge($default, $feed);
}
public function getFeed(): array
{
return $this->feed;
}
/**
* @param FeedItem[] $items
*/
public function setItems(array $items): void
{
$this->items = $items;
}
/**
* @return FeedItem[] The items
*/
public function getItems(): array
{
return $this->items;
}
public function getMimeType(): string
{
return static::MIME_TYPE;
@@ -32,44 +65,4 @@ abstract class FormatAbstract
{
$this->lastModified = $lastModified;
}
/**
* @param FeedItem[] $items
*/
public function setItems(array $items): void
{
$this->items = $items;
}
/**
* @return FeedItem[] The items
*/
public function getItems(): array
{
return $this->items;
}
public function setExtraInfos(array $infos = [])
{
$extras = [
'name',
'uri',
'icon',
'donationUri',
];
foreach ($extras as $extra) {
if (!isset($infos[$extra])) {
$infos[$extra] = '';
}
}
$this->extraInfos = $infos;
}
public function getExtraInfos(): array
{
if (!$this->extraInfos) {
$this->setExtraInfos();
}
return $this->extraInfos;
}
}

View File

@@ -9,9 +9,6 @@ const PATH_LIB_CACHES = __DIR__ . '/../caches/';
/** Path to the cache folder */
const PATH_CACHE = __DIR__ . '/../cache/';
/** URL to the RSS-Bridge repository */
const REPOSITORY = 'https://github.com/RSS-Bridge/rss-bridge/';
// Allow larger files for simple_html_dom
// todo: extract to config (if possible)
const MAX_FILE_SIZE = 10000000;