Commit 57e459e1 authored by Guy Martin (Dwev)'s avatar Guy Martin (Dwev) 🇩🇰 Committed by Yassine Doghri
Browse files

feat: support podcast:txt tag with verify use case

closes #468
parent a67f4acb
Loading
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
<?php

declare(strict_types=1);

/**
 * Class AddPodcastsVerifyTxtField adds 1 field to podcast table in database to support podcast:txt tag
 *
 * @copyright  2024 Ad Aures
 * @license    https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
 * @link       https://castopod.org/
 */

namespace App\Database\Migrations;

class AddPodcastsVerifyTxtField extends BaseMigration
{
    public function up(): void
    {
        $fields = [
            'verify_txt' => [
                'type'  => 'TEXT',
                'null'  => true,
                'after' => 'location_osm',
            ],
        ];

        $this->forge->addColumn('podcasts', $fields);
    }

    public function down(): void
    {
        $this->forge->dropColumn('podcasts', 'verify_txt');
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -121,6 +121,12 @@ if (! function_exists('get_rss_feed')) {
                ->addAttribute('owner', $podcast->owner_email);
        }

        if ($podcast->verify_txt !== null) {
            $channel
                ->addChild('txt', $podcast->verify_txt, $podcastNamespace)
                ->addAttribute('purpose', 'verify');
        }

        if ($podcast->imported_feed_url !== null) {
            $channel->addChild('previousUrl', $podcast->imported_feed_url, $podcastNamespace);
        }
+1 −0
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ class PodcastModel extends Model
        'location_name',
        'location_geo',
        'location_osm',
        'verify_txt',
        'payment_pointer',
        'custom_rss',
        'is_published_on_hubs',
+4 −0
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ class PodcastController extends BaseController
            'location'                         => $this->request->getPost('location_name') === '' ? null : new Location(
                $this->request->getPost('location_name')
            ),
            'verify_txt'            => $this->request->getPost('verify_txt'),
            'custom_rss_string'     => $this->request->getPost('custom_rss'),
            'is_blocked'            => $this->request->getPost('block') === 'yes',
            'is_completed'          => $this->request->getPost('complete') === 'yes',
@@ -320,6 +321,9 @@ class PodcastController extends BaseController
        $this->podcast->location = $this->request->getPost('location_name') === '' ? null : new Location(
            $this->request->getPost('location_name')
        );
        $this->podcast->verify_txt = $this->request->getPost('verify_txt') === '' ? null : $this->request->getPost(
            'verify_txt'
        );
        $this->podcast->custom_rss_string = $this->request->getPost('custom_rss');
        $this->podcast->new_feed_url = $this->request->getPost('new_feed_url') === '' ? null : $this->request->getPost(
            'new_feed_url'
+3 −0
Original line number Diff line number Diff line
@@ -138,6 +138,9 @@ return [
            'If you need RSS tags that Castopod does not handle, set them here.',
        'custom_rss' => 'Custom RSS tags for the podcast',
        'custom_rss_hint' => 'This will be injected within the ❬channel❭ tag.',
        'verify_txt' => 'Ownership verification TXT',
        'verify_txt_hint' => 'Rather than relying on email, certain third-party services may confirm your podcast ownership by requesting you to embed a verification text within your feed.',
        'verify_txt_helper' => 'This text is injected into a <podcast:txt purpose="verify"> tag.',
        'new_feed_url' => 'New feed URL',
        'new_feed_url_hint' => 'Use this field when you move to another domain or podcast hosting platform. By default, the value is set to the current RSS URL if the podcast is imported.',
        'old_feed_url' => 'Old feed URL',
Loading