diff options
| author | Adam Soltys <[email protected]> | 2026-08-02 19:45:21 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-08-02 19:45:21 -0700 |
| commit | 49a2dd2761fa6ede9f0de4d50cdc4c1c1f731147 (patch) | |
| tree | a2c16cfaebb8edc253b7a9909767568208db6ceb /src | |
| parent | fb814232c84d2b03782869c956fee57548e6f708 (diff) | |
| download | coinosv3-49a2dd2761fa6ede9f0de4d50cdc4c1c1f731147.tar.gz coinosv3-49a2dd2761fa6ede9f0de4d50cdc4c1c1f731147.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wvj4aoeMZwA7VUGdJP9Swi
Diffstat (limited to 'src')
| -rw-r--r-- | src/features/messages.js | 5 | ||||
| -rw-r--r-- | src/features/names.js | 4 | ||||
| -rw-r--r-- | src/recipient-search.js | 2 |
3 files changed, 6 insertions, 5 deletions
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(); diff --git a/src/recipient-search.js b/src/recipient-search.js index 5cc8315..2594488 100644 --- a/src/recipient-search.js +++ b/src/recipient-search.js @@ -157,6 +157,6 @@ export function resultRows(h, rows, onPick) { ? h('img', { class: 'chat-avatar', src: r.picture, alt: '' }) : fallbackAvatar(h, r.pk, r.name, 'chat-avatar'), h('div', { class: 'col grow', style: 'min-width:0;gap:1px' }, - h('div', { class: 'chat-name' }, r.name || (npubOf(r.pk) || '').slice(0, 14) + '…'), + h('div', { class: 'chat-name' }, r.name || (npubOf(r.pk) || '').slice(0, 12)), h('div', { class: 'muted small chat-preview' }, r.address || r.nip05 || (npubOf(r.pk) || '').slice(0, 24) + '…')))); } |
