From a7557d8411c548bcd104698c2e6305c707d454df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nu=C5=A1a=20Puk=C5=A1i=C4=8D?= Date: Fri, 10 Oct 2025 14:07:03 +0200 Subject: [PATCH] Metadata --- .../CommonMark/NostrSchemeExtension/NostrMentionParser.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Util/CommonMark/NostrSchemeExtension/NostrMentionParser.php b/src/Util/CommonMark/NostrSchemeExtension/NostrMentionParser.php index 2267b9b..f90375e 100644 --- a/src/Util/CommonMark/NostrSchemeExtension/NostrMentionParser.php +++ b/src/Util/CommonMark/NostrSchemeExtension/NostrMentionParser.php @@ -3,6 +3,7 @@ namespace App\Util\CommonMark\NostrSchemeExtension; use App\Service\RedisCacheService; +use App\Util\NostrKeyUtil; use League\CommonMark\Parser\Inline\InlineParserInterface; use League\CommonMark\Parser\Inline\InlineParserMatch; use League\CommonMark\Parser\InlineParserContext; @@ -17,7 +18,8 @@ use swentel\nostr\Key\Key; readonly class NostrMentionParser implements InlineParserInterface { public function __construct( - private RedisCacheService $redisCacheService + private RedisCacheService $redisCacheService, + private NostrKeyUtil $nostrKeyUtil, ){} public function getMatchDefinition(): InlineParserMatch @@ -40,7 +42,8 @@ readonly class NostrMentionParser implements InlineParserInterface $npubLink = substr($fullMatch, strpos($fullMatch, 'npub1'), -1); // e.g., "npubXXXX" if (empty($label)) { - $metadata = $this->redisCacheService->getMetadata($npubLink); + + $metadata = $this->redisCacheService->getMetadata($this->nostrKeyUtil->npubToHex($npubLink)); $label = $metadata->display_name ?? $metadata->name; }