feat: verify SLD before adding connector

This commit is contained in:
Maël Gangloff
2024-08-24 18:22:15 +02:00
parent afd6a3810e
commit e3f1229c74
3 changed files with 17 additions and 18 deletions

View File

@@ -207,17 +207,7 @@ class WatchListController extends AbstractController
$connectorProvider = new $connectorProviderClass($connector->getAuthData(), $this->httpClient, $this->cacheItemPool, $this->kernel);
$connectorProvider::verifyAuthData($connector->getAuthData(), $this->httpClient); // We want to check if the tokens are OK
$tldList = [];
/** @var Domain $domain */
foreach ($watchList->getDomains()->getIterator() as $domain) {
$tld = $domain->getTld();
if (!in_array($tld, $tldList)) {
$tldList[] = $tld;
}
}
$supported = $connectorProvider->isSupported(...$tldList);
$supported = $connectorProvider->isSupported(...$watchList->getDomains()->toArray());
if (!$supported) {
$this->logger->notice('The Connector ({connector}) does not support all TLDs in this Watchlist', [