feat(monetization): add Web Monetization support

This commit is contained in:
Benjamin Bellamy 2020-11-26 18:53:52 +00:00
parent e8771755b7
commit 96a6026f1d
12 changed files with 79 additions and 10 deletions

View File

@ -161,6 +161,7 @@ class Podcast extends BaseController
'publisher' => $this->request->getPost('publisher'), 'publisher' => $this->request->getPost('publisher'),
'type' => $this->request->getPost('type'), 'type' => $this->request->getPost('type'),
'copyright' => $this->request->getPost('copyright'), 'copyright' => $this->request->getPost('copyright'),
'payment_pointer' => $this->request->getPost('payment_pointer'),
'is_blocked' => $this->request->getPost('is_blocked') === 'yes', 'is_blocked' => $this->request->getPost('is_blocked') === 'yes',
'is_completed' => $this->request->getPost('complete') === 'yes', 'is_completed' => $this->request->getPost('complete') === 'yes',
'is_locked' => $this->request->getPost('lock') === 'yes', 'is_locked' => $this->request->getPost('lock') === 'yes',
@ -253,6 +254,9 @@ class Podcast extends BaseController
$this->podcast->owner_email = $this->request->getPost('owner_email'); $this->podcast->owner_email = $this->request->getPost('owner_email');
$this->podcast->type = $this->request->getPost('type'); $this->podcast->type = $this->request->getPost('type');
$this->podcast->copyright = $this->request->getPost('copyright'); $this->podcast->copyright = $this->request->getPost('copyright');
$this->podcast->payment_pointer = $this->request->getPost(
'payment_pointer'
);
$this->podcast->is_blocked = $this->podcast->is_blocked =
$this->request->getPost('is_blocked') === 'yes'; $this->request->getPost('is_blocked') === 'yes';
$this->podcast->is_completed = $this->podcast->is_completed =

View File

@ -117,6 +117,12 @@ class AddPodcasts extends Migration
'The RSS new feed URL if this podcast is moving out, NULL otherwise.', 'The RSS new feed URL if this podcast is moving out, NULL otherwise.',
'null' => true, 'null' => true,
], ],
'payment_pointer' => [
'type' => 'VARCHAR',
'constraint' => 128,
'comment' => 'Wallet address for Web Monetization payments',
'null' => true,
],
'created_by' => [ 'created_by' => [
'type' => 'INT', 'type' => 'INT',
'unsigned' => true, 'unsigned' => true,

View File

@ -96,6 +96,7 @@ class Podcast extends Entity
'is_locked' => 'boolean', 'is_locked' => 'boolean',
'imported_feed_url' => '?string', 'imported_feed_url' => '?string',
'new_feed_url' => '?string', 'new_feed_url' => '?string',
'payment_pointer' => '?string',
'created_by' => 'integer', 'created_by' => 'integer',
'updated_by' => 'integer', 'updated_by' => 'integer',
]; ];

View File

@ -65,6 +65,14 @@ function get_rss_feed($podcast, $serviceName = '')
$itunes_image = $channel->addChild('image', null, $itunes_namespace); $itunes_image = $channel->addChild('image', null, $itunes_namespace);
$itunes_image->addAttribute('href', $podcast->image->original_url); $itunes_image->addAttribute('href', $podcast->image->original_url);
$channel->addChild('language', $podcast->language_code); $channel->addChild('language', $podcast->language_code);
if (!empty($podcast->payment_pointer)) {
$channel->addChild(
'monetization',
$podcast->payment_pointer,
$podcast_namespace
);
}
$channel $channel
->addChild( ->addChild(
'locked', 'locked',

View File

@ -61,6 +61,12 @@ return [
'publisher_hint' => 'publisher_hint' =>
'The group responsible for creating the show. Often refers to the parent company or network of a podcast. This field is sometimes labeled as Author.', 'The group responsible for creating the show. Often refers to the parent company or network of a podcast. This field is sometimes labeled as Author.',
'copyright' => 'Copyright', 'copyright' => 'Copyright',
'monetization_section_title' => 'Monetization',
'monetization_section_subtitle' =>
'Earn money thanks to your audience.',
'payment_pointer' => 'Payment Pointer for Web Monetization',
'payment_pointer_hint' =>
'This is your where you will receive money thanks to Web Monetization',
'status_section_title' => 'Status', 'status_section_title' => 'Status',
'status_section_subtitle' => 'Dead or alive?', 'status_section_subtitle' => 'Dead or alive?',
'block' => 'Podcast should be hidden from all platforms', 'block' => 'Podcast should be hidden from all platforms',

View File

@ -62,6 +62,13 @@ return [
'publisher_hint' => 'publisher_hint' =>
'Le groupe responsable de la création du podcast. Fait souvent référence à la société mère ou au réseau dun podcast. Ce champ est parfois appelé «Auteur».', 'Le groupe responsable de la création du podcast. Fait souvent référence à la société mère ou au réseau dun podcast. Ce champ est parfois appelé «Auteur».',
'copyright' => 'Droit dauteur', 'copyright' => 'Droit dauteur',
'monetization_section_title' => 'Monétisation',
'monetization_section_subtitle' =>
'Gagnez de largent grâce à votre audience.',
'payment_pointer' =>
'Adresse de paiement (Payment Pointer) pour Web Monetization',
'payment_pointer_hint' =>
'Ladresse où vous recevrez de largent grâce à Web Monetization',
'status_section_title' => 'Statut', 'status_section_title' => 'Statut',
'status_section_subtitle' => 'Vivant ou mort?', 'status_section_subtitle' => 'Vivant ou mort?',
'block' => 'Le podcast doit être masqué sur toutes les plateformes', 'block' => 'Le podcast doit être masqué sur toutes les plateformes',

View File

@ -37,6 +37,7 @@ class PodcastModel extends Model
'is_blocked', 'is_blocked',
'is_completed', 'is_completed',
'is_locked', 'is_locked',
'payment_pointer',
'created_by', 'created_by',
'updated_by', 'updated_by',
]; ];

View File

@ -241,6 +241,24 @@
<?= form_section_close() ?> <?= form_section_close() ?>
<?= form_section(
lang('Podcast.form.monetization_section_title'),
lang('Podcast.form.monetization_section_subtitle')
) ?>
<?= form_label(
lang('Podcast.form.payment_pointer'),
'payment_pointer',
[],
lang('Podcast.form.payment_pointer_hint')
) ?>
<?= form_input([
'id' => 'payment_pointer',
'name' => 'payment_pointer',
'class' => 'form-input mb-4',
'value' => old('payment_pointer'),
]) ?>
<?= form_section_close() ?>
<?= form_section( <?= form_section(
lang('Podcast.form.status_section_title'), lang('Podcast.form.status_section_title'),
@ -249,10 +267,7 @@
<?= form_switch( <?= form_switch(
lang('Podcast.form.block'), lang('Podcast.form.block'),
[ ['id' => 'block', 'name' => 'block'],
'id' => 'block',
'name' => 'block',
],
'yes', 'yes',
old('block', false), old('block', false),
'mb-2' 'mb-2'
@ -260,10 +275,7 @@
<?= form_switch( <?= form_switch(
lang('Podcast.form.complete'), lang('Podcast.form.complete'),
[ ['id' => 'complete', 'name' => 'complete'],
'id' => 'complete',
'name' => 'complete',
],
'yes', 'yes',
old('complete', false), old('complete', false),
'mb-2' 'mb-2'
@ -279,7 +291,6 @@
<?= form_section_close() ?> <?= form_section_close() ?>
<?= button( <?= button(
lang('Podcast.form.submit_create'), lang('Podcast.form.submit_create'),
null, null,

View File

@ -251,6 +251,24 @@
<?= form_section_close() ?> <?= form_section_close() ?>
<?= form_section(
lang('Podcast.form.monetization_section_title'),
lang('Podcast.form.monetization_section_subtitle')
) ?>
<?= form_label(
lang('Podcast.form.payment_pointer'),
'payment_pointer',
[],
lang('Podcast.form.payment_pointer_hint')
) ?>
<?= form_input([
'id' => 'payment_pointer',
'name' => 'payment_pointer',
'class' => 'form-input mb-4',
'value' => old('payment_pointer', $podcast->payment_pointer),
]) ?>
<?= form_section_close() ?>
<?= form_section( <?= form_section(
lang('Podcast.form.status_section_title'), lang('Podcast.form.status_section_title'),

View File

@ -7,6 +7,10 @@
<title><?= $episode->title ?></title> <title><?= $episode->title ?></title>
<meta name="description" content="<?= $episode->description ?>"/> <meta name="description" content="<?= $episode->description ?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<?php if (
!empty($podcast->payment_pointer)
): ?> <meta name="monetization" content="<?= $podcast->payment_pointer ?>">
<?php endif; ?>
<link rel="shortcut icon" type="image/png" href="/favicon.ico" /> <link rel="shortcut icon" type="image/png" href="/favicon.ico" />
<link rel="stylesheet" href="/assets/index.css"/> <link rel="stylesheet" href="/assets/index.css"/>
<link rel="canonical" href="<?= current_url() ?>" /> <link rel="canonical" href="<?= current_url() ?>" />

View File

@ -8,6 +8,10 @@
<title><?= $podcast->title ?></title> <title><?= $podcast->title ?></title>
<meta name="description" content="<?= $podcast->description ?>"/> <meta name="description" content="<?= $podcast->description ?>"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<?php if (
!empty($podcast->payment_pointer)
): ?> <meta name="monetization" content="<?= $podcast->payment_pointer ?>">
<?php endif; ?>
<link rel="shortcut icon" type="image/png" href="/favicon.ico" /> <link rel="shortcut icon" type="image/png" href="/favicon.ico" />
<link rel="stylesheet" href="/assets/index.css"/> <link rel="stylesheet" href="/assets/index.css"/>
<link rel="canonical" href="<?= current_season_url() ?>" /> <link rel="canonical" href="<?= current_season_url() ?>" />

View File

@ -1 +0,0 @@
test