From f0e708272e27ac080890acb73c133ba2dbebc722 Mon Sep 17 00:00:00 2001 From: Vincent Date: Wed, 25 Sep 2024 14:02:40 +0200 Subject: [PATCH] feat: get supported tlds by namecheap --- src/Controller/WatchListController.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Controller/WatchListController.php b/src/Controller/WatchListController.php index 060a22a..021bf01 100644 --- a/src/Controller/WatchListController.php +++ b/src/Controller/WatchListController.php @@ -34,6 +34,8 @@ use Sabre\VObject\InvalidDataException; use Sabre\VObject\ParseException; use Sabre\VObject\Reader; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\DependencyInjection\Attribute\Autowire; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; @@ -53,7 +55,9 @@ class WatchListController extends AbstractController private readonly HttpClientInterface $httpClient, private readonly CacheItemPoolInterface $cacheItemPool, private readonly KernelInterface $kernel, - private readonly ChatNotificationService $chatNotificationService + private readonly ChatNotificationService $chatNotificationService, + #[Autowire(service: 'service_container')] + private ContainerInterface $locator ) { } @@ -182,9 +186,10 @@ class WatchListController extends AbstractController $connectorProviderClass = $connector->getProvider()->getConnectorProvider(); /** @var AbstractProvider $connectorProvider */ - $connectorProvider = new $connectorProviderClass($connector->getAuthData(), $this->httpClient, $this->cacheItemPool, $this->kernel); + $connectorProvider = $this->locator->get($connectorProviderClass); $connectorProvider::verifyAuthData($connector->getAuthData(), $this->httpClient); // We want to check if the tokens are OK + $connectorProvider->authenticate($connector->getAuthData()); $supported = $connectorProvider->isSupported(...$watchList->getDomains()->toArray()); if (!$supported) {