Browse Source

bug-fixes

imwald
Silberengel 5 days ago
parent
commit
b5d68e70fe
  1. 61
      assets/styles/app.css
  2. 10
      deploy/well-known-nip05-nginx.conf
  3. 2
      frankenphp/Caddyfile
  4. 18
      public/.htaccess
  5. 6
      src/Service/Nip05VerificationService.php
  6. 47
      templates/partial/author_profile_header.html.twig

61
assets/styles/app.css

@ -543,6 +543,48 @@ footer a {
text-align: left; 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 { .author-profile__identity {
list-style: none; list-style: none;
margin: 0.5rem 0 0; margin: 0.5rem 0 0;
@ -579,17 +621,21 @@ footer a {
white-space: nowrap; 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 { .author-profile__nip05-value {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 0.3rem; gap: 0.3rem;
min-width: 0; min-width: 0;
overflow: hidden; width: 100%;
} }
.author-profile__nip05-value .author-profile__identity-link { .author-profile__nip05-link {
flex: 1 1 0;
min-width: 0; min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1 1 0;
word-break: normal; word-break: normal;
} }
@ -600,14 +646,7 @@ footer a {
line-height: 1; line-height: 1;
opacity: 0.85; opacity: 0.85;
user-select: none; user-select: none;
} flex-shrink: 0;
.author-profile__payments {
list-style: none;
margin: 0.5rem 0 0;
padding: 0;
max-width: 100%;
text-align: left;
} }
.author-profile__payment-type { .author-profile__payment-type {

10
deploy/well-known-nip05-nginx.conf

@ -0,0 +1,10 @@
# NIP-05: browsers and verifiers request
# GET https://<site>/.well-known/nostr.json?name=<local-part>
# 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;
}

2
frankenphp/Caddyfile

@ -29,6 +29,8 @@
# Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics # Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics
header ?Permissions-Policy "browsing-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 { @phpRoute {
not path /.well-known/mercure* not path /.well-known/mercure*
not file {path} not file {path}

18
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
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
<IfModule mod_rewrite.c>
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]
</IfModule>

6
src/Service/Nip05VerificationService.php

@ -54,10 +54,14 @@ final readonly class Nip05VerificationService
$verified = false; $verified = false;
try { try {
$item = $this->appCache->getItem($k); $item = $this->appCache->getItem($k);
if ($item->isHit() && is_bool($item->get())) { if ($item->isHit() && \is_bool($item->get())) {
$verified = (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) { } catch (InvalidArgumentException) {
$verified = $this->verifyAndCache($h, $label);
} }
$out[] = [...$r, 'verified' => $verified]; $out[] = [...$r, 'verified' => $verified];
} }

47
templates/partial/author_profile_header.html.twig

@ -28,29 +28,34 @@
</ul> </ul>
{% endif %} {% endif %}
{% if show_nip05|default(false) and profile_nip05 is not empty %} {% if show_nip05|default(false) and profile_nip05 is not empty %}
<ul class="author-profile__identity" aria-label="NIP-05"> <div class="author-profile__section author-profile__section--label-value" aria-label="NIP-05">
{% for row in profile_nip05 %} <span class="author-profile__section-type">NIP-05</span>
<li class="author-profile__identity-row author-profile__meta-line"> <ul class="author-profile__value-stack">
<span class="author-profile__identity-type">NIP-05</span> {% for row in profile_nip05 %}
<span class="author-profile__meta-value author-profile__nip05-value"> <li class="author-profile__value-stack-line">
<a class="author-profile__identity-link" href="{{ row.href|e('html_attr') }}" target="_blank" rel="nofollow noopener noreferrer" title="Open /.well-known/nostr.json for this name">{{ row.label|e }}</a> <span class="author-profile__nip05-value">
{% if row.verified|default(false) %} <a class="author-profile__identity-link author-profile__nip05-link" href="{{ row.href|e('html_attr') }}" target="_blank" rel="nofollow noopener noreferrer" title="Open /.well-known/nostr.json for this name">{{ row.label|e }}</a>
<span class="author-profile__nip05-verified" title="This identifier matches the pubkey in /.well-known/nostr.json" aria-label="Verified NIP-05">✓</span> {% if row.verified|default(false) %}
{% endif %} <span class="author-profile__nip05-verified" title="This identifier matches the pubkey in /.well-known/nostr.json" aria-label="Verified NIP-05">✓</span>
</span> {% endif %}
</li> </span>
{% endfor %} </li>
</ul> {% endfor %}
</ul>
</div>
{% endif %} {% endif %}
{% if profile_payment_links is not empty %} {% if profile_payment_links is not empty %}
<ul class="author-profile__payments" aria-label="Payment (Lightning and payto)"> <div class="author-profile__section author-profile__section--label-value" aria-label="Payment">
{% for row in profile_payment_links %} <span class="author-profile__section-type">Payment</span>
<li class="author-profile__payment author-profile__meta-line"> <ul class="author-profile__payments-nested">
<span class="author-profile__payment-type"{% if row.display_type_label|default('')|trim == '' %} aria-hidden="true"{% endif %}>{{ row.display_type_label|default('')|e }}</span> {% for row in profile_payment_links %}
<a class="author-profile__payment-link author-profile__meta-value" href="{{ row.href|e('html_attr') }}" rel="nofollow noopener">{{ row.label|e }}</a> <li class="author-profile__payment author-profile__meta-line">
</li> <span class="author-profile__payment-type"{% if row.display_type_label|default('')|trim == '' %} aria-hidden="true"{% endif %}>{{ row.display_type_label|default('')|e }}</span>
{% endfor %} <a class="author-profile__payment-link author-profile__meta-value" href="{{ row.href|e('html_attr') }}" rel="nofollow noopener">{{ row.label|e }}</a>
</ul> </li>
{% endfor %}
</ul>
</div>
{% endif %} {% endif %}
</div> </div>

Loading…
Cancel
Save