Browse Source

bug-fixes

imwald
Silberengel 5 days ago
parent
commit
d49b32472b
  1. 14
      assets/controllers/comment_reply_controller.js
  2. 12
      assets/styles/app.css
  3. 10
      importmap.php
  4. 10
      src/Controller/FeaturedAuthorsController.php
  5. 4
      templates/partial/author_profile_header.html.twig

14
assets/controllers/comment_reply_controller.js

@ -68,8 +68,9 @@ export default class extends Controller { @@ -68,8 +68,9 @@ export default class extends Controller {
return;
}
this.setHint('Preparing event…');
const { nip19 } = await import('nostr-tools');
const link = this.buildParentBech32(nip19);
// `nostr-tools` entry pulls @noble/curves (bare spec → breaks in AssetMapper). NIP-19 only needs bech32 helpers.
const { naddrEncode, neventEncode } = await import('nostr-tools/nip19');
const link = this.buildParentBech32(naddrEncode, neventEncode);
const blurb = `> Replying to **${this.blurbLabelValue}** — [view parent](nostr:${link})\n\n`;
const unsigned = {
kind: 1111,
@ -135,18 +136,19 @@ export default class extends Controller { @@ -135,18 +136,19 @@ export default class extends Controller {
}
/**
* @param {import('nostr-tools').nip19} nip19
* @param {function(object): string} naddrEncode
* @param {function(object): string} neventEncode
*/
buildParentBech32(nip19) {
buildParentBech32(naddrEncode, neventEncode) {
const allZero = /^0{64}$/.test(this.parentIdValue);
const parts = (this.expectedCoordinateValue || '').split(':');
const k = parts[0] ? parseInt(parts[0], 10) : 30023;
const pub = parts[1] || this.authorPubkeyValue;
const d = parts[2] || '';
if (allZero && d !== '') {
return nip19.naddrEncode({ kind: k, pubkey: pub, identifier: d, relays: [] });
return naddrEncode({ kind: k, pubkey: pub, identifier: d, relays: [] });
}
return nip19.neventEncode({
return neventEncode({
id: this.parentIdValue,
kind: this.parentKindValue,
pubkey: this.authorPubkeyValue,

12
assets/styles/app.css

@ -621,21 +621,26 @@ footer a { @@ -621,21 +621,26 @@ footer a {
white-space: nowrap;
}
/* Do not use .author-profile__meta-value on this wrapper: its overflow:hidden clips the ✓. Ellipsis only the link. */
/* NIP-05: ellipsis long addresses; keep ✓ immediately after the (truncated) text, not at the column edge. */
.author-profile__nip05-value {
display: flex;
align-items: center;
gap: 0.3rem;
justify-content: flex-start;
flex-wrap: nowrap;
gap: 0.25rem;
min-width: 0;
max-width: 100%;
width: 100%;
}
.author-profile__nip05-link {
flex: 0 1 auto;
min-width: 0;
/* reserve space for the checkmark on the same “line” of layout */
max-width: calc(100% - 1.4rem);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1 1 0;
word-break: normal;
}
@ -647,6 +652,7 @@ footer a { @@ -647,6 +652,7 @@ footer a {
opacity: 0.85;
user-select: none;
flex-shrink: 0;
flex-grow: 0;
}
.author-profile__payment-type {

10
importmap.php

@ -52,6 +52,16 @@ return [ @@ -52,6 +52,16 @@ return [
'nostr-tools' => [
'version' => '2.10.4',
],
// Subpath: bech32 only (no @noble/curves) — used by comment_reply_controller for NIP-19 in blurb lines.
'nostr-tools/nip19' => [
'version' => '2.10.4',
],
'@noble/hashes' => [
'version' => '1.3.1',
],
'@scure/base' => [
'version' => '1.1.1',
],
'quill/dist/quill.core.css' => [
'version' => '2.0.3',
'type' => 'css',

10
src/Controller/FeaturedAuthorsController.php

@ -6,6 +6,7 @@ namespace App\Controller; @@ -6,6 +6,7 @@ namespace App\Controller;
use App\Repository\FeaturedAuthorRepository;
use App\Service\CacheService;
use App\Service\NostrClient;
use App\Service\ProfileIdentityLinksBuilder;
use App\Service\ProfilePaymentLinksBuilder;
use swentel\nostr\Key\Key;
@ -23,6 +24,7 @@ final class FeaturedAuthorsController extends AbstractController @@ -23,6 +24,7 @@ final class FeaturedAuthorsController extends AbstractController
public function index(
FeaturedAuthorRepository $featuredAuthorRepository,
CacheService $cacheService,
NostrClient $nostrClient,
ProfileIdentityLinksBuilder $profileIdentityLinks,
ProfilePaymentLinksBuilder $profilePaymentLinks,
ParameterBagInterface $params,
@ -37,11 +39,17 @@ final class FeaturedAuthorsController extends AbstractController @@ -37,11 +39,17 @@ final class FeaturedAuthorsController extends AbstractController
$author = $bundle['content'];
$kind0Tags = $bundle['kind0_tags'];
$jumbleProfileHref = $jumbleBase !== '' ? $jumbleBase.'/'.$npub : null;
$kind10133 = [];
try {
$kind10133 = $nostrClient->getKind10133PaymentTargetEventsForNpub($npub, 20);
} catch (\Throwable) {
}
$extraPayto = $profilePaymentLinks->collectPaytoUrisFromNipA3Kind10133Events($kind10133);
$authors[] = [
'author' => $author,
'npub' => $npub,
'profile_websites' => $profileIdentityLinks->buildWebsites($author, $kind0Tags),
'profile_payment_links' => $profilePaymentLinks->buildPaymentRows($author, $kind0Tags, []),
'profile_payment_links' => $profilePaymentLinks->buildPaymentRows($author, $kind0Tags, $extraPayto),
'jumble_profile_href' => $jumbleProfileHref,
];
}

4
templates/partial/author_profile_header.html.twig

@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
{% for row in profile_websites %}
<li class="author-profile__identity-row author-profile__meta-line">
<span class="author-profile__identity-type">Website</span>
<a class="author-profile__identity-link author-profile__meta-value" href="{{ row.href|e('html_attr') }}" rel="nofollow noopener">{{ row.label|e }}</a>
<a class="author-profile__identity-link author-profile__meta-value" href="{{ row.href|e('html_attr') }}" target="_blank" rel="nofollow noopener noreferrer">{{ row.label|e }}</a>
</li>
{% endfor %}
</ul>
@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
{% for row in profile_payment_links %}
<li class="author-profile__payment author-profile__meta-line">
<span class="author-profile__payment-type"{% if row.display_type_label|default('')|trim == '' %} aria-hidden="true"{% endif %}>{{ row.display_type_label|default('')|e }}</span>
<a class="author-profile__payment-link author-profile__meta-value" href="{{ row.href|e('html_attr') }}" rel="nofollow noopener">{{ row.label|e }}</a>
<a class="author-profile__payment-link author-profile__meta-value" href="{{ row.href|e('html_attr') }}" target="_blank" rel="nofollow noopener noreferrer">{{ row.label|e }}</a>
</li>
{% endfor %}
</ul>

Loading…
Cancel
Save