|
|
|
|
@ -69,6 +69,7 @@ def format_nip05_chips_html(
@@ -69,6 +69,7 @@ def format_nip05_chips_html(
|
|
|
|
|
bad: str, |
|
|
|
|
chip_bg: str | None = None, |
|
|
|
|
chip_border: str | None = None, |
|
|
|
|
container_margin_top: str | None = None, |
|
|
|
|
) -> str: |
|
|
|
|
""" |
|
|
|
|
Horizontal row of NIP-05 chips: favicon (per domain), identifier, verification mark. |
|
|
|
|
@ -89,30 +90,39 @@ def format_nip05_chips_html(
@@ -89,30 +90,39 @@ def format_nip05_chips_html(
|
|
|
|
|
f'style="vertical-align:middle;border-radius:3px;opacity:0.92" />' |
|
|
|
|
) |
|
|
|
|
if okv is True: |
|
|
|
|
mark = f'<span style="color:{ok}" title="NIP-05 verified">✓</span>' |
|
|
|
|
mark = f'<span style="color:{ok};font-size:15px;line-height:1" title="NIP-05 verified">✓</span>' |
|
|
|
|
elif okv is False: |
|
|
|
|
mark = f'<span style="color:{bad}" title="NIP-05 not verified">✗</span>' |
|
|
|
|
mark = f'<span style="color:{bad};font-size:15px;line-height:1" title="NIP-05 not verified">✗</span>' |
|
|
|
|
else: |
|
|
|
|
mark = f'<span style="color:{dim}" title="NIP-05 not verified yet">○</span>' |
|
|
|
|
mark = f'<span style="color:{dim};font-size:15px;line-height:1" title="NIP-05 not verified yet">○</span>' |
|
|
|
|
if chip_bg: |
|
|
|
|
brd = chip_border or dim |
|
|
|
|
wrap = ( |
|
|
|
|
"display:inline-flex;align-items:center;gap:8px;padding:8px 16px;" |
|
|
|
|
"margin:0 18px 12px 0;" |
|
|
|
|
"display:inline-flex;align-items:center;gap:10px;padding:10px 18px;" |
|
|
|
|
"margin:0 12px 10px 0;" |
|
|
|
|
f"border-radius:999px;background:{chip_bg};border:1px solid {brd}" |
|
|
|
|
) |
|
|
|
|
else: |
|
|
|
|
wrap = "display:inline-flex;align-items:center;gap:6px;padding:2px 6px;margin:0 12px 8px 0" |
|
|
|
|
wrap = ( |
|
|
|
|
"display:inline-flex;align-items:center;gap:10px;padding:4px 4px 4px 0;" |
|
|
|
|
"margin:0 16px 6px 0" |
|
|
|
|
) |
|
|
|
|
parts.append( |
|
|
|
|
f'<span style="{wrap}">' |
|
|
|
|
f"{icon}" |
|
|
|
|
f'<span style="color:{muted};font-size:13px">{esc}</span>{mark}' |
|
|
|
|
f'<span style="color:{muted};font-size:14px;line-height:1.45">{esc}</span>{mark}' |
|
|
|
|
f"</span>" |
|
|
|
|
) |
|
|
|
|
if not parts: |
|
|
|
|
return "" |
|
|
|
|
mt = "14px" if chip_bg else "6px" |
|
|
|
|
return f'<div style="display:flex;flex-wrap:wrap;align-items:center;margin-top:{mt}">{"".join(parts)}</div>' |
|
|
|
|
if container_margin_top is not None: |
|
|
|
|
mt = container_margin_top |
|
|
|
|
else: |
|
|
|
|
mt = "14px" if chip_bg else "4px" |
|
|
|
|
return ( |
|
|
|
|
f'<div style="display:flex;flex-wrap:wrap;align-items:flex-start;' |
|
|
|
|
f'gap:10px 14px;margin-top:{mt}">{"".join(parts)}</div>' |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def feed_op_author_compact_html( |
|
|
|
|
@ -122,37 +132,48 @@ def feed_op_author_compact_html(
@@ -122,37 +132,48 @@ def feed_op_author_compact_html(
|
|
|
|
|
*, |
|
|
|
|
status_inner_html: str, |
|
|
|
|
nip05_chips_html: str, |
|
|
|
|
muted: str, |
|
|
|
|
event_meta_inner_html: str, |
|
|
|
|
header_bg: str, |
|
|
|
|
border: str, |
|
|
|
|
text: str, |
|
|
|
|
dim: str, |
|
|
|
|
) -> str: |
|
|
|
|
"""Feed OP header: larger avatar, display name, compact npub line, NIP-38 + NIP-05.""" |
|
|
|
|
"""Feed OP header: name + optional NIP-38, then avatar beside npub / NIP-05 / event meta in a card.""" |
|
|
|
|
pk_l = pubkey_hex.strip().lower() |
|
|
|
|
href = html.escape(f"imwald://pub/{pk_l}", quote=True) |
|
|
|
|
av = avatar_img_or_placeholder(parsed, 64, border_hex=border, profile_href=href) |
|
|
|
|
name_e = html.escape(display_name_from_profile_or_hex(parsed, pubkey_hex)) |
|
|
|
|
npub_line, npub_title = _npub_header_lines(npub_bech) |
|
|
|
|
status_block = "" |
|
|
|
|
nip38_block = "" |
|
|
|
|
if status_inner_html.strip(): |
|
|
|
|
status_block = ( |
|
|
|
|
f'<div style="margin-top:12px;padding-top:12px;border-top:1px solid {border}" class="md">' |
|
|
|
|
nip38_block = ( |
|
|
|
|
f'<div style="margin-top:10px;padding-top:10px;border-top:1px solid {border}" class="md">' |
|
|
|
|
f"{status_inner_html}</div>" |
|
|
|
|
) |
|
|
|
|
meta_block = "" |
|
|
|
|
if event_meta_inner_html.strip(): |
|
|
|
|
meta_block = ( |
|
|
|
|
f'<div style="color:{dim};font-size:13px;line-height:1.5;margin:0">{event_meta_inner_html}</div>' |
|
|
|
|
) |
|
|
|
|
row_mt = "12px" if nip38_block else "8px" |
|
|
|
|
return ( |
|
|
|
|
f'<div style="display:flex;align-items:flex-start;gap:20px;margin:0 0 24px 0;' |
|
|
|
|
f'padding:4px 4px 22px 2px;border-bottom:1px solid {border}">' |
|
|
|
|
f"{av}" |
|
|
|
|
f'<div style="flex:1;min-width:0;padding-top:2px">' |
|
|
|
|
f'<div style="background:{header_bg};border:1px solid {border};border-radius:10px;' |
|
|
|
|
f'padding:14px 16px 18px;margin:0 0 22px 0">' |
|
|
|
|
f'<a href="{href}" style="text-decoration:none;color:inherit" title="View profile">' |
|
|
|
|
f'<div style="color:{text};font-size:22px;font-weight:700;letter-spacing:-0.03em;line-height:1.2">' |
|
|
|
|
f'<div style="color:{text};font-size:22px;font-weight:700;letter-spacing:-0.03em;line-height:1.25">' |
|
|
|
|
f"{name_e}</div>" |
|
|
|
|
f'<div style="margin-top:10px;font-size:13px;color:{dim};font-family:ui-monospace,Cascadia Mono,Consolas,' |
|
|
|
|
f'monospace;line-height:1.45;word-break:break-all" title="{npub_title}">{npub_line}</div>' |
|
|
|
|
f"</a>" |
|
|
|
|
f"{status_block}" |
|
|
|
|
f"{nip38_block}" |
|
|
|
|
f'<div style="display:flex;align-items:flex-start;gap:14px;margin-top:{row_mt}">' |
|
|
|
|
f"{av}" |
|
|
|
|
f'<div style="flex:1;min-width:0;display:flex;flex-direction:column;gap:12px">' |
|
|
|
|
f'<a href="{href}" style="text-decoration:none;color:inherit" title="View profile">' |
|
|
|
|
f'<div style="font-size:13px;color:{dim};font-family:ui-monospace,Cascadia Mono,Consolas,monospace;' |
|
|
|
|
f'line-height:1.5;word-break:break-all" title="{npub_title}">{npub_line}</div>' |
|
|
|
|
f"</a>" |
|
|
|
|
f"{nip05_chips_html}" |
|
|
|
|
f"</div></div>" |
|
|
|
|
f"{meta_block}" |
|
|
|
|
f"</div></div></div>" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|