From 4ee3191e4730dd348dece5ef8b7d9164b535d47f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nu=C5=A1a=20Puk=C5=A1i=C4=8D?= Date: Thu, 9 Oct 2025 21:05:04 +0200 Subject: [PATCH] Xtra filter --- src/Command/CacheLatestArticlesCommand.php | 3 ++- src/Command/QualityCheckArticlesCommand.php | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Command/CacheLatestArticlesCommand.php b/src/Command/CacheLatestArticlesCommand.php index 42617e0..1f18be3 100644 --- a/src/Command/CacheLatestArticlesCommand.php +++ b/src/Command/CacheLatestArticlesCommand.php @@ -16,12 +16,13 @@ use Elastica\Collapse; use Elastica\Query\Terms; use Psr\Cache\CacheItemPoolInterface; use swentel\nostr\Key\Key; +use Symfony\Contracts\Cache\CacheInterface; #[AsCommand(name: 'app:cache_latest_articles', description: 'Cache the latest articles list')] class CacheLatestArticlesCommand extends Command { private FinderInterface $finder; - private CacheItemPoolInterface $articlesCache; + private CacheInterface $appCache; private ParameterBagInterface $params; public function __construct(FinderInterface $finder, CacheItemPoolInterface $articlesCache, ParameterBagInterface $params) diff --git a/src/Command/QualityCheckArticlesCommand.php b/src/Command/QualityCheckArticlesCommand.php index bf66df4..1639a40 100644 --- a/src/Command/QualityCheckArticlesCommand.php +++ b/src/Command/QualityCheckArticlesCommand.php @@ -9,6 +9,7 @@ use App\Enum\IndexStatusEnum; use Doctrine\ORM\EntityManagerInterface; use FOS\ElasticaBundle\Persister\ObjectPersister; use FOS\ElasticaBundle\Persister\ObjectPersisterInterface; +use swentel\nostr\Key\Key; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -17,6 +18,10 @@ use Symfony\Component\Console\Output\OutputInterface; #[AsCommand(name: 'articles:qa', description: 'Mark articles by quality and select which to index')] class QualityCheckArticlesCommand extends Command { + private const BLACKLIST = [ + 'npub1t5d8kcn0hu8zmt6dpkgatd5hwhx76956g7qmdzwnca6fzgprzlhqnqks86' + ]; + public function __construct( private readonly EntityManagerInterface $entityManager ) @@ -46,6 +51,13 @@ class QualityCheckArticlesCommand extends Command private function meetsCriteria(Article $article): bool { + // Exclude blacklisted pubkeys + $key = new Key(); + if (in_array($key->convertPublicKeyToBech32($article->getPubkey()), self::BLACKLIST, true)) + { + return false; + } + $content = $article->getContent(); // No empty title