|
|
|
|
@ -72,7 +72,7 @@ def format_nip05_chips_html(
@@ -72,7 +72,7 @@ def format_nip05_chips_html(
|
|
|
|
|
container_margin_top: str | None = None, |
|
|
|
|
) -> str: |
|
|
|
|
""" |
|
|
|
|
Horizontal row of NIP-05 chips: favicon (per domain), identifier, verification mark. |
|
|
|
|
Horizontal row of NIP-05 chips: identifier with domain favicon in place of ``@``, plus verification mark. |
|
|
|
|
|
|
|
|
|
``bool | None``: ``True`` verified, ``False`` failed, ``None`` pending / not checked. |
|
|
|
|
""" |
|
|
|
|
@ -81,13 +81,28 @@ def format_nip05_chips_html(
@@ -81,13 +81,28 @@ def format_nip05_chips_html(
|
|
|
|
|
parsed = parse_nip05_identifier(ident) |
|
|
|
|
dom = parsed[1] if parsed else "" |
|
|
|
|
fav = favicon_url_for_domain(dom) if dom else "" |
|
|
|
|
esc = html.escape(ident, quote=False) |
|
|
|
|
esc_full = html.escape(ident.strip(), quote=False) |
|
|
|
|
esc_full_attr = html.escape(ident.strip(), quote=True) |
|
|
|
|
esc_fav = html.escape(fav, quote=True) if fav else "" |
|
|
|
|
icon = "" |
|
|
|
|
if fav: |
|
|
|
|
icon = ( |
|
|
|
|
f'<img src="{esc_fav}" width="14" height="14" alt="" ' |
|
|
|
|
f'style="vertical-align:middle;border-radius:3px;opacity:0.92" />' |
|
|
|
|
raw = ident.strip() |
|
|
|
|
at_split = raw.rpartition("@") if "@" in raw else ("", "", "") |
|
|
|
|
local_raw, _at, dom_raw = at_split |
|
|
|
|
id_body: str |
|
|
|
|
if fav and local_raw and dom_raw: |
|
|
|
|
esc_local = html.escape(local_raw, quote=False) |
|
|
|
|
esc_dom = html.escape(dom_raw, quote=False) |
|
|
|
|
id_body = ( |
|
|
|
|
f'<span style="display:inline-flex;align-items:center;gap:5px;flex-wrap:nowrap" ' |
|
|
|
|
f'title="{esc_full_attr}">' |
|
|
|
|
f'<span style="color:{muted};font-size:14px;line-height:1.45">{esc_local}</span>' |
|
|
|
|
f'<img src="{esc_fav}" width="15" height="15" alt="" ' |
|
|
|
|
f'style="display:block;border-radius:3px;opacity:0.95;flex-shrink:0" />' |
|
|
|
|
f'<span style="color:{muted};font-size:14px;line-height:1.45">{esc_dom}</span>' |
|
|
|
|
f"</span>" |
|
|
|
|
) |
|
|
|
|
else: |
|
|
|
|
id_body = ( |
|
|
|
|
f'<span style="color:{muted};font-size:14px;line-height:1.45" title="{esc_full_attr}">{esc_full}</span>' |
|
|
|
|
) |
|
|
|
|
if okv is True: |
|
|
|
|
mark = f'<span style="color:{ok};font-size:15px;line-height:1" title="NIP-05 verified">✓</span>' |
|
|
|
|
@ -104,15 +119,10 @@ def format_nip05_chips_html(
@@ -104,15 +119,10 @@ def format_nip05_chips_html(
|
|
|
|
|
) |
|
|
|
|
else: |
|
|
|
|
wrap = ( |
|
|
|
|
"display:inline-flex;align-items:center;gap:10px;padding:4px 4px 4px 0;" |
|
|
|
|
"display:inline-flex;align-items:center;gap:8px;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:14px;line-height:1.45">{esc}</span>{mark}' |
|
|
|
|
f"</span>" |
|
|
|
|
) |
|
|
|
|
parts.append(f'<span style="{wrap}">{id_body}{mark}</span>') |
|
|
|
|
if not parts: |
|
|
|
|
return "" |
|
|
|
|
if container_margin_top is not None: |
|
|
|
|
|