feat(web5): discoverability container shows the node's npub, not the onion
The presence event deliberately never contains the onion — the npub is what's actually visible on the relays, and the UI previously showed neither it nor any way to find it. Same container, same styling; the copy button copies the npub. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
81858ab630
commit
61b380d266
@@ -884,7 +884,7 @@ class RPCClient {
|
||||
// `handshake.poll` queues inbound requests into the federation pending
|
||||
// inbox for manual approval (it does NOT auto-accept).
|
||||
|
||||
async nostrDiscoveryStatus(): Promise<{ enabled: boolean }> {
|
||||
async nostrDiscoveryStatus(): Promise<{ enabled: boolean; npub?: string | null }> {
|
||||
return this.call({ method: 'nostr.discovery-status', params: {} })
|
||||
}
|
||||
|
||||
|
||||
@@ -443,6 +443,7 @@
|
||||
"nodeVisibility": "Node Visibility",
|
||||
"nodeVisibilityDesc": "Control how other nodes can discover you",
|
||||
"yourTorAddress": "Your Tor address",
|
||||
"yourNodeNpub": "Your node's npub",
|
||||
"discoverableWarning": "Making your node discoverable lets other Archipelago users find and connect with you.",
|
||||
"noPeers": "No peers yet. Add a peer manually or use Discover to find nodes on Nostr.",
|
||||
"noRequests": "No pending connection requests.",
|
||||
@@ -493,6 +494,7 @@
|
||||
"failedToUpdatePrice": "Failed to update price",
|
||||
"failedToConnectPeer": "Failed to connect to peer",
|
||||
"onionAddressCopied": "Onion address copied",
|
||||
"npubCopied": "npub copied",
|
||||
"streamUrlCopied": "Stream URL copied",
|
||||
"playerError": "Unable to load media. The content may only be accessible over Tor.",
|
||||
"connectionAccepted": "Connection accepted",
|
||||
|
||||
@@ -441,6 +441,7 @@
|
||||
"nodeVisibility": "Visibilidad del nodo",
|
||||
"nodeVisibilityDesc": "Controle c\u00f3mo otros nodos pueden descubrirle",
|
||||
"yourTorAddress": "Su direcci\u00f3n Tor",
|
||||
"yourNodeNpub": "El npub de su nodo",
|
||||
"discoverableWarning": "Hacer su nodo descubrible permite que otros usuarios de Archipelago le encuentren y se conecten con usted.",
|
||||
"noPeers": "A\u00fan no hay pares. Agregue un par manualmente o use Descubrir para encontrar nodos en Nostr.",
|
||||
"noRequests": "No hay solicitudes de conexi\u00f3n pendientes.",
|
||||
@@ -491,6 +492,7 @@
|
||||
"failedToUpdatePrice": "Error al actualizar precio",
|
||||
"failedToConnectPeer": "Error al conectar con el par",
|
||||
"onionAddressCopied": "Direcci\u00f3n onion copiada",
|
||||
"npubCopied": "npub copiado",
|
||||
"streamUrlCopied": "URL de transmisi\u00f3n copiada",
|
||||
"playerError": "No se pudo cargar el contenido multimedia. Es posible que solo sea accesible a trav\u00e9s de Tor.",
|
||||
"connectionAccepted": "Conexi\u00f3n aceptada",
|
||||
|
||||
@@ -49,14 +49,15 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Onion address (shown when public) -->
|
||||
<div v-if="discoverEnabled && nodeOnionAddress" class="mt-4 p-3 bg-white/5 rounded-lg">
|
||||
<!-- The node's published npub (shown when discoverable) — this, not the
|
||||
onion, is what the presence event actually posts to the relays -->
|
||||
<div v-if="discoverEnabled && nodeNpub" class="mt-4 p-3 bg-white/5 rounded-lg">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<div class="min-w-0">
|
||||
<p class="text-xs text-white/50 mb-1">{{ t('web5.yourTorAddress') }}</p>
|
||||
<p class="text-xs font-mono text-white/80 truncate" :title="nodeOnionAddress">{{ nodeOnionAddress }}</p>
|
||||
<p class="text-xs text-white/50 mb-1">{{ t('web5.yourNodeNpub') }}</p>
|
||||
<p class="text-xs font-mono text-white/80 truncate" :title="nodeNpub">{{ nodeNpub }}</p>
|
||||
</div>
|
||||
<button @click="copyOnionAddress" class="shrink-0 p-2 rounded-lg text-white/50 hover:text-white hover:bg-white/10 transition-colors" title="Copy">
|
||||
<button @click="copyNpub" class="shrink-0 p-2 rounded-lg text-white/50 hover:text-white hover:bg-white/10 transition-colors" title="Copy">
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-1M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3m2 4H10m0 0l3-3m-3 3l3 3" />
|
||||
</svg>
|
||||
@@ -137,7 +138,7 @@ const emit = defineEmits<{
|
||||
}>()
|
||||
|
||||
const nodeVisibility = ref<VisibilityLevel>('hidden')
|
||||
const nodeOnionAddress = ref<string | null>(null)
|
||||
const nodeNpub = ref<string | null>(null)
|
||||
const visibilityLoading = ref(false)
|
||||
const settingVisibility = ref(false)
|
||||
const discoverEnabled = ref(false)
|
||||
@@ -173,8 +174,8 @@ async function loadVisibility() {
|
||||
.catch(() => null),
|
||||
])
|
||||
discoverEnabled.value = !!disc.enabled
|
||||
nodeNpub.value = disc.npub || null
|
||||
nodeVisibility.value = (vis?.visibility as VisibilityLevel) || 'hidden'
|
||||
nodeOnionAddress.value = vis?.onion_address || vis?.tor_address || null
|
||||
if (discoverEnabled.value) void discoverNodes()
|
||||
} catch {
|
||||
discoverEnabled.value = false
|
||||
@@ -245,10 +246,10 @@ async function requestToPeer(node: DiscoverableNode, message?: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function copyOnionAddress() {
|
||||
if (!nodeOnionAddress.value) return
|
||||
safeClipboardWrite(nodeOnionAddress.value)
|
||||
emit('toast', t('web5.onionAddressCopied'))
|
||||
function copyNpub() {
|
||||
if (!nodeNpub.value) return
|
||||
safeClipboardWrite(nodeNpub.value)
|
||||
emit('toast', t('web5.npubCopied'))
|
||||
}
|
||||
|
||||
defineExpose({ loadVisibility })
|
||||
|
||||
Reference in New Issue
Block a user