Bugfix for the fetching progress bar value updating with relay set from the broadcasting

This commit is contained in:
Vitor Pamplona 2023-08-03 17:20:41 -04:00
parent 6698849aad
commit 3990c26c47

View File

@ -35,16 +35,17 @@ const fetchAndBroadcast = async () => {
// get all events from relays
const filters =[{ authors: [pubkey] }, { "#p": [pubkey] }]
const data = (await getEvents(filters, pubkey)).sort((a, b) => b.created_at - a.created_at)
// inform user fetching is done
$('#fetching-status').html(txt.fetching + checkMark)
$('#fetching-progress').val(relays.length)
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')
$('#checking-relays-box').css('display', 'none')
// inform user fetching is done
$('#fetching-status').html(txt.fetching + checkMark)
$('#fetching-progress').val(relays.length)
// inform user that backup file (js format) is being downloaded
$('#file-download').html(txt.download)
downloadFile(data, 'nostr-backup.js')