mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-23 01:01:20 +00:00

- authenticated pages are not cached - add AnalyticsTrait to register a podcast webpage hit across mutliple controllers - set actor_id as unique in podcasts table - fix issues with preview card not appearing - update codeigniter4-uuid
40 lines
945 B
PHP
40 lines
945 B
PHP
<?php
|
|
|
|
/**
|
|
* @copyright 2020 Podlibre
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
namespace App\Controllers;
|
|
|
|
use Analytics\AnalyticsTrait;
|
|
|
|
class Actor extends \ActivityPub\Controllers\ActorController
|
|
{
|
|
use AnalyticsTrait;
|
|
|
|
public function follow()
|
|
{
|
|
// Prevent analytics hit when authenticated
|
|
if (!can_user_interact()) {
|
|
$this->registerPodcastWebpageHit($this->actor->podcast->id);
|
|
}
|
|
|
|
$cacheName = "page_podcast@{$this->actor->username}_follow";
|
|
if (!($cachedView = cache($cacheName))) {
|
|
helper(['form', 'components', 'svg']);
|
|
$data = [
|
|
'actor' => $this->actor,
|
|
];
|
|
|
|
return view('podcast/follow', $data, [
|
|
'cache' => DECADE,
|
|
'cache_name' => $cacheName,
|
|
]);
|
|
}
|
|
|
|
return $cachedView;
|
|
}
|
|
}
|