Add EnvironmentAwareTrait.
This commit is contained in:
parent
18ad4ad6ef
commit
cbc6a1f4fc
|
@ -4,16 +4,17 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Assets;
|
namespace App\Assets;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity\Station;
|
use App\Entity\Station;
|
||||||
use App\Environment;
|
|
||||||
use GuzzleHttp\Psr7\Uri;
|
use GuzzleHttp\Psr7\Uri;
|
||||||
use Psr\Http\Message\UriInterface;
|
use Psr\Http\Message\UriInterface;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
|
||||||
abstract class AbstractCustomAsset implements CustomAssetInterface
|
abstract class AbstractCustomAsset implements CustomAssetInterface
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected readonly Environment $environment,
|
|
||||||
protected readonly ?Station $station = null
|
protected readonly ?Station $station = null
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,12 @@ enum AssetTypes: string
|
||||||
Environment $environment,
|
Environment $environment,
|
||||||
?Station $station = null
|
?Station $station = null
|
||||||
): CustomAssetInterface {
|
): CustomAssetInterface {
|
||||||
return match ($this) {
|
$instance = match ($this) {
|
||||||
self::AlbumArt => new AlbumArtCustomAsset($environment, $station),
|
self::AlbumArt => new AlbumArtCustomAsset($station),
|
||||||
self::Background => new BackgroundCustomAsset($environment, $station),
|
self::Background => new BackgroundCustomAsset($station),
|
||||||
self::BrowserIcon => new BrowserIconCustomAsset($environment, $station),
|
self::BrowserIcon => new BrowserIconCustomAsset($station),
|
||||||
};
|
};
|
||||||
|
$instance->setEnvironment($environment);
|
||||||
|
return $instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity\Repository\UserRepository;
|
use App\Entity\Repository\UserRepository;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Exception\NotLoggedInException;
|
use App\Exception\NotLoggedInException;
|
||||||
|
@ -11,6 +12,8 @@ use Mezzio\Session\SessionInterface;
|
||||||
|
|
||||||
final class Auth
|
final class Auth
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public const SESSION_IS_LOGIN_COMPLETE_KEY = 'is_login_complete';
|
public const SESSION_IS_LOGIN_COMPLETE_KEY = 'is_login_complete';
|
||||||
public const SESSION_USER_ID_KEY = 'user_id';
|
public const SESSION_USER_ID_KEY = 'user_id';
|
||||||
public const SESSION_MASQUERADE_USER_ID_KEY = 'masquerade_user_id';
|
public const SESSION_MASQUERADE_USER_ID_KEY = 'masquerade_user_id';
|
||||||
|
@ -24,8 +27,7 @@ final class Auth
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly UserRepository $userRepo,
|
private readonly UserRepository $userRepo,
|
||||||
private readonly SessionInterface $session,
|
private readonly SessionInterface $session
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,19 +6,14 @@ namespace App\Console\Command;
|
||||||
|
|
||||||
use App\Console\Command\Traits\PassThruProcess;
|
use App\Console\Command\Traits\PassThruProcess;
|
||||||
use App\Container\EntityManagerAwareTrait;
|
use App\Container\EntityManagerAwareTrait;
|
||||||
use App\Environment;
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
|
||||||
abstract class AbstractDatabaseCommand extends CommandAbstract
|
abstract class AbstractDatabaseCommand extends CommandAbstract
|
||||||
{
|
{
|
||||||
use PassThruProcess;
|
use PassThruProcess;
|
||||||
use EntityManagerAwareTrait;
|
use EntityManagerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
public function __construct(
|
|
||||||
protected Environment $environment
|
|
||||||
) {
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function getDatabaseSettingsAsCliFlags(): array
|
protected function getDatabaseSettingsAsCliFlags(): array
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,6 @@ namespace App\Console\Command\Backup;
|
||||||
|
|
||||||
use App\Console\Command\AbstractDatabaseCommand;
|
use App\Console\Command\AbstractDatabaseCommand;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
@ -26,10 +25,9 @@ use const PATHINFO_EXTENSION;
|
||||||
final class BackupCommand extends AbstractDatabaseCommand
|
final class BackupCommand extends AbstractDatabaseCommand
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Environment $environment,
|
|
||||||
private readonly Entity\Repository\StorageLocationRepository $storageLocationRepo
|
private readonly Entity\Repository\StorageLocationRepository $storageLocationRepo
|
||||||
) {
|
) {
|
||||||
parent::__construct($environment);
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function configure(): void
|
protected function configure(): void
|
||||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Console\Command;
|
namespace App\Console\Command;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Container\LoggerAwareTrait;
|
use App\Container\LoggerAwareTrait;
|
||||||
use App\Environment;
|
|
||||||
use App\Version;
|
use App\Version;
|
||||||
use OpenApi\Annotations\OpenApi;
|
use OpenApi\Annotations\OpenApi;
|
||||||
use OpenApi\Generator;
|
use OpenApi\Generator;
|
||||||
|
@ -22,9 +22,9 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
final class GenerateApiDocsCommand extends CommandAbstract
|
final class GenerateApiDocsCommand extends CommandAbstract
|
||||||
{
|
{
|
||||||
use LoggerAwareTrait;
|
use LoggerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Version $version
|
private readonly Version $version
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
|
@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||||
namespace App\Console\Command\Locale;
|
namespace App\Console\Command\Locale;
|
||||||
|
|
||||||
use App\Console\Command\CommandAbstract;
|
use App\Console\Command\CommandAbstract;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Enums\SupportedLocales;
|
use App\Enums\SupportedLocales;
|
||||||
use App\Environment;
|
|
||||||
use Gettext\Generator\PoGenerator;
|
use Gettext\Generator\PoGenerator;
|
||||||
use Gettext\Loader\PoLoader;
|
use Gettext\Loader\PoLoader;
|
||||||
use Gettext\Scanner\PhpScanner;
|
use Gettext\Scanner\PhpScanner;
|
||||||
|
@ -26,11 +26,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
)]
|
)]
|
||||||
final class GenerateCommand extends CommandAbstract
|
final class GenerateCommand extends CommandAbstract
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||||
namespace App\Console\Command\Locale;
|
namespace App\Console\Command\Locale;
|
||||||
|
|
||||||
use App\Console\Command\CommandAbstract;
|
use App\Console\Command\CommandAbstract;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Enums\SupportedLocales;
|
use App\Enums\SupportedLocales;
|
||||||
use App\Environment;
|
|
||||||
use Gettext\Generator\MoGenerator;
|
use Gettext\Generator\MoGenerator;
|
||||||
use Gettext\Loader\PoLoader;
|
use Gettext\Loader\PoLoader;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
|
@ -21,11 +21,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
)]
|
)]
|
||||||
final class ImportCommand extends CommandAbstract
|
final class ImportCommand extends CommandAbstract
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,9 +6,9 @@ namespace App\Console\Command\MessageQueue;
|
||||||
|
|
||||||
use App\CallableEventDispatcherInterface;
|
use App\CallableEventDispatcherInterface;
|
||||||
use App\Console\Command\CommandAbstract;
|
use App\Console\Command\CommandAbstract;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Container\LoggerAwareTrait;
|
use App\Container\LoggerAwareTrait;
|
||||||
use App\Doctrine\Messenger\ClearEntityManagerSubscriber;
|
use App\Doctrine\Messenger\ClearEntityManagerSubscriber;
|
||||||
use App\Environment;
|
|
||||||
use App\MessageQueue\LogWorkerExceptionSubscriber;
|
use App\MessageQueue\LogWorkerExceptionSubscriber;
|
||||||
use App\MessageQueue\QueueManagerInterface;
|
use App\MessageQueue\QueueManagerInterface;
|
||||||
use App\MessageQueue\ResetArrayCacheSubscriber;
|
use App\MessageQueue\ResetArrayCacheSubscriber;
|
||||||
|
@ -33,12 +33,12 @@ use Throwable;
|
||||||
final class ProcessCommand extends CommandAbstract
|
final class ProcessCommand extends CommandAbstract
|
||||||
{
|
{
|
||||||
use LoggerAwareTrait;
|
use LoggerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly MessageBus $messageBus,
|
private readonly MessageBus $messageBus,
|
||||||
private readonly CallableEventDispatcherInterface $eventDispatcher,
|
private readonly CallableEventDispatcherInterface $eventDispatcher,
|
||||||
private readonly QueueManagerInterface $queueManager,
|
private readonly QueueManagerInterface $queueManager,
|
||||||
private readonly Environment $environment,
|
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Console\Command;
|
namespace App\Console\Command;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Environment;
|
use App\Environment;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
@ -16,11 +17,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
)]
|
)]
|
||||||
final class MigrateConfigCommand extends CommandAbstract
|
final class MigrateConfigCommand extends CommandAbstract
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment,
|
|
||||||
) {
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Console\Command;
|
namespace App\Console\Command;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Service\AzuraCastCentral;
|
use App\Service\AzuraCastCentral;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
@ -19,8 +19,9 @@ use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
)]
|
)]
|
||||||
final class SetupCommand extends CommandAbstract
|
final class SetupCommand extends CommandAbstract
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
||||||
private readonly AzuraCastCentral $acCentral,
|
private readonly AzuraCastCentral $acCentral,
|
||||||
private readonly Entity\Repository\StorageLocationRepository $storageLocationRepo
|
private readonly Entity\Repository\StorageLocationRepository $storageLocationRepo
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace App\Console\Command;
|
||||||
|
|
||||||
use App\Container\ContainerAwareTrait;
|
use App\Container\ContainerAwareTrait;
|
||||||
use App\Container\EntityManagerAwareTrait;
|
use App\Container\EntityManagerAwareTrait;
|
||||||
use App\Environment;
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
|
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
|
||||||
use Doctrine\Common\DataFixtures\Loader;
|
use Doctrine\Common\DataFixtures\Loader;
|
||||||
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
|
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
|
||||||
|
@ -25,12 +25,7 @@ final class SetupFixturesCommand extends CommandAbstract
|
||||||
{
|
{
|
||||||
use ContainerAwareTrait;
|
use ContainerAwareTrait;
|
||||||
use EntityManagerAwareTrait;
|
use EntityManagerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
public function __construct(
|
|
||||||
private readonly Environment $environment,
|
|
||||||
) {
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||||
namespace App\Console\Command\Sync;
|
namespace App\Console\Command\Sync;
|
||||||
|
|
||||||
use App\Console\Command\CommandAbstract;
|
use App\Console\Command\CommandAbstract;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Container\LoggerAwareTrait;
|
use App\Container\LoggerAwareTrait;
|
||||||
use App\Environment;
|
|
||||||
use App\Lock\LockFactory;
|
use App\Lock\LockFactory;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
use Symfony\Component\Lock\Lock;
|
use Symfony\Component\Lock\Lock;
|
||||||
|
@ -17,12 +17,12 @@ use function random_int;
|
||||||
abstract class AbstractSyncCommand extends CommandAbstract
|
abstract class AbstractSyncCommand extends CommandAbstract
|
||||||
{
|
{
|
||||||
use LoggerAwareTrait;
|
use LoggerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
protected array $processes = [];
|
protected array $processes = [];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected LockFactory $lockFactory,
|
protected LockFactory $lockFactory,
|
||||||
protected Environment $environment,
|
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ namespace App\Console\Command\Sync;
|
||||||
use App\Cache\NowPlayingCache;
|
use App\Cache\NowPlayingCache;
|
||||||
use App\Container\EntityManagerAwareTrait;
|
use App\Container\EntityManagerAwareTrait;
|
||||||
use App\Entity\Repository\SettingsRepository;
|
use App\Entity\Repository\SettingsRepository;
|
||||||
use App\Environment;
|
|
||||||
use App\Lock\LockFactory;
|
use App\Lock\LockFactory;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
@ -31,9 +30,8 @@ final class NowPlayingCommand extends AbstractSyncCommand
|
||||||
private readonly SettingsRepository $settingsRepo,
|
private readonly SettingsRepository $settingsRepo,
|
||||||
private readonly NowPlayingCache $nowPlayingCache,
|
private readonly NowPlayingCache $nowPlayingCache,
|
||||||
LockFactory $lockFactory,
|
LockFactory $lockFactory,
|
||||||
Environment $environment
|
|
||||||
) {
|
) {
|
||||||
parent::__construct($lockFactory, $environment);
|
parent::__construct($lockFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function configure(): void
|
protected function configure(): void
|
||||||
|
|
|
@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||||
namespace App\Console\Command\Sync;
|
namespace App\Console\Command\Sync;
|
||||||
|
|
||||||
use App\Entity\Repository\SettingsRepository;
|
use App\Entity\Repository\SettingsRepository;
|
||||||
use App\Environment;
|
|
||||||
use App\Event\GetSyncTasks;
|
use App\Event\GetSyncTasks;
|
||||||
use App\Lock\LockFactory;
|
use App\Lock\LockFactory;
|
||||||
use App\Sync\Task\AbstractTask;
|
use App\Sync\Task\AbstractTask;
|
||||||
|
@ -27,12 +26,11 @@ use function usleep;
|
||||||
final class RunnerCommand extends AbstractSyncCommand
|
final class RunnerCommand extends AbstractSyncCommand
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
LockFactory $lockFactory,
|
|
||||||
Environment $environment,
|
|
||||||
private readonly EventDispatcherInterface $dispatcher,
|
private readonly EventDispatcherInterface $dispatcher,
|
||||||
private readonly SettingsRepository $settingsRepo,
|
private readonly SettingsRepository $settingsRepo,
|
||||||
|
LockFactory $lockFactory
|
||||||
) {
|
) {
|
||||||
parent::__construct($lockFactory, $environment);
|
parent::__construct($lockFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Container;
|
||||||
|
|
||||||
|
use App\Environment;
|
||||||
|
use DI\Attribute\Inject;
|
||||||
|
|
||||||
|
trait EnvironmentAwareTrait
|
||||||
|
{
|
||||||
|
protected Environment $environment;
|
||||||
|
|
||||||
|
#[Inject]
|
||||||
|
public function setEnvironment(Environment $environment): void
|
||||||
|
{
|
||||||
|
$this->environment = $environment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEnvironment(): Environment
|
||||||
|
{
|
||||||
|
return $this->environment;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,16 +4,17 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Controller\Admin;
|
namespace App\Controller\Admin;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
final class BackupsAction
|
final class BackupsAction
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Entity\Repository\StorageLocationRepository $storageLocationRepo
|
private readonly Entity\Repository\StorageLocationRepository $storageLocationRepo
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
namespace App\Controller\Admin;
|
namespace App\Controller\Admin;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity\Repository\SettingsRepository;
|
use App\Entity\Repository\SettingsRepository;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use App\Version;
|
use App\Version;
|
||||||
|
@ -11,9 +11,10 @@ use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
final class UpdatesAction
|
final class UpdatesAction
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly SettingsRepository $settingsRepo,
|
private readonly SettingsRepository $settingsRepo,
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Version $version
|
private readonly Version $version
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,18 +5,15 @@ declare(strict_types=1);
|
||||||
namespace App\Controller\Api\Admin\CustomAssets;
|
namespace App\Controller\Api\Admin\CustomAssets;
|
||||||
|
|
||||||
use App\Assets\AssetTypes;
|
use App\Assets\AssetTypes;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
final class DeleteCustomAssetAction
|
final class DeleteCustomAssetAction
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __invoke(
|
public function __invoke(
|
||||||
ServerRequest $request,
|
ServerRequest $request,
|
||||||
|
|
|
@ -5,17 +5,14 @@ declare(strict_types=1);
|
||||||
namespace App\Controller\Api\Admin\CustomAssets;
|
namespace App\Controller\Api\Admin\CustomAssets;
|
||||||
|
|
||||||
use App\Assets\AssetTypes;
|
use App\Assets\AssetTypes;
|
||||||
use App\Environment;
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
final class GetCustomAssetAction
|
final class GetCustomAssetAction
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __invoke(
|
public function __invoke(
|
||||||
ServerRequest $request,
|
ServerRequest $request,
|
||||||
|
|
|
@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||||
namespace App\Controller\Api\Admin\CustomAssets;
|
namespace App\Controller\Api\Admin\CustomAssets;
|
||||||
|
|
||||||
use App\Assets\AssetTypes;
|
use App\Assets\AssetTypes;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use App\Media\AlbumArt;
|
use App\Media\AlbumArt;
|
||||||
|
@ -15,10 +15,7 @@ use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
final class PostCustomAssetAction
|
final class PostCustomAssetAction
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __invoke(
|
public function __invoke(
|
||||||
ServerRequest $request,
|
ServerRequest $request,
|
||||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Controller\Api\Admin;
|
namespace App\Controller\Api\Admin;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Controller\Api\Traits\HasLogViewer;
|
use App\Controller\Api\Traits\HasLogViewer;
|
||||||
use App\Environment;
|
|
||||||
use App\Exception;
|
use App\Exception;
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
|
@ -15,9 +15,9 @@ use Psr\Http\Message\ResponseInterface;
|
||||||
final class LogsAction
|
final class LogsAction
|
||||||
{
|
{
|
||||||
use HasLogViewer;
|
use HasLogViewer;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly ServiceControl $serviceControl,
|
private readonly ServiceControl $serviceControl,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Controller\Api\Admin;
|
namespace App\Controller\Api\Admin;
|
||||||
|
|
||||||
use App\Environment;
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use App\OpenApi;
|
use App\OpenApi;
|
||||||
|
@ -37,10 +37,7 @@ use Psr\Http\Message\ResponseInterface;
|
||||||
]
|
]
|
||||||
final class ServerStatsAction
|
final class ServerStatsAction
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __invoke(
|
public function __invoke(
|
||||||
ServerRequest $request,
|
ServerRequest $request,
|
||||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Controller\Api\Admin\Shoutcast;
|
namespace App\Controller\Api\Admin\Shoutcast;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use App\Service\Flow;
|
use App\Service\Flow;
|
||||||
|
@ -15,10 +15,7 @@ use Symfony\Component\Process\Process;
|
||||||
|
|
||||||
final class PostAction
|
final class PostAction
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __invoke(
|
public function __invoke(
|
||||||
ServerRequest $request,
|
ServerRequest $request,
|
||||||
|
|
|
@ -4,21 +4,20 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Controller\Api\Admin\Stations;
|
namespace App\Controller\Api\Admin\Stations;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Controller\Api\Admin\StationsController;
|
use App\Controller\Api\Admin\StationsController;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use App\Radio\Configuration;
|
|
||||||
use DeepCopy;
|
use DeepCopy;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Symfony\Component\Serializer\Serializer;
|
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
final class CloneAction extends StationsController
|
final class CloneAction extends StationsController
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public const CLONE_MEDIA_STORAGE = 'media_storage';
|
public const CLONE_MEDIA_STORAGE = 'media_storage';
|
||||||
public const CLONE_RECORDINGS_STORAGE = 'recordings_storage';
|
public const CLONE_RECORDINGS_STORAGE = 'recordings_storage';
|
||||||
public const CLONE_PODCASTS_STORAGE = 'podcasts_storage';
|
public const CLONE_PODCASTS_STORAGE = 'podcasts_storage';
|
||||||
|
@ -30,25 +29,6 @@ final class CloneAction extends StationsController
|
||||||
public const CLONE_PERMISSIONS = 'permissions';
|
public const CLONE_PERMISSIONS = 'permissions';
|
||||||
public const CLONE_WEBHOOKS = 'webhooks';
|
public const CLONE_WEBHOOKS = 'webhooks';
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
Entity\Repository\StationRepository $stationRepo,
|
|
||||||
Entity\Repository\StorageLocationRepository $storageLocationRepo,
|
|
||||||
Entity\Repository\StationQueueRepository $queueRepo,
|
|
||||||
Configuration $configuration,
|
|
||||||
Serializer $serializer,
|
|
||||||
ValidatorInterface $validator,
|
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
parent::__construct(
|
|
||||||
$stationRepo,
|
|
||||||
$storageLocationRepo,
|
|
||||||
$queueRepo,
|
|
||||||
$configuration,
|
|
||||||
$serializer,
|
|
||||||
$validator
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __invoke(
|
public function __invoke(
|
||||||
ServerRequest $request,
|
ServerRequest $request,
|
||||||
Response $response,
|
Response $response,
|
||||||
|
|
|
@ -5,18 +5,15 @@ declare(strict_types=1);
|
||||||
namespace App\Controller\Api\Stations\CustomAssets;
|
namespace App\Controller\Api\Stations\CustomAssets;
|
||||||
|
|
||||||
use App\Assets\AssetTypes;
|
use App\Assets\AssetTypes;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
final class DeleteCustomAssetAction
|
final class DeleteCustomAssetAction
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __invoke(
|
public function __invoke(
|
||||||
ServerRequest $request,
|
ServerRequest $request,
|
||||||
|
|
|
@ -5,17 +5,14 @@ declare(strict_types=1);
|
||||||
namespace App\Controller\Api\Stations\CustomAssets;
|
namespace App\Controller\Api\Stations\CustomAssets;
|
||||||
|
|
||||||
use App\Assets\AssetTypes;
|
use App\Assets\AssetTypes;
|
||||||
use App\Environment;
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
final class GetCustomAssetAction
|
final class GetCustomAssetAction
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __invoke(
|
public function __invoke(
|
||||||
ServerRequest $request,
|
ServerRequest $request,
|
||||||
|
|
|
@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||||
namespace App\Controller\Api\Stations\CustomAssets;
|
namespace App\Controller\Api\Stations\CustomAssets;
|
||||||
|
|
||||||
use App\Assets\AssetTypes;
|
use App\Assets\AssetTypes;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use App\Media\AlbumArt;
|
use App\Media\AlbumArt;
|
||||||
|
@ -15,10 +15,7 @@ use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
final class PostCustomAssetAction
|
final class PostCustomAssetAction
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __invoke(
|
public function __invoke(
|
||||||
ServerRequest $request,
|
ServerRequest $request,
|
||||||
|
|
|
@ -6,10 +6,10 @@ namespace App\Controller\Api\Stations;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
use App\Container\EntityManagerAwareTrait;
|
use App\Container\EntityManagerAwareTrait;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Controller\Api\Traits\AcceptsDateRange;
|
use App\Controller\Api\Traits\AcceptsDateRange;
|
||||||
use App\Doctrine\ReadOnlyBatchIteratorAggregate;
|
use App\Doctrine\ReadOnlyBatchIteratorAggregate;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use App\OpenApi;
|
use App\OpenApi;
|
||||||
|
@ -63,10 +63,10 @@ final class HistoryController
|
||||||
{
|
{
|
||||||
use AcceptsDateRange;
|
use AcceptsDateRange;
|
||||||
use EntityManagerAwareTrait;
|
use EntityManagerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Entity\ApiGenerator\SongHistoryApiGenerator $songHistoryApiGenerator,
|
private readonly Entity\ApiGenerator\SongHistoryApiGenerator $songHistoryApiGenerator
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||||
namespace App\Controller\Frontend;
|
namespace App\Controller\Frontend;
|
||||||
|
|
||||||
use App\Container\EntityManagerAwareTrait;
|
use App\Container\EntityManagerAwareTrait;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Exception\NotLoggedInException;
|
use App\Exception\NotLoggedInException;
|
||||||
use App\Exception\ValidationException;
|
use App\Exception\ValidationException;
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
|
@ -21,10 +21,10 @@ use Throwable;
|
||||||
final class SetupController
|
final class SetupController
|
||||||
{
|
{
|
||||||
use EntityManagerAwareTrait;
|
use EntityManagerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Entity\Repository\RolePermissionRepository $permissionRepo,
|
private readonly Entity\Repository\RolePermissionRepository $permissionRepo,
|
||||||
private readonly ValidatorInterface $validator,
|
private readonly ValidatorInterface $validator,
|
||||||
private readonly StationFormComponent $stationFormComponent,
|
private readonly StationFormComponent $stationFormComponent,
|
||||||
|
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Controller\Stations;
|
namespace App\Controller\Stations;
|
||||||
|
|
||||||
use App\Environment;
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use App\Service\AzuraCastCentral;
|
use App\Service\AzuraCastCentral;
|
||||||
|
@ -12,8 +12,9 @@ use Psr\Http\Message\ResponseInterface;
|
||||||
|
|
||||||
final class SftpUsersAction
|
final class SftpUsersAction
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly AzuraCastCentral $acCentral
|
private readonly AzuraCastCentral $acCentral
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use App\Assets\BackgroundCustomAsset;
|
use App\Assets\AssetTypes;
|
||||||
use App\Assets\BrowserIconCustomAsset;
|
use App\Assets\BrowserIconCustomAsset;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Enums\SupportedLocales;
|
use App\Enums\SupportedLocales;
|
||||||
use App\Enums\SupportedThemes;
|
use App\Enums\SupportedThemes;
|
||||||
|
@ -16,6 +17,7 @@ use Psr\Http\Message\ServerRequestInterface;
|
||||||
final class Customization
|
final class Customization
|
||||||
{
|
{
|
||||||
use RequestAwareTrait;
|
use RequestAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
private ?Entity\User $user;
|
private ?Entity\User $user;
|
||||||
|
|
||||||
|
@ -30,7 +32,6 @@ final class Customization
|
||||||
private string $instanceName;
|
private string $instanceName;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Environment $environment,
|
|
||||||
Entity\Repository\SettingsRepository $settingsRepo
|
Entity\Repository\SettingsRepository $settingsRepo
|
||||||
) {
|
) {
|
||||||
$this->settings = $settingsRepo->readSettings();
|
$this->settings = $settingsRepo->readSettings();
|
||||||
|
@ -121,7 +122,7 @@ final class Customization
|
||||||
{
|
{
|
||||||
$publicCss = $this->settings->getPublicCustomCss() ?? '';
|
$publicCss = $this->settings->getPublicCustomCss() ?? '';
|
||||||
|
|
||||||
$background = new BackgroundCustomAsset($this->environment);
|
$background = AssetTypes::Background->createObject($this->environment);
|
||||||
if ($background->isUploaded()) {
|
if ($background->isUploaded()) {
|
||||||
$backgroundUrl = $background->getUrl();
|
$backgroundUrl = $background->getUrl();
|
||||||
|
|
||||||
|
@ -139,7 +140,8 @@ final class Customization
|
||||||
{
|
{
|
||||||
$publicCss = $station->getBrandingConfig()->getPublicCustomCss() ?? '';
|
$publicCss = $station->getBrandingConfig()->getPublicCustomCss() ?? '';
|
||||||
|
|
||||||
$background = new BackgroundCustomAsset($this->environment, $station);
|
$background = AssetTypes::Background->createObject($this->environment, $station);
|
||||||
|
|
||||||
if ($background->isUploaded()) {
|
if ($background->isUploaded()) {
|
||||||
$backgroundUrl = $background->getUrl();
|
$backgroundUrl = $background->getUrl();
|
||||||
|
|
||||||
|
@ -176,7 +178,10 @@ final class Customization
|
||||||
|
|
||||||
public function getBrowserIconUrl(int $size = 256): string
|
public function getBrowserIconUrl(int $size = 256): string
|
||||||
{
|
{
|
||||||
return (new BrowserIconCustomAsset($this->environment))->getUrlForSize($size);
|
/** @var BrowserIconCustomAsset $browserIcon */
|
||||||
|
$browserIcon = AssetTypes::BrowserIcon->createObject($this->environment);
|
||||||
|
|
||||||
|
return $browserIcon->getUrlForSize($size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,11 +4,11 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity\Repository;
|
namespace App\Entity\Repository;
|
||||||
|
|
||||||
use App\Assets\AlbumArtCustomAsset;
|
use App\Assets\AssetTypes;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Doctrine\ReloadableEntityManagerInterface;
|
use App\Doctrine\ReloadableEntityManagerInterface;
|
||||||
use App\Doctrine\Repository;
|
use App\Doctrine\Repository;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Flysystem\ExtendedFilesystemInterface;
|
use App\Flysystem\ExtendedFilesystemInterface;
|
||||||
use App\Flysystem\StationFilesystems;
|
use App\Flysystem\StationFilesystems;
|
||||||
use App\Radio\Enums\StreamFormats;
|
use App\Radio\Enums\StreamFormats;
|
||||||
|
@ -21,10 +21,11 @@ use Psr\Http\Message\UriInterface;
|
||||||
*/
|
*/
|
||||||
final class StationRepository extends Repository
|
final class StationRepository extends Repository
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ReloadableEntityManagerInterface $em,
|
ReloadableEntityManagerInterface $em,
|
||||||
private readonly SettingsRepository $settingsRepo,
|
private readonly SettingsRepository $settingsRepo,
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
) {
|
||||||
parent::__construct($em);
|
parent::__construct($em);
|
||||||
}
|
}
|
||||||
|
@ -188,7 +189,7 @@ final class StationRepository extends Repository
|
||||||
public function getDefaultAlbumArtUrl(?Entity\Station $station = null): UriInterface
|
public function getDefaultAlbumArtUrl(?Entity\Station $station = null): UriInterface
|
||||||
{
|
{
|
||||||
if (null !== $station) {
|
if (null !== $station) {
|
||||||
$stationAlbumArt = new AlbumArtCustomAsset($this->environment, $station);
|
$stationAlbumArt = AssetTypes::AlbumArt->createObject($this->environment, $station);
|
||||||
if ($stationAlbumArt->isUploaded()) {
|
if ($stationAlbumArt->isUploaded()) {
|
||||||
return $stationAlbumArt->getUri();
|
return $stationAlbumArt->getUri();
|
||||||
}
|
}
|
||||||
|
@ -200,7 +201,7 @@ final class StationRepository extends Repository
|
||||||
}
|
}
|
||||||
|
|
||||||
$customUrl = $this->settingsRepo->readSettings()->getDefaultAlbumArtUrlAsUri();
|
$customUrl = $this->settingsRepo->readSettings()->getDefaultAlbumArtUrlAsUri();
|
||||||
return $customUrl ?? (new AlbumArtCustomAsset($this->environment))->getUri();
|
return $customUrl ?? AssetTypes::AlbumArt->createObject($this->environment)->getUri();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setFallback(
|
public function setFallback(
|
||||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity\StorageLocationAdapter;
|
namespace App\Entity\StorageLocationAdapter;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity\Enums\StorageLocationAdapters;
|
use App\Entity\Enums\StorageLocationAdapters;
|
||||||
use App\Environment;
|
|
||||||
use App\Flysystem\Adapter\LocalAdapterInterface;
|
use App\Flysystem\Adapter\LocalAdapterInterface;
|
||||||
use App\Flysystem\Adapter\LocalFilesystemAdapter;
|
use App\Flysystem\Adapter\LocalFilesystemAdapter;
|
||||||
use App\Flysystem\ExtendedFilesystemInterface;
|
use App\Flysystem\ExtendedFilesystemInterface;
|
||||||
|
@ -14,10 +14,7 @@ use Symfony\Component\Filesystem\Path;
|
||||||
|
|
||||||
final class LocalStorageLocationAdapter extends AbstractStorageLocationLocationAdapter
|
final class LocalStorageLocationAdapter extends AbstractStorageLocationLocationAdapter
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getType(): StorageLocationAdapters
|
public function getType(): StorageLocationAdapters
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Http;
|
namespace App\Http;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Enums\SupportedLocales;
|
use App\Enums\SupportedLocales;
|
||||||
use App\Environment;
|
|
||||||
use App\Exception;
|
use App\Exception;
|
||||||
use App\Exception\NotLoggedInException;
|
use App\Exception\NotLoggedInException;
|
||||||
use App\Exception\PermissionDeniedException;
|
use App\Exception\PermissionDeniedException;
|
||||||
|
@ -26,6 +26,8 @@ use Whoops\Run;
|
||||||
|
|
||||||
final class ErrorHandler extends \Slim\Handlers\ErrorHandler
|
final class ErrorHandler extends \Slim\Handlers\ErrorHandler
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
private bool $returnJson = false;
|
private bool $returnJson = false;
|
||||||
|
|
||||||
private bool $showDetailed = false;
|
private bool $showDetailed = false;
|
||||||
|
@ -36,7 +38,6 @@ final class ErrorHandler extends \Slim\Handlers\ErrorHandler
|
||||||
private readonly View $view,
|
private readonly View $view,
|
||||||
private readonly Router $router,
|
private readonly Router $router,
|
||||||
private readonly InjectSession $injectSession,
|
private readonly InjectSession $injectSession,
|
||||||
private readonly Environment $environment,
|
|
||||||
App $app,
|
App $app,
|
||||||
Logger $logger,
|
Logger $logger,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Installer\Command;
|
namespace App\Installer\Command;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Enums\SupportedLocales;
|
use App\Enums\SupportedLocales;
|
||||||
use App\Environment;
|
use App\Environment;
|
||||||
use App\Installer\EnvFiles\AbstractEnvFile;
|
use App\Installer\EnvFiles\AbstractEnvFile;
|
||||||
|
@ -26,13 +27,9 @@ use Symfony\Component\Yaml\Yaml;
|
||||||
)]
|
)]
|
||||||
final class InstallCommand extends Command
|
final class InstallCommand extends Command
|
||||||
{
|
{
|
||||||
public const DEFAULT_BASE_DIRECTORY = '/installer';
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public const DEFAULT_BASE_DIRECTORY = '/installer';
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function configure(): void
|
protected function configure(): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,9 +5,9 @@ declare(strict_types=1);
|
||||||
namespace App\Middleware\Auth;
|
namespace App\Middleware\Auth;
|
||||||
|
|
||||||
use App\Acl;
|
use App\Acl;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Customization;
|
use App\Customization;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
@ -16,9 +16,10 @@ use Psr\Http\Server\RequestHandlerInterface;
|
||||||
|
|
||||||
abstract class AbstractAuth implements MiddlewareInterface
|
abstract class AbstractAuth implements MiddlewareInterface
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected readonly Entity\Repository\UserRepository $userRepo,
|
protected readonly Entity\Repository\UserRepository $userRepo,
|
||||||
protected readonly Environment $environment,
|
|
||||||
protected readonly Acl $acl,
|
protected readonly Acl $acl,
|
||||||
protected readonly Customization $customization
|
protected readonly Customization $customization
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -8,7 +8,6 @@ use App\Acl;
|
||||||
use App\Auth;
|
use App\Auth;
|
||||||
use App\Customization;
|
use App\Customization;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Exception\CsrfValidationException;
|
use App\Exception\CsrfValidationException;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use App\Security\SplitToken;
|
use App\Security\SplitToken;
|
||||||
|
@ -24,11 +23,10 @@ final class ApiAuth extends AbstractAuth
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected Entity\Repository\ApiKeyRepository $apiKeyRepo,
|
protected Entity\Repository\ApiKeyRepository $apiKeyRepo,
|
||||||
Entity\Repository\UserRepository $userRepo,
|
Entity\Repository\UserRepository $userRepo,
|
||||||
Environment $environment,
|
|
||||||
Acl $acl,
|
Acl $acl,
|
||||||
Customization $customization
|
Customization $customization
|
||||||
) {
|
) {
|
||||||
parent::__construct($userRepo, $environment, $acl, $customization);
|
parent::__construct($userRepo, $acl, $customization);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||||
|
@ -56,8 +54,8 @@ final class ApiAuth extends AbstractAuth
|
||||||
$auth = new Auth(
|
$auth = new Auth(
|
||||||
userRepo: $this->userRepo,
|
userRepo: $this->userRepo,
|
||||||
session: $request->getAttribute(ServerRequest::ATTR_SESSION),
|
session: $request->getAttribute(ServerRequest::ATTR_SESSION),
|
||||||
environment: $this->environment,
|
|
||||||
);
|
);
|
||||||
|
$auth->setEnvironment($this->environment);
|
||||||
|
|
||||||
if ($auth->isLoggedIn()) {
|
if ($auth->isLoggedIn()) {
|
||||||
$user = $auth->getLoggedInUser();
|
$user = $auth->getLoggedInUser();
|
||||||
|
|
|
@ -18,8 +18,9 @@ final class StandardAuth extends AbstractAuth
|
||||||
$auth = new Auth(
|
$auth = new Auth(
|
||||||
userRepo: $this->userRepo,
|
userRepo: $this->userRepo,
|
||||||
session: $request->getAttribute(ServerRequest::ATTR_SESSION),
|
session: $request->getAttribute(ServerRequest::ATTR_SESSION),
|
||||||
environment: $this->environment,
|
|
||||||
);
|
);
|
||||||
|
$auth->setEnvironment($this->environment);
|
||||||
|
|
||||||
$user = ($auth->isLoggedIn()) ? $auth->getLoggedInUser() : null;
|
$user = ($auth->isLoggedIn()) ? $auth->getLoggedInUser() : null;
|
||||||
|
|
||||||
$request = $request
|
$request = $request
|
||||||
|
|
|
@ -6,9 +6,9 @@ namespace App\Middleware;
|
||||||
|
|
||||||
use App\Acl;
|
use App\Acl;
|
||||||
use App\Auth;
|
use App\Auth;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Customization;
|
use App\Customization;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
@ -20,9 +20,10 @@ use Psr\Http\Server\RequestHandlerInterface;
|
||||||
*/
|
*/
|
||||||
final class GetCurrentUser implements MiddlewareInterface
|
final class GetCurrentUser implements MiddlewareInterface
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Entity\Repository\UserRepository $userRepo,
|
private readonly Entity\Repository\UserRepository $userRepo,
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Acl $acl,
|
private readonly Acl $acl,
|
||||||
private readonly Customization $customization
|
private readonly Customization $customization
|
||||||
) {
|
) {
|
||||||
|
@ -34,8 +35,9 @@ final class GetCurrentUser implements MiddlewareInterface
|
||||||
$auth = new Auth(
|
$auth = new Auth(
|
||||||
userRepo: $this->userRepo,
|
userRepo: $this->userRepo,
|
||||||
session: $request->getAttribute(ServerRequest::ATTR_SESSION),
|
session: $request->getAttribute(ServerRequest::ATTR_SESSION),
|
||||||
environment: $this->environment,
|
|
||||||
);
|
);
|
||||||
|
$auth->setEnvironment($this->environment);
|
||||||
|
|
||||||
$user = ($auth->isLoggedIn()) ? $auth->getLoggedInUser() : null;
|
$user = ($auth->isLoggedIn()) ? $auth->getLoggedInUser() : null;
|
||||||
|
|
||||||
$request = $request
|
$request = $request
|
||||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Middleware\Module;
|
namespace App\Middleware\Module;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\Response;
|
use App\Http\Response;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use App\Utilities\Urls;
|
use App\Utilities\Urls;
|
||||||
|
@ -21,9 +21,10 @@ use Symfony\Component\VarDumper\VarDumper;
|
||||||
*/
|
*/
|
||||||
final class Api
|
final class Api
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
private readonly Entity\Repository\SettingsRepository $settingsRepo
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Middleware;
|
namespace App\Middleware;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Doctrine\DecoratedEntityManager;
|
use App\Doctrine\DecoratedEntityManager;
|
||||||
use App\Environment;
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Psr\Http\Server\MiddlewareInterface;
|
use Psr\Http\Server\MiddlewareInterface;
|
||||||
|
@ -13,9 +13,10 @@ use Psr\Http\Server\RequestHandlerInterface;
|
||||||
|
|
||||||
final class ReopenEntityManagerMiddleware implements MiddlewareInterface
|
final class ReopenEntityManagerMiddleware implements MiddlewareInterface
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly DecoratedEntityManager $em,
|
private readonly DecoratedEntityManager $em,
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,18 +4,15 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Notification\Check;
|
namespace App\Notification\Check;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity\Api\Notification;
|
use App\Entity\Api\Notification;
|
||||||
use App\Enums\GlobalPermissions;
|
use App\Enums\GlobalPermissions;
|
||||||
use App\Environment;
|
|
||||||
use App\Event\GetNotifications;
|
use App\Event\GetNotifications;
|
||||||
use App\Session\FlashLevels;
|
use App\Session\FlashLevels;
|
||||||
|
|
||||||
final class ProfilerAdvisorCheck
|
final class ProfilerAdvisorCheck
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __invoke(GetNotifications $event): void
|
public function __invoke(GetNotifications $event): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,17 +4,18 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Notification\Check;
|
namespace App\Notification\Check;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Enums\GlobalPermissions;
|
use App\Enums\GlobalPermissions;
|
||||||
use App\Environment;
|
|
||||||
use App\Event\GetNotifications;
|
use App\Event\GetNotifications;
|
||||||
use App\Session\FlashLevels;
|
use App\Session\FlashLevels;
|
||||||
use Carbon\CarbonImmutable;
|
use Carbon\CarbonImmutable;
|
||||||
|
|
||||||
final class RecentBackupCheck
|
final class RecentBackupCheck
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Entity\Repository\SettingsRepository $settingsRepo
|
private readonly Entity\Repository\SettingsRepository $settingsRepo
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ declare(strict_types=1);
|
||||||
namespace App\Radio;
|
namespace App\Radio;
|
||||||
|
|
||||||
use App\Container\EntityManagerAwareTrait;
|
use App\Container\EntityManagerAwareTrait;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Container\LoggerAwareTrait;
|
use App\Container\LoggerAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Exception\Supervisor\AlreadyRunningException;
|
use App\Exception\Supervisor\AlreadyRunningException;
|
||||||
use App\Exception\Supervisor\NotRunningException;
|
use App\Exception\Supervisor\NotRunningException;
|
||||||
use App\Exception\SupervisorException;
|
use App\Exception\SupervisorException;
|
||||||
|
@ -21,9 +21,9 @@ abstract class AbstractLocalAdapter
|
||||||
{
|
{
|
||||||
use LoggerAwareTrait;
|
use LoggerAwareTrait;
|
||||||
use EntityManagerAwareTrait;
|
use EntityManagerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected Environment $environment,
|
|
||||||
protected SupervisorInterface $supervisor,
|
protected SupervisorInterface $supervisor,
|
||||||
protected EventDispatcherInterface $dispatcher,
|
protected EventDispatcherInterface $dispatcher,
|
||||||
protected Router $router,
|
protected Router $router,
|
||||||
|
|
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Radio\Backend\Liquidsoap;
|
namespace App\Radio\Backend\Liquidsoap;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Event\Radio\WriteLiquidsoapConfiguration;
|
use App\Event\Radio\WriteLiquidsoapConfiguration;
|
||||||
use App\Radio\Backend\Liquidsoap;
|
use App\Radio\Backend\Liquidsoap;
|
||||||
use App\Radio\Enums\AudioProcessingMethods;
|
use App\Radio\Enums\AudioProcessingMethods;
|
||||||
|
@ -22,10 +22,11 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
final class ConfigWriter implements EventSubscriberInterface
|
final class ConfigWriter implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
private readonly Entity\Repository\SettingsRepository $settingsRepo,
|
||||||
private readonly Liquidsoap $liquidsoap,
|
private readonly Liquidsoap $liquidsoap,
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly FallbackFile $fallbackFile
|
private readonly FallbackFile $fallbackFile
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,11 @@ declare(strict_types=1);
|
||||||
namespace App\Radio;
|
namespace App\Radio;
|
||||||
|
|
||||||
use App\Container\EntityManagerAwareTrait;
|
use App\Container\EntityManagerAwareTrait;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity\Enums\PlaylistTypes;
|
use App\Entity\Enums\PlaylistTypes;
|
||||||
use App\Entity\Repository\StationPlaylistMediaRepository;
|
use App\Entity\Repository\StationPlaylistMediaRepository;
|
||||||
use App\Entity\Station;
|
use App\Entity\Station;
|
||||||
use App\Entity\StationPlaylist;
|
use App\Entity\StationPlaylist;
|
||||||
use App\Environment;
|
|
||||||
use App\Exception;
|
use App\Exception;
|
||||||
use App\Radio\Enums\BackendAdapters;
|
use App\Radio\Enums\BackendAdapters;
|
||||||
use App\Radio\Enums\FrontendAdapters;
|
use App\Radio\Enums\FrontendAdapters;
|
||||||
|
@ -20,6 +20,7 @@ use Supervisor\SupervisorInterface;
|
||||||
final class Configuration
|
final class Configuration
|
||||||
{
|
{
|
||||||
use EntityManagerAwareTrait;
|
use EntityManagerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public const DEFAULT_PORT_MIN = 8000;
|
public const DEFAULT_PORT_MIN = 8000;
|
||||||
public const DEFAULT_PORT_MAX = 8499;
|
public const DEFAULT_PORT_MAX = 8499;
|
||||||
|
@ -36,7 +37,6 @@ final class Configuration
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Adapters $adapters,
|
private readonly Adapters $adapters,
|
||||||
private readonly SupervisorInterface $supervisor,
|
private readonly SupervisorInterface $supervisor,
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly StationPlaylistMediaRepository $spmRepo,
|
private readonly StationPlaylistMediaRepository $spmRepo,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
@ -400,7 +400,7 @@ final class Configuration
|
||||||
*/
|
*/
|
||||||
public function removeConfiguration(Station $station): void
|
public function removeConfiguration(Station $station): void
|
||||||
{
|
{
|
||||||
if (Environment::getInstance()->isTesting()) {
|
if ($this->environment->isTesting()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,13 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Radio;
|
namespace App\Radio;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Flysystem\StationFilesystems;
|
use App\Flysystem\StationFilesystems;
|
||||||
|
|
||||||
final class FallbackFile
|
final class FallbackFile
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getFallbackPathForStation(Entity\Station $station): string
|
public function getFallbackPathForStation(Entity\Station $station): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||||
namespace App\Radio\Frontend;
|
namespace App\Radio\Frontend;
|
||||||
|
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\Router;
|
use App\Http\Router;
|
||||||
use App\Nginx\CustomUrls;
|
use App\Nginx\CustomUrls;
|
||||||
use App\Radio\AbstractLocalAdapter;
|
use App\Radio\AbstractLocalAdapter;
|
||||||
|
@ -29,12 +28,11 @@ abstract class AbstractFrontend extends AbstractLocalAdapter
|
||||||
protected Client $http_client,
|
protected Client $http_client,
|
||||||
protected Entity\Repository\SettingsRepository $settingsRepo,
|
protected Entity\Repository\SettingsRepository $settingsRepo,
|
||||||
protected Entity\Repository\StationMountRepository $stationMountRepo,
|
protected Entity\Repository\StationMountRepository $stationMountRepo,
|
||||||
Environment $environment,
|
|
||||||
SupervisorInterface $supervisor,
|
SupervisorInterface $supervisor,
|
||||||
EventDispatcherInterface $dispatcher,
|
EventDispatcherInterface $dispatcher,
|
||||||
Router $router
|
Router $router
|
||||||
) {
|
) {
|
||||||
parent::__construct($environment, $supervisor, $dispatcher, $router);
|
parent::__construct($supervisor, $dispatcher, $router);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,8 +5,8 @@ declare(strict_types=1);
|
||||||
namespace App\Radio\Remote;
|
namespace App\Radio\Remote;
|
||||||
|
|
||||||
use App\Cache\AzuraRelayCache;
|
use App\Cache\AzuraRelayCache;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Promise\Create;
|
use GuzzleHttp\Promise\Create;
|
||||||
use GuzzleHttp\Promise\PromiseInterface;
|
use GuzzleHttp\Promise\PromiseInterface;
|
||||||
|
@ -18,6 +18,8 @@ use NowPlaying\Result\Result;
|
||||||
|
|
||||||
final class AzuraRelay extends AbstractRemote
|
final class AzuraRelay extends AbstractRemote
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly AzuraRelayCache $azuraRelayCache,
|
private readonly AzuraRelayCache $azuraRelayCache,
|
||||||
Entity\Repository\SettingsRepository $settingsRepo,
|
Entity\Repository\SettingsRepository $settingsRepo,
|
||||||
|
@ -91,7 +93,7 @@ final class AzuraRelay extends AbstractRemote
|
||||||
if (
|
if (
|
||||||
$use_radio_proxy
|
$use_radio_proxy
|
||||||
|| 'https' === $base_url->getScheme()
|
|| 'https' === $base_url->getScheme()
|
||||||
|| (!Environment::getInstance()->isProduction() && !Environment::getInstance()->isDocker())
|
|| (!$this->environment->isProduction() && !$this->environment->isDocker())
|
||||||
) {
|
) {
|
||||||
// Web proxy support.
|
// Web proxy support.
|
||||||
return (string)$base_url
|
return (string)$base_url
|
||||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity\Repository\SettingsRepository;
|
use App\Entity\Repository\SettingsRepository;
|
||||||
use App\Http\ServerRequest;
|
use App\Http\ServerRequest;
|
||||||
use App\Lock\LockFactory;
|
use App\Lock\LockFactory;
|
||||||
|
@ -14,11 +15,12 @@ use Symfony\Component\RateLimiter\Storage\CacheStorage;
|
||||||
|
|
||||||
final class RateLimit
|
final class RateLimit
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
private CacheItemPoolInterface $psr6Cache;
|
private CacheItemPoolInterface $psr6Cache;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly LockFactory $lockFactory,
|
private readonly LockFactory $lockFactory,
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly SettingsRepository $settingsRepo,
|
private readonly SettingsRepository $settingsRepo,
|
||||||
CacheItemPoolInterface $cacheItemPool
|
CacheItemPoolInterface $cacheItemPool
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Container\LoggerAwareTrait;
|
use App\Container\LoggerAwareTrait;
|
||||||
use App\Entity\Repository\SettingsRepository;
|
use App\Entity\Repository\SettingsRepository;
|
||||||
use App\Entity\Repository\StationRepository;
|
use App\Entity\Repository\StationRepository;
|
||||||
|
@ -22,6 +23,7 @@ use Symfony\Component\Filesystem\Filesystem;
|
||||||
final class Acme
|
final class Acme
|
||||||
{
|
{
|
||||||
use LoggerAwareTrait;
|
use LoggerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public const LETSENCRYPT_PROD = 'https://acme-v02.api.letsencrypt.org/directory';
|
public const LETSENCRYPT_PROD = 'https://acme-v02.api.letsencrypt.org/directory';
|
||||||
public const LETSENCRYPT_DEV = 'https://acme-staging-v02.api.letsencrypt.org/directory';
|
public const LETSENCRYPT_DEV = 'https://acme-staging-v02.api.letsencrypt.org/directory';
|
||||||
|
@ -30,7 +32,6 @@ final class Acme
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly SettingsRepository $settingsRepo,
|
private readonly SettingsRepository $settingsRepo,
|
||||||
private readonly StationRepository $stationRepo,
|
private readonly StationRepository $stationRepo,
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Nginx $nginx,
|
private readonly Nginx $nginx,
|
||||||
private readonly Adapters $adapters,
|
private readonly Adapters $adapters,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Container\LoggerAwareTrait;
|
use App\Container\LoggerAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Version;
|
use App\Version;
|
||||||
use Exception;
|
use Exception;
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
|
@ -14,11 +14,11 @@ use GuzzleHttp\Client;
|
||||||
final class AzuraCastCentral
|
final class AzuraCastCentral
|
||||||
{
|
{
|
||||||
use LoggerAwareTrait;
|
use LoggerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
private const BASE_URL = 'https://central.azuracast.com';
|
private const BASE_URL = 'https://central.azuracast.com';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Version $version,
|
private readonly Version $version,
|
||||||
private readonly Client $httpClient,
|
private readonly Client $httpClient,
|
||||||
private readonly Entity\Repository\SettingsRepository $settingsRepo
|
private readonly Entity\Repository\SettingsRepository $settingsRepo
|
||||||
|
|
|
@ -4,16 +4,17 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity\Station;
|
use App\Entity\Station;
|
||||||
use App\Environment;
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
|
|
||||||
final class Centrifugo
|
final class Centrifugo
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public const GLOBAL_TIME_CHANNEL = 'global:time';
|
public const GLOBAL_TIME_CHANNEL = 'global:time';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Client $client,
|
private readonly Client $client,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,16 +4,13 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use App\Environment;
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use Redis;
|
use Redis;
|
||||||
use RuntimeException;
|
use RuntimeException;
|
||||||
|
|
||||||
final class RedisFactory
|
final class RedisFactory
|
||||||
{
|
{
|
||||||
public function __construct(
|
use EnvironmentAwareTrait;
|
||||||
private readonly Environment $environment
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isSupported(): bool
|
public function isSupported(): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use App\Environment;
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Exception\SupervisorException;
|
use App\Exception\SupervisorException;
|
||||||
use App\Service\ServiceControl\ServiceData;
|
use App\Service\ServiceControl\ServiceData;
|
||||||
use Supervisor\Exception\Fault\BadNameException;
|
use Supervisor\Exception\Fault\BadNameException;
|
||||||
|
@ -15,9 +15,10 @@ use Supervisor\SupervisorInterface;
|
||||||
|
|
||||||
final class ServiceControl
|
final class ServiceControl
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly SupervisorInterface $supervisor,
|
private readonly SupervisorInterface $supervisor,
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Centrifugo $centrifugo
|
private readonly Centrifugo $centrifugo
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,16 @@
|
||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use App\Environment;
|
use App\Container\EnvironmentAwareTrait;
|
||||||
|
|
||||||
final class WebUpdater
|
final class WebUpdater
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
// Don't worry that this is insecure; it's only ever used for internal communications.
|
// Don't worry that this is insecure; it's only ever used for internal communications.
|
||||||
public const WATCHTOWER_TOKEN = 'azur4c457';
|
public const WATCHTOWER_TOKEN = 'azur4c457';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly GuzzleFactory $guzzleFactory
|
private readonly GuzzleFactory $guzzleFactory
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,15 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Sync\Task;
|
namespace App\Sync\Task;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Service\AzuraCastCentral;
|
use App\Service\AzuraCastCentral;
|
||||||
use GuzzleHttp\Exception\TransferException;
|
use GuzzleHttp\Exception\TransferException;
|
||||||
|
|
||||||
final class CheckUpdatesTask extends AbstractTask
|
final class CheckUpdatesTask extends AbstractTask
|
||||||
{
|
{
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
private const UPDATE_THRESHOLD = 3780;
|
private const UPDATE_THRESHOLD = 3780;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
@ -37,7 +39,7 @@ final class CheckUpdatesTask extends AbstractTask
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Environment::getInstance()->isTesting()) {
|
if ($this->environment->isTesting()) {
|
||||||
$this->logger->info('Update checks are currently disabled for this AzuraCast instance.');
|
$this->logger->info('Update checks are currently disabled for this AzuraCast instance.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,11 @@ namespace App\Webhook;
|
||||||
|
|
||||||
use App\Container\ContainerAwareTrait;
|
use App\Container\ContainerAwareTrait;
|
||||||
use App\Container\EntityManagerAwareTrait;
|
use App\Container\EntityManagerAwareTrait;
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Container\LoggerAwareTrait;
|
use App\Container\LoggerAwareTrait;
|
||||||
use App\Entity\ApiGenerator\NowPlayingApiGenerator;
|
use App\Entity\ApiGenerator\NowPlayingApiGenerator;
|
||||||
use App\Entity\Station;
|
use App\Entity\Station;
|
||||||
use App\Entity\StationWebhook;
|
use App\Entity\StationWebhook;
|
||||||
use App\Environment;
|
|
||||||
use App\Http\RouterInterface;
|
use App\Http\RouterInterface;
|
||||||
use App\Message;
|
use App\Message;
|
||||||
use App\Webhook\Connector\AbstractConnector;
|
use App\Webhook\Connector\AbstractConnector;
|
||||||
|
@ -23,9 +23,9 @@ final class Dispatcher
|
||||||
use LoggerAwareTrait;
|
use LoggerAwareTrait;
|
||||||
use ContainerAwareTrait;
|
use ContainerAwareTrait;
|
||||||
use EntityManagerAwareTrait;
|
use EntityManagerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly RouterInterface $router,
|
private readonly RouterInterface $router,
|
||||||
private readonly LocalWebhookHandler $localHandler,
|
private readonly LocalWebhookHandler $localHandler,
|
||||||
private readonly NowPlayingApiGenerator $nowPlayingApiGen
|
private readonly NowPlayingApiGenerator $nowPlayingApiGen
|
||||||
|
|
|
@ -4,9 +4,9 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Webhook;
|
namespace App\Webhook;
|
||||||
|
|
||||||
|
use App\Container\EnvironmentAwareTrait;
|
||||||
use App\Container\LoggerAwareTrait;
|
use App\Container\LoggerAwareTrait;
|
||||||
use App\Entity;
|
use App\Entity;
|
||||||
use App\Environment;
|
|
||||||
use App\Service\Centrifugo;
|
use App\Service\Centrifugo;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ use const JSON_PRETTY_PRINT;
|
||||||
final class LocalWebhookHandler
|
final class LocalWebhookHandler
|
||||||
{
|
{
|
||||||
use LoggerAwareTrait;
|
use LoggerAwareTrait;
|
||||||
|
use EnvironmentAwareTrait;
|
||||||
|
|
||||||
public const NAME = 'local';
|
public const NAME = 'local';
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly Environment $environment,
|
|
||||||
private readonly Centrifugo $centrifugo
|
private readonly Centrifugo $centrifugo
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue