4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-11 17:55:51 +00:00

Merge pull request #243 from Philreact/feature/node-bootstrap-button

add bootstrap button to node and added new request
This commit is contained in:
AlphaX-Projects 2024-01-03 14:41:35 +01:00 committed by GitHub
commit 581257163e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 221 additions and 168 deletions

View File

@ -1274,7 +1274,7 @@
"tour16": "Checklist",
"tour17": "Please start the Core to access the Qortal blockchain.",
"tour18": "Refresh (bootstrap)",
"tour19": "Currently syncing... you must be fully synchronized to use Qortal",
"tour19": "Currently syncing... you must be fully synchronized to use Qortal.",
"tour20": "blocks behind. Would you like to refresh (bootstrap) to speed up the syncing process?",
"tour21": "blocks remaining.",
"tour22": "Refresh (bootstrap) requested. Please wait."

View File

@ -150,6 +150,7 @@ class NodeManagement extends LitElement {
<div id="node-management-page">
<div class="node-card">
<h2>${translate("nodepage.nchange1")} ${this.nodeDomain}</h2>
<mwc-button style="float:right;" ?hidden="${(this.upTime === "offline")}" @click=${() => this.bootstrap()}><mwc-icon>restart_alt</mwc-icon>&nbsp;${translate("tour.tour18")}</mwc-button>
<mwc-button style="float:right;" class="red" ?hidden="${(this.upTime === "offline")}" @click=${() => this.stopNode()}><mwc-icon>dangerous</mwc-icon>&nbsp;${translate("nodepage.nchange31")}</mwc-button>
<mwc-button style="float:right;" ?hidden="${(this.upTime === "offline")}" @click=${() => this.restartNode()}><mwc-icon>360</mwc-icon>&nbsp;${translate("nodepage.nchange33")}</mwc-button>
<span class="sblack"><br>${translate("nodepage.nchange2")} ${this.upTime}</span>
@ -425,16 +426,29 @@ class NodeManagement extends LitElement {
})
}
bootstrap() {
parentEpml
.request("apiCall", {
url: `/admin/bootstrap/?apiKey=${this.getApiKey()}`,
method: "GET"
})
.then((res) => {
if (res === true) {
let snackString = get("tour.tour22")
parentEpml.request('showSnackBar', `${snackString}`)
}
})
}
async addPeer() {
this.addPeerLoading = true
const addPeerAddress = this.shadowRoot.getElementById('addPeerAddress').value
console.log("ADDRESS", addPeerAddress)
await parentEpml.request("apiCall", {
url: `/peers?apiKey=${this.getApiKey()}`,
method: "POST",
body: addPeerAddress
}).then((res) => {
console.log("RES", res)
if (res === true) {
let trueString = get("walletpage.wchange52")
parentEpml.request('showSnackBar', `${trueString}`)

View File

@ -836,6 +836,45 @@ class WebBrowser extends LitElement {
}
}
case actions.ENCRYPT_DATA: {
try {
let dataSentBack = {}
let data64 = data.data64
let publicKeys = data.publicKeys || []
if (data.file) {
data64 = await fileToBase64(data.file)
}
if (!data64) {
dataSentBack['error'] = "Please include data to encrypt"
response = JSON.stringify(dataSentBack)
break
}
const encryptDataResponse = encryptDataGroup({
data64, publicKeys: publicKeys
})
if (encryptDataResponse) {
data64 = encryptDataResponse
response = JSON.stringify(encryptDataResponse)
break;
} else {
dataSentBack['error'] = "Unable to encrypt"
response = JSON.stringify(dataSentBack)
break
}
} catch (error) {
const data = {}
const errorMsg = error.message || "Error in encrypting data"
data['error'] = errorMsg
response = JSON.stringify(data)
break
}
}
case actions.DECRYPT_DATA: {
const { encryptedData, publicKey } = data