From 4b9ad0f6ab35fa909ac1ce33909e67c35e9fb02a Mon Sep 17 00:00:00 2001 From: HolgerHatGarKeineNode Date: Fri, 23 Jan 2026 17:09:00 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Refactor=20NIP-05=20verification:?= =?UTF-8?q?=20extract=20handle-fetching=20logic=20into=20reusable=20`Nostr?= =?UTF-8?q?FetcherTrait`=20and=20enhance=20UI=20to=20display=20all=20verif?= =?UTF-8?q?ied=20handles=20with=20improved=20feedback.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Traits/NostrFetcherTrait.php | 31 ++++++++ config/seo.php | 4 +- resources/views/layouts/app.blade.php | 6 +- .../livewire/association/benefits.blade.php | 76 ++++++++++--------- .../livewire/association/profile.blade.php | 75 +++++++++--------- 5 files changed, 115 insertions(+), 77 deletions(-) diff --git a/app/Traits/NostrFetcherTrait.php b/app/Traits/NostrFetcherTrait.php index 78769fd..9ba0641 100644 --- a/app/Traits/NostrFetcherTrait.php +++ b/app/Traits/NostrFetcherTrait.php @@ -12,6 +12,37 @@ use swentel\nostr\Subscription\Subscription; trait NostrFetcherTrait { + /** + * Get all NIP-05 handles for a given pubkey from nostr.json + * + * @param string $pubkey The public key in hex format + * @return array Array of handles associated with the pubkey + */ + public function getNip05HandlesForPubkey(string $pubkey): array + { + try { + $response = \Illuminate\Support\Facades\Http::get( + 'https://einundzwanzig.space/.well-known/nostr.json', + ); + $data = $response->json(); + + if (! isset($data['names'])) { + return []; + } + + $handles = []; + foreach ($data['names'] as $handle => $handlePubkey) { + if ($handlePubkey === $pubkey) { + $handles[] = $handle; + } + } + + return $handles; + } catch (\Exception) { + return []; + } + } + public function fetchProfile($npubs) { $hex = collect([]); diff --git a/config/seo.php b/config/seo.php index 5af5b26..aa738f3 100644 --- a/config/seo.php +++ b/config/seo.php @@ -12,7 +12,7 @@ return [ /** * Use this setting to specify the site name that will be used in OpenGraph tags. */ - 'site_name' => 'Einundzwanzig Verein', + 'site_name' => 'EINUNDZWANZIG Verein', /** * Use this setting to specify the path to the sitemap of your website. This exact path will outputted, so @@ -75,7 +75,7 @@ return [ * Use this setting to provide a suffix that will be added after the title on each page. * If you don't want a suffix, you should specify an empty string. */ - 'suffix' => ' - Einundzwanzig Verein', + 'suffix' => ' - EINUNDZWANZIG Verein', /** * Use this setting to provide a custom title for the homepage. We will not use the suffix on the homepage, diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 671326b..050e28d 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -26,10 +26,10 @@ - + Logo -