From 49a2dd2761fa6ede9f0de4d50cdc4c1c1f731147 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 2 Aug 2026 19:45:21 -0700 Subject: Identity polish: 12-char npub default names, no ellipsis, copyable npub The registrar's auto-claimed username and every npub-fallback display name use the npub's first 12 characters, shown whole (no truncation dots), and the profile page's npub gets a copy button. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01Wvj4aoeMZwA7VUGdJP9Swi --- src/features/messages.js | 5 +++-- src/features/names.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/features') diff --git a/src/features/messages.js b/src/features/messages.js index 1a03bcc..f95c8c7 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -48,7 +48,7 @@ const APP_BASE = 'https://v3.coinos.io'; const CACHE_MAX = 50; // messages kept per channel / per DM thread in feature state export function messagesFeature(ctx) { - const { h, ui, render, wallet, toast, hook } = ctx; + const { h, ui, render, wallet, toast, hook, copyBtn } = ctx; // ---- persisted state ---------------------------------------------------- @@ -124,7 +124,7 @@ export function messagesFeature(ctx) { const p = profileOf(pk); if (p && p.name) return p.name; const npub = npubOf(pk); - return npub ? npub.slice(0, 12) + '…' : pk.slice(0, 12) + '…'; + return npub ? npub.slice(0, 12) : pk.slice(0, 12); }; // ---- community rooms ---------------------------------------------------- @@ -865,6 +865,7 @@ export function messagesFeature(ctx) { ? h('div', { class: 'row gap6', style: 'align-items:center' }, h('span', { class: 'spinner sm' })) : full.about ? h('p', { class: 'small', style: 'margin:0;white-space:pre-wrap' }, String(full.about).slice(0, 1000)) : null, h('div', { class: 'addr-box break', style: 'font-size:11px' }, npub), + copyBtn(npub, t('copyKey')), ui.profEdit ? h('div', { class: 'col', style: 'gap:8px' }, field(t('profName'), 'name'), diff --git a/src/features/names.js b/src/features/names.js index d6acc6a..3952214 100644 --- a/src/features/names.js +++ b/src/features/names.js @@ -140,7 +140,7 @@ export function namesFeature(ctx) { // npub happens at login instead (adoptIdentity below), where a // signer is already live — an address must never wait on a popup. const own = wallet.nostrNpub && wallet.nostrNpub(); - if (own) { await claim(own.slice(0, 20), {}); st = load(); } + if (own) { await claim(own.slice(0, 12), {}); st = load(); } } checked = true; clearTimeout(deadline); deadline = null; @@ -167,7 +167,7 @@ export function namesFeature(ctx) { // wallet key to keep the record updated afterwards. async function adoptIdentity(signer, npub) { if (!signer || !npub || !available()) return null; - const name = npub.slice(0, 20); + const name = npub.slice(0, 12); if (load().name === name) return name; await claim(name, { signer, manager: wallet.nostrPubkey() }); render(); -- cgit v1.2.3