Commit 10d3f737 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

feat: add WebSub module for pushing feed updates to open hubs

parent 12530961
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ class Autoload extends AutoloadConfig
        'Modules\Analytics' => ROOTPATH . 'modules/Analytics/',
        'Modules\Install' => ROOTPATH . 'modules/Install/',
        'Modules\Fediverse' => ROOTPATH . 'modules/Fediverse/',
        'Modules\WebSub' => ROOTPATH . 'modules/WebSub/',
        'Config' => APPPATH . 'Config/',
        'ViewComponents' => APPPATH . 'Libraries/ViewComponents/',
        'ViewThemes' => APPPATH . 'Libraries/ViewThemes/',
+2 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ use RuntimeException;
 * @property string|null $location_osm
 * @property array|null $custom_rss
 * @property string $custom_rss_string
 * @property bool $is_published_on_hubs
 * @property int $posts_count
 * @property int $comments_count
 * @property int $created_by
@@ -164,6 +165,7 @@ class Episode extends Entity
        'location_geo' => '?string',
        'location_osm' => '?string',
        'custom_rss' => '?json-array',
        'is_published_on_hubs' => 'boolean',
        'posts_count' => 'integer',
        'comments_count' => 'integer',
        'created_by' => 'integer',
+2 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ use RuntimeException;
 * @property string|null $payment_pointer
 * @property array|null $custom_rss
 * @property string $custom_rss_string
 * @property bool $is_published_on_hubs
 * @property string|null $partner_id
 * @property string|null $partner_link_url
 * @property string|null $partner_image_url
@@ -180,6 +181,7 @@ class Podcast extends Entity
        'location_osm' => '?string',
        'payment_pointer' => '?string',
        'custom_rss' => '?json-array',
        'is_published_on_hubs' => 'boolean',
        'partner_id' => '?string',
        'partner_link_url' => '?string',
        'partner_image_url' => '?string',
+10 −0
Original line number Diff line number Diff line
@@ -41,6 +41,16 @@ if (! function_exists('get_rss_feed')) {
        $atomLink->addAttribute('rel', 'self');
        $atomLink->addAttribute('type', 'application/rss+xml');

        // websub: add links to hubs defined in config
        $websubHubs = config('WebSub')
            ->hubs;
        foreach ($websubHubs as $websubHub) {
            $atomLinkHub = $channel->addChild('atom:link', null, 'http://www.w3.org/2005/Atom');
            $atomLinkHub->addAttribute('href', $websubHub);
            $atomLinkHub->addAttribute('rel', 'hub');
            $atomLinkHub->addAttribute('type', 'application/rss+xml');
        }

        if ($podcast->new_feed_url !== null) {
            $channel->addChild('new-feed-url', $podcast->new_feed_url, $itunesNamespace);
        }
+3 −2
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ class EpisodeModel extends Model
        'location_geo',
        'location_osm',
        'custom_rss',
        'is_published_on_hubs',
        'posts_count',
        'comments_count',
        'published_at',
@@ -378,7 +379,7 @@ class EpisodeModel extends Model
    /**
     * @param mixed[] $data
     *
     * @return array<string, array<string|int, mixed>>
     * @return mixed[]
     */
    public function clearCache(array $data): array
    {
@@ -404,7 +405,7 @@ class EpisodeModel extends Model
    /**
     * @param mixed[] $data
     *
     * @return array<string, array<string|int, mixed>>
     * @return mixed[]
     */
    protected function writeEnclosureMetadata(array $data): array
    {
Loading