mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-11 17:55:51 +00:00
Try 10 times to download keys
This commit is contained in:
parent
7a8bbab6d1
commit
950d098249
@ -2870,6 +2870,10 @@ class GroupManagement extends LitElement {
|
|||||||
let gAdmin = ''
|
let gAdmin = ''
|
||||||
let gAddress = ''
|
let gAddress = ''
|
||||||
let keysToOld = "Wait until an admin re-encrypts the keys. Only unencrypted messages will be displayed."
|
let keysToOld = "Wait until an admin re-encrypts the keys. Only unencrypted messages will be displayed."
|
||||||
|
let retryDownload = "Retry downloading and decrypt keys in 5 seconds! Please wait..."
|
||||||
|
let failDownload = "Error downloading and decrypt keys! Only unencrypted messages will be displayed. Please try again later..."
|
||||||
|
let all_ok = false
|
||||||
|
let counter = 0
|
||||||
|
|
||||||
const symIdentifier = 'symmetric-qchat-group-' + groupId
|
const symIdentifier = 'symmetric-qchat-group-' + groupId
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
@ -2920,10 +2924,26 @@ class GroupManagement extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (adminExists(gAddress)) {
|
if (adminExists(gAddress)) {
|
||||||
|
const sleep = (t) => new Promise(r => setTimeout(r, t))
|
||||||
const dataUrl = `${nodeUrl}/arbitrary/DOCUMENT_PRIVATE/${gAdmin}/${symIdentifier}?encoding=base64&rebuild=true&async=true`
|
const dataUrl = `${nodeUrl}/arbitrary/DOCUMENT_PRIVATE/${gAdmin}/${symIdentifier}?encoding=base64&rebuild=true&async=true`
|
||||||
const res = await fetch(dataUrl)
|
const res = await fetch(dataUrl)
|
||||||
|
|
||||||
|
do {
|
||||||
|
counter++
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
parentEpml.request('showSnackBar', `${retryDownload}`)
|
||||||
|
await sleep(5000)
|
||||||
|
} else {
|
||||||
data = await res.text()
|
data = await res.text()
|
||||||
|
all_ok = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (counter > 10) {
|
||||||
|
parentEpml.request('showSnackBar', `${failDownload}`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} while (!all_ok)
|
||||||
|
|
||||||
const decryptedKey = await this.decryptGroupEncryption(data)
|
const decryptedKey = await this.decryptGroupEncryption(data)
|
||||||
|
|
||||||
|
@ -452,8 +452,12 @@ class Chat extends LitElement {
|
|||||||
let gAddress = ''
|
let gAddress = ''
|
||||||
let currentGroupId = url.substring(6)
|
let currentGroupId = url.substring(6)
|
||||||
let symIdentifier = 'symmetric-qchat-group-' + currentGroupId
|
let symIdentifier = 'symmetric-qchat-group-' + currentGroupId
|
||||||
let locateString = "Downloading and decrypt keys ! Please wait..."
|
let locateString = "Downloading and decrypt keys! Please wait..."
|
||||||
let keysToOld = "Wait until an admin re-encrypts the keys. Only unencrypted messages will be displayed."
|
let keysToOld = "Wait until an admin re-encrypts the keys. Only unencrypted messages will be displayed."
|
||||||
|
let retryDownload = "Retry downloading and decrypt keys in 5 seconds! Please wait..."
|
||||||
|
let failDownload = "Error downloading and decrypt keys! Only unencrypted messages will be displayed. Please try again later..."
|
||||||
|
let all_ok = false
|
||||||
|
let counter = 0
|
||||||
|
|
||||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
|
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
|
||||||
@ -510,10 +514,28 @@ class Chat extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (adminExists(gAddress)) {
|
if (adminExists(gAddress)) {
|
||||||
|
const sleep = (t) => new Promise(r => setTimeout(r, t))
|
||||||
const dataUrl = `${nodeUrl}/arbitrary/DOCUMENT_PRIVATE/${gAdmin}/${symIdentifier}?encoding=base64&rebuild=true&async=true`
|
const dataUrl = `${nodeUrl}/arbitrary/DOCUMENT_PRIVATE/${gAdmin}/${symIdentifier}?encoding=base64&rebuild=true&async=true`
|
||||||
const res = await fetch(dataUrl)
|
const res = await fetch(dataUrl)
|
||||||
|
|
||||||
|
do {
|
||||||
|
counter++
|
||||||
|
|
||||||
|
if (!res.ok) {
|
||||||
|
parentEpml.request('showSnackBar', `${retryDownload}`)
|
||||||
|
await sleep(5000)
|
||||||
|
} else {
|
||||||
data = await res.text()
|
data = await res.text()
|
||||||
|
all_ok = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (counter > 10) {
|
||||||
|
parentEpml.request('showSnackBar', `${failDownload}`)
|
||||||
|
this.activeChatHeadUrl = url
|
||||||
|
this.requestUpdate()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} while (!all_ok)
|
||||||
|
|
||||||
const decryptedKey = await this.decryptGroupEncryption(data)
|
const decryptedKey = await this.decryptGroupEncryption(data)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user