Commit 209dfbd1 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix(activitypub): set created_by to null for reblog if no user + update episode oembed data

parent 7aa37d24
Pipeline #1233 passed with stages
in 7 minutes and 56 seconds
......@@ -13,7 +13,7 @@ class Embed extends BaseConfig
* Embeddable player config
* --------------------------------------------------------------------------
*/
public int $width = 600;
public int $width = 485;
public int $height = 144;
public int $height = 112;
}
......@@ -10,10 +10,18 @@ declare(strict_types=1);
namespace Config;
use App\Libraries\NoteObject;
use Modules\Fediverse\Config\Fediverse as FediverseBaseConfig;
class Fediverse extends FediverseBaseConfig
{
/**
* --------------------------------------------------------------------
* ActivityPub Objects
* --------------------------------------------------------------------
*/
public string $noteObject = NoteObject::class;
public function __construct()
{
parent::__construct();
......
......@@ -205,14 +205,16 @@ class EpisodeController extends BaseController
'html' =>
'<iframe src="' .
$this->episode->embed_url .
'" width="100%" height="144" frameborder="0" scrolling="no"></iframe>',
'width' => 600,
'height' => 144,
'thumbnail_url' => $this->episode->cover->large_url,
'" width="100%" height="' . config('Embed')->height . '" frameborder="0" scrolling="no"></iframe>',
'width' => config('Embed')
->width,
'height' => config('Embed')
->height,
'thumbnail_url' => $this->episode->cover->og_url,
'thumbnail_width' => config('Images')
->podcastCoverSizes['large']['width'],
->podcastCoverSizes['og']['width'],
'thumbnail_height' => config('Images')
->podcastCoverSizes['large']['height'],
->podcastCoverSizes['og']['height'],
]);
}
......@@ -227,9 +229,9 @@ class EpisodeController extends BaseController
$oembed->addChild('provider_url', $this->podcast->link);
$oembed->addChild('author_name', $this->podcast->title);
$oembed->addChild('author_url', $this->podcast->link);
$oembed->addChild('thumbnail', $this->episode->cover->large_url);
$oembed->addChild('thumbnail_width', (string) config('Images')->podcastCoverSizes['large']['width']);
$oembed->addChild('thumbnail_height', (string) config('Images')->podcastCoverSizes['large']['height']);
$oembed->addChild('thumbnail', $this->episode->cover->og_url);
$oembed->addChild('thumbnail_width', (string) config('Images')->podcastCoverSizes['og']['width']);
$oembed->addChild('thumbnail_height', (string) config('Images')->podcastCoverSizes['og']['height']);
$oembed->addChild(
'html',
htmlentities(
......
......@@ -24,12 +24,7 @@ class NoteObject extends FediverseNoteObject
if ($post->episode_id) {
$this->content =
'<a href="' .
$post->episode->link .
'" target="_blank" rel="noopener noreferrer">' .
$post->episode->title .
'</a><br/>' .
$post->message_html;
'<a href="' . $post->episode->link . '">' . $post->episode->title . '</a><br/>' . $post->message_html;
}
}
}
......@@ -30,11 +30,11 @@ class Fediverse extends BaseConfig
* Default avatar and cover images
* --------------------------------------------------------------------
*/
public string $defaultAvatarImagePath = 'media/castopod-avatar_fediveration.jpg';
public string $defaultAvatarImagePath = 'media/avatar-default.jpg';
public string $defaultAvatarImageMimetype = 'image/jpeg';
public string $defaultCoverImagePath = 'media/castopod-banner-pine_fediveration.jpg';
public string $defaultCoverImagePath = 'media/banner-default.jpg';
public string $defaultCoverImageMimetype = 'image/jpeg';
......
......@@ -469,11 +469,16 @@ class PostModel extends BaseUuidModel
{
$this->db->transStart();
$userId = null;
if (function_exists('user_id')) {
$userId = user_id();
}
$reblog = new Post([
'actor_id' => $actor->id,
'reblog_of_id' => $post->id,
'published_at' => Time::now(),
'created_by' => user_id(),
'created_by' => $userId,
]);
// add reblog
......
......@@ -20,17 +20,17 @@
</head>
<body class="flex" style="background: <?= $themeData['background'] ?>; color: <?= $themeData['text'] ?>;">
<img src="<?= $episode->cover->thumbnail_url ?>" alt="<?= $episode->title ?>" class="flex-shrink w-36 h-36 aspect-square" loading="lazy" />
<div class="flex flex-col items-start flex-1 min-w-0 px-4 pt-4 h-36">
<img src="<?= $episode->cover->thumbnail_url ?>" alt="<?= $episode->title ?>" class="flex-shrink w-28 h-28 aspect-square" loading="lazy" />
<div class="flex flex-col items-start flex-1 min-w-0 px-4 pt-4 h-28">
<a href="https://castopod.org/" class="absolute top-0 right-0 mt-1 mr-2 text-2xl text-pine-500 hover:opacity-75" title="<?= lang('Common.powered_by', [
'castopod' => 'Castopod',
]) ?>" target="_blank" rel="noopener noreferrer"><?= icon('podcasting/castopod') ?></a>
]) ?>"><?= icon('podcasting/castopod') ?></a>
<div class="flex gap-x-2">
<?= episode_numbering($episode->number, $episode->season_number, 'text-xs font-semibold !no-underline border px-1 border-gray-500', true) ?>
<a href="<?= route_to('podcast-activity', $podcast->handle) ?>" style="color: <?= $themeData['text'] ?>;" class="text-xs truncate opacity-75 hover:opacity-100" target="_blank"><?= $podcast->title ?></a>
<a href="<?= route_to('podcast-activity', $podcast->handle) ?>" style="color: <?= $themeData['text'] ?>;" class="text-xs truncate opacity-75 hover:opacity-100"><?= $podcast->title ?></a>
</div>
<a href="<?= $episode->link ?>" class="flex flex-col items-start text-sm" style="color: <?= $themeData['text'] ?>;" target="_blank">
<h1 class="text-lg font-semibold leading-tight opacity-100 line-clamp-2 hover:opacity-75"><?= $episode->title ?></h1>
<a href="<?= $episode->link ?>" class="flex flex-col items-start text-sm" style="color: <?= $themeData['text'] ?>;">
<h1 class="font-semibold leading-tight opacity-100 line-clamp-2 hover:opacity-75"><?= $episode->title ?></h1>
</a>
<vm-player
id="castopod-vm-player"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment