Show durable connection requests and timestamped node availability

This commit is contained in:
archipelago
2026-10-05 23:10:34 -04:00
parent 10d31ae13c
commit 0c25449566
20 changed files with 473 additions and 142 deletions
+7 -4
View File
@@ -181,6 +181,7 @@
<PendingRequestsPanel
:requests="pendingRequests"
:peer-dids="nodes.map(node => node.did)"
:polling="pollingHandshake"
:busy-id="pendingBusyId"
@poll="pollHandshake"
@@ -259,6 +260,7 @@
<script setup lang="ts">
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { validContact, lastContactLabel } from './web5/nodeAvailability'
import { rpcClient } from '@/api/rpc-client'
import { useCachedResource } from '@/composables/useCachedResource'
import { useTransportStore } from '@/stores/transport'
@@ -347,6 +349,7 @@ const selfDid = ref<string>((() => {
try { return localStorage.getItem('neode_did') || '' } catch { return '' }
})())
const availabilityNow = ref(Date.now())
const mapNodes = computed(() => {
const result = []
if (selfDid.value) {
@@ -365,6 +368,7 @@ const mapNodes = computed(() => {
label: nodeName(node),
trust_level: node.trust_level as 'trusted' | 'observer' | 'untrusted',
online: isOnlineCheck(node),
statusLabel: isOnlineCheck(node) ? 'Online' : lastContactLabel(node.last_seen, availabilityNow.value),
app_count: node.last_state?.apps?.length ?? 0,
is_self: false,
})
@@ -570,10 +574,8 @@ async function cancelPending(id: string) {
}
function isOnlineCheck(node: FederatedNode): boolean {
if (!node.last_seen) return false
const lastSeen = new Date(node.last_seen).getTime()
const tenMinutesAgo = Date.now() - 10 * 60 * 1000
return lastSeen > tenMinutesAgo
const lastSeen = validContact(node.last_seen, availabilityNow.value)
return lastSeen !== undefined && availabilityNow.value - lastSeen < 10 * 60 * 1000
}
/** Explicit reload (mutations, retry): surfaces a load failure in the error
@@ -830,6 +832,7 @@ onMounted(async () => {
// Self DID not available
}
autoRefreshTimer = setInterval(() => {
availabilityNow.value = Date.now()
void nodesRes.refresh()
loadPendingRequests()
}, 5000)