mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-11 17:55:51 +00:00
add bootstrap button to node and added new request
This commit is contained in:
parent
fee90d4934
commit
02c378687b
@ -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."
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {css, html, LitElement} from 'lit'
|
||||
import {render} from 'lit/html.js'
|
||||
import {Epml} from '../../../epml.js'
|
||||
import { css, html, LitElement } from 'lit'
|
||||
import { render } from 'lit/html.js'
|
||||
import { Epml } from '../../../epml.js'
|
||||
import isElectron from 'is-electron'
|
||||
import {get, registerTranslateConfig, translate, use} from '../../../../core/translate/index.js'
|
||||
import { get, registerTranslateConfig, translate, use } from '../../../../core/translate/index.js'
|
||||
import '@polymer/paper-spinner/paper-spinner-lite.js'
|
||||
import '@material/mwc-icon'
|
||||
import '@material/mwc-textfield'
|
||||
@ -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> ${translate("tour.tour18")}</mwc-button>
|
||||
<mwc-button style="float:right;" class="red" ?hidden="${(this.upTime === "offline")}" @click=${() => this.stopNode()}><mwc-icon>dangerous</mwc-icon> ${translate("nodepage.nchange31")}</mwc-button>
|
||||
<mwc-button style="float:right;" ?hidden="${(this.upTime === "offline")}" @click=${() => this.restartNode()}><mwc-icon>360</mwc-icon> ${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}`)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {css, html, LitElement} from 'lit'
|
||||
import {Epml} from '../../../../epml'
|
||||
import { css, html, LitElement } from 'lit'
|
||||
import { Epml } from '../../../../epml'
|
||||
import isElectron from 'is-electron'
|
||||
import {get, registerTranslateConfig, translate, use} from '../../../../../core/translate/index.js'
|
||||
import { get, registerTranslateConfig, translate, use } from '../../../../../core/translate/index.js'
|
||||
import ShortUniqueId from 'short-unique-id';
|
||||
import FileSaver from 'file-saver'
|
||||
import * as actions from '../../components/qdn-action-types'
|
||||
@ -10,10 +10,10 @@ import '@material/mwc-icon'
|
||||
import '@material/mwc-checkbox'
|
||||
import WebWorker from 'web-worker:./computePowWorkerFile.src.js'
|
||||
import WebWorkerChat from 'web-worker:./computePowWorker.src.js'
|
||||
import {publishData} from '../../../utils/publish-image.js'
|
||||
import {Loader} from '../../../utils/loader.js';
|
||||
import {QORT_DECIMALS} from '../../../../../crypto/api/constants'
|
||||
import {mimeToExtensionMap} from '../../components/qdn-action-constants';
|
||||
import { publishData } from '../../../utils/publish-image.js'
|
||||
import { Loader } from '../../../utils/loader.js';
|
||||
import { QORT_DECIMALS } from '../../../../../crypto/api/constants'
|
||||
import { mimeToExtensionMap } from '../../components/qdn-action-constants';
|
||||
import {
|
||||
base64ToUint8Array,
|
||||
decryptDeprecatedSingle,
|
||||
@ -467,7 +467,7 @@ class WebBrowser extends LitElement {
|
||||
return joinFee
|
||||
}
|
||||
|
||||
async getArbitraryFee (){
|
||||
async getArbitraryFee() {
|
||||
const timestamp = Date.now()
|
||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||
const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
|
||||
@ -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
|
||||
@ -1100,7 +1139,7 @@ class WebBrowser extends LitElement {
|
||||
try {
|
||||
let list = JSON.parse(localStorage.getItem('friends-my-friend-list') || "[]")
|
||||
|
||||
list = list.map((friend)=> friend.name || "")
|
||||
list = list.map((friend) => friend.name || "")
|
||||
response = JSON.stringify(list)
|
||||
} catch (error) {
|
||||
const data = {}
|
||||
@ -1496,7 +1535,7 @@ class WebBrowser extends LitElement {
|
||||
})
|
||||
|
||||
worker.terminate()
|
||||
await new Promise((res)=> {
|
||||
await new Promise((res) => {
|
||||
setTimeout(() => {
|
||||
res()
|
||||
}, 1000);
|
||||
@ -1523,7 +1562,7 @@ class WebBrowser extends LitElement {
|
||||
|
||||
}
|
||||
this.loader.hide()
|
||||
if(failedPublishesIdentifiers.length > 0){
|
||||
if (failedPublishesIdentifiers.length > 0) {
|
||||
response = failedPublishesIdentifiers
|
||||
const obj = {}
|
||||
const errorMsg = {
|
||||
@ -1642,7 +1681,7 @@ class WebBrowser extends LitElement {
|
||||
}
|
||||
|
||||
case actions.OPEN_NEW_TAB: {
|
||||
if(!data.qortalLink){
|
||||
if (!data.qortalLink) {
|
||||
const obj = {}
|
||||
const errorMsg = 'Please enter a qortal link - qortal://...'
|
||||
obj['error'] = errorMsg
|
||||
@ -1674,7 +1713,7 @@ class WebBrowser extends LitElement {
|
||||
name: this.name
|
||||
}
|
||||
)
|
||||
if (res.action === 'accept'){
|
||||
if (res.action === 'accept') {
|
||||
this.addAppToNotificationList(this.name)
|
||||
response = true
|
||||
break
|
||||
@ -1694,7 +1733,7 @@ class WebBrowser extends LitElement {
|
||||
try {
|
||||
const id = `appNotificationList-${this.selectedAddress.address}`
|
||||
const checkData = localStorage.getItem(id) ? JSON.parse(localStorage.getItem(id)) : null
|
||||
if(!checkData || !checkData[this.name]) throw new Error('App not on permission list')
|
||||
if (!checkData || !checkData[this.name]) throw new Error('App not on permission list')
|
||||
const appInfo = checkData[this.name]
|
||||
const lastNotification = appInfo.lastNotification
|
||||
const interval = appInfo.interval
|
||||
@ -1711,7 +1750,7 @@ class WebBrowser extends LitElement {
|
||||
} else {
|
||||
throw new Error(`invalid data`)
|
||||
}
|
||||
} else if(!lastNotification){
|
||||
} else if (!lastNotification) {
|
||||
parentEpml.request('showNotification', {
|
||||
title, type: "qapp-local-notification", sound: '', url, options: { body: message, icon, badge: icon }
|
||||
})
|
||||
@ -2261,7 +2300,7 @@ class WebBrowser extends LitElement {
|
||||
function handleResponseEvent(event) {
|
||||
// Handle the data from the event, if any
|
||||
const responseData = event.detail;
|
||||
if(responseData && responseData.uniqueId !== uniqueId) return
|
||||
if (responseData && responseData.uniqueId !== uniqueId) return
|
||||
// Clean up by removing the event listener once we've received the response
|
||||
window.removeEventListener('qortal-request-set-profile-data-response', handleResponseEvent);
|
||||
|
||||
@ -2275,7 +2314,7 @@ class WebBrowser extends LitElement {
|
||||
// Set up an event listener to wait for the response
|
||||
window.addEventListener('qortal-request-set-profile-data-response', handleResponseEvent);
|
||||
});
|
||||
if(!res.response) throw new Error('Failed to set property')
|
||||
if (!res.response) throw new Error('Failed to set property')
|
||||
response = JSON.stringify(res.response);
|
||||
|
||||
} catch (error) {
|
||||
@ -3577,7 +3616,7 @@ class WebBrowser extends LitElement {
|
||||
}
|
||||
|
||||
addAppToNotificationList(appName) {
|
||||
if(!appName) throw new Error('unknown app name')
|
||||
if (!appName) throw new Error('unknown app name')
|
||||
const id = `appNotificationList-${this.selectedAddress.address}`
|
||||
const checkData = localStorage.getItem(id) ? JSON.parse(localStorage.getItem(id)) : null
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user