'^npub1.*'])] public function index($npub, NostrClient $nostrClient, RedisCacheService $redisCacheService, FinderInterface $finder): Response { $keys = new Key(); $pubkey = $keys->convertToHex($npub); $author = $redisCacheService->getMetadata($npub); // Retrieve long-form content for the author try { $list = $nostrClient->getLongFormContentForPubkey($npub); } catch (\Exception $e) { $list = []; } // Also look for articles in the Elastica index $query = new Terms('pubkey', [$pubkey]); $list = array_merge($list, $finder->find($query, 25)); // deduplicate by slugs $articles = []; foreach ($list as $item) { if (!key_exists((string) $item->getSlug(), $articles)) { $articles[(string) $item->getSlug()] = $item; } } return $this->render('Pages/author.html.twig', [ 'author' => $author, 'npub' => $npub, 'articles' => $articles ]); } /** * @throws \Exception */ #[Route('/p/{pubkey}', name: 'author-redirect')] public function authorRedirect($pubkey): Response { $keys = new Key(); $npub = $keys->convertPublicKeyToBech32($pubkey); return $this->redirectToRoute('author-profile', ['npub' => $npub]); } }