Sorts the exported file by time.

This commit is contained in:
Vitor Pamplona 2023-08-03 16:48:22 -04:00
parent a8a98d3b89
commit 6698849aad
2 changed files with 4 additions and 5 deletions

View File

@ -34,10 +34,9 @@ const fetchAndBroadcast = async () => {
// get all events from relays
const filters =[{ authors: [pubkey] }, { "#p": [pubkey] }]
const data = await getEvents(filters, pubkey)
const kind3 = data.filter((it) => it.kind == 3 && it.pubkey === pubkey).sort((a, b) => b.created_at - a.created_at)[0]
const myRelaySet = JSON.parse(kind3.content)
const data = (await getEvents(filters, pubkey)).sort((a, b) => b.created_at - a.created_at)
const latestKind3 = data.filter((it) => it.kind == 3 && it.pubkey === pubkey)[0]
const myRelaySet = JSON.parse(latestKind3.content)
relays = Object.keys(myRelaySet).filter(url => myRelaySet[url].write).map(url => url)
$('#checking-relays-header-box').css('display', 'none')

View File

@ -98,7 +98,7 @@ function hexToBytes(hex) {
myTimeout = setTimeout(() => {
ws.close()
reject('timeout')
}, 5_000)
}, 10_000)
const { id } = data