mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-16 13:07:46 +02:00
fix(op3): move op3 prefix to enclosure url instead of audio proxy
This commit is contained in:
parent
94ceba6081
commit
d580369235
4 changed files with 40 additions and 30 deletions
|
|
@ -4,10 +4,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Analytics\Config;
|
||||
|
||||
use App\Entities\Episode;
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\HTTP\URI;
|
||||
use Modules\Analytics\OP3;
|
||||
|
||||
class Analytics extends BaseConfig
|
||||
{
|
||||
|
|
@ -53,24 +50,4 @@ class Analytics extends BaseConfig
|
|||
];
|
||||
|
||||
public bool $enableOP3 = false;
|
||||
|
||||
/**
|
||||
* get the full audio file url
|
||||
*/
|
||||
public function getAudioUrl(Episode $episode, array $params): string
|
||||
{
|
||||
$audioFileURI = new URI(service('file_manager')->getUrl($episode->audio->file_key));
|
||||
$audioFileURI->setQueryArray($params);
|
||||
|
||||
// Wrap episode url with OP3 if episode is public and OP3 is enabled on this podcast
|
||||
if (! $episode->is_premium && service('settings')->get(
|
||||
'Analytics.enableOP3',
|
||||
'podcast:' . $episode->podcast_id
|
||||
)) {
|
||||
$op3 = new OP3($this->OP3);
|
||||
$audioFileURI = new URI($op3->wrap($audioFileURI, $episode));
|
||||
}
|
||||
|
||||
return (string) $audioFileURI;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue