From b5d68e70feeeb75dbca3f482fddffcbe10800df5 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Thu, 23 Apr 2026 14:35:07 +0200 Subject: [PATCH] bug-fixes --- assets/styles/app.css | 61 +++++++++++++++---- deploy/well-known-nip05-nginx.conf | 10 +++ frankenphp/Caddyfile | 2 + public/.htaccess | 18 ++++++ src/Service/Nip05VerificationService.php | 6 +- .../partial/author_profile_header.html.twig | 47 +++++++------- 6 files changed, 111 insertions(+), 33 deletions(-) create mode 100644 deploy/well-known-nip05-nginx.conf create mode 100644 public/.htaccess diff --git a/assets/styles/app.css b/assets/styles/app.css index 1d0efa6..18b780f 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -543,6 +543,48 @@ footer a { text-align: left; } +/* One main label (NIP-05, Payment) with values stacked in the next column */ +.author-profile__section--label-value { + display: grid; + grid-template-columns: 7.5rem minmax(0, 1fr); + column-gap: 0.5rem; + align-items: start; + margin-top: 0.5rem; +} + +.author-profile__section-type { + font-size: 0.72rem; + font-weight: 600; + text-transform: uppercase; + letter-spacing: 0.04em; + color: var(--color-text); + opacity: 0.75; + line-height: 1.35; + padding-top: 0.15em; +} + +.author-profile__value-stack { + list-style: none; + margin: 0; + padding: 0; + min-width: 0; +} + +.author-profile__value-stack-line { + margin: 0.35rem 0 0; +} + +.author-profile__value-stack-line:first-child { + margin-top: 0; +} + +.author-profile__payments-nested { + list-style: none; + margin: 0; + padding: 0; + min-width: 0; +} + .author-profile__identity { list-style: none; margin: 0.5rem 0 0; @@ -579,17 +621,21 @@ footer a { white-space: nowrap; } +/* Do not use .author-profile__meta-value on this wrapper: its overflow:hidden clips the ✓. Ellipsis only the link. */ .author-profile__nip05-value { display: flex; align-items: center; gap: 0.3rem; min-width: 0; - overflow: hidden; + width: 100%; } -.author-profile__nip05-value .author-profile__identity-link { - flex: 1 1 0; +.author-profile__nip05-link { min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + flex: 1 1 0; word-break: normal; } @@ -600,14 +646,7 @@ footer a { line-height: 1; opacity: 0.85; user-select: none; -} - -.author-profile__payments { - list-style: none; - margin: 0.5rem 0 0; - padding: 0; - max-width: 100%; - text-align: left; + flex-shrink: 0; } .author-profile__payment-type { diff --git a/deploy/well-known-nip05-nginx.conf b/deploy/well-known-nip05-nginx.conf new file mode 100644 index 0000000..27505bd --- /dev/null +++ b/deploy/well-known-nip05-nginx.conf @@ -0,0 +1,10 @@ +# NIP-05: browsers and verifiers request +# GET https:///.well-known/nostr.json?name= +# Symfony route: SeoController::nostrWellKnown (name: nostr_well_known) +# +# Include a location for this *before* any broad rule that blocks or mishandles +# `/.well-known/` (e.g. `location ^~ /.well-known/ { return 404; }`). + +location = /.well-known/nostr.json { + try_files $uri /index.php$is_args$args; +} diff --git a/frankenphp/Caddyfile b/frankenphp/Caddyfile index 27321dc..a94b300 100644 --- a/frankenphp/Caddyfile +++ b/frankenphp/Caddyfile @@ -29,6 +29,8 @@ # Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics header ?Permissions-Policy "browsing-topics=()" + # NIP-05: Apache deployments need public/.well-known/ handled via public/.htaccess; nginx: deploy/well-known-nip05-nginx.conf + @phpRoute { not path /.well-known/mercure* not file {path} diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..0d91991 --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,18 @@ +# See https://symfony.com/doc/current/setup/web_server_configuration.html +# Required so routes like `/.well-known/nostr.json` (NIP-05) are handled by index.php. + +DirectoryIndex index.php + + + Options -MultiViews + + + + RewriteEngine On + # Authorization header (e.g. API) + RewriteCond %{HTTP:Authorization} .+ + RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0] + # Serve existing files directly; all other requests → front controller + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [QSA,L] + diff --git a/src/Service/Nip05VerificationService.php b/src/Service/Nip05VerificationService.php index 6e727ab..0f4a319 100644 --- a/src/Service/Nip05VerificationService.php +++ b/src/Service/Nip05VerificationService.php @@ -54,10 +54,14 @@ final readonly class Nip05VerificationService $verified = false; try { $item = $this->appCache->getItem($k); - if ($item->isHit() && is_bool($item->get())) { + if ($item->isHit() && \is_bool($item->get())) { $verified = (bool) $item->get(); + } else { + // Cold cache: verify now so the profile shows ✓ without a prior prewarm run. + $verified = $this->verifyAndCache($h, $label); } } catch (InvalidArgumentException) { + $verified = $this->verifyAndCache($h, $label); } $out[] = [...$r, 'verified' => $verified]; } diff --git a/templates/partial/author_profile_header.html.twig b/templates/partial/author_profile_header.html.twig index 1c99ccb..e5ff9cc 100644 --- a/templates/partial/author_profile_header.html.twig +++ b/templates/partial/author_profile_header.html.twig @@ -28,29 +28,34 @@ {% endif %} {% if show_nip05|default(false) and profile_nip05 is not empty %} -
    - {% for row in profile_nip05 %} -
  • - NIP-05 - - {{ row.label|e }} - {% if row.verified|default(false) %} - - {% endif %} - -
  • - {% endfor %} -
+ {% endif %} {% if profile_payment_links is not empty %} -
    - {% for row in profile_payment_links %} -
  • - - {{ row.label|e }} -
  • - {% endfor %} -
+ {% endif %}