mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-23 15:45:48 +00:00
commit
af8dcae748
@ -86,5 +86,16 @@ export const defaultQappsTabs = [
|
||||
"pluginNumber": "plugin-GGHiHzW6pe",
|
||||
"menus": [],
|
||||
"parent": false
|
||||
},
|
||||
{
|
||||
"url": "myapp",
|
||||
"domain": "core",
|
||||
"page": "qdn/browser/index.html?name=Q-Mintership&service=APP",
|
||||
"title": "Q-Mintership",
|
||||
"icon": "vaadin:external-browser",
|
||||
"mwcicon": "apps",
|
||||
"pluginNumber": "plugin-GGJJPqW6pe",
|
||||
"menus": [],
|
||||
"parent": false
|
||||
}
|
||||
]
|
@ -50,5 +50,13 @@ export const decryptChatMessageBase64 = (encryptedMessage, privateKey, recipient
|
||||
return _decryptedMessage
|
||||
}
|
||||
|
||||
let decrypted1 = new TextDecoder('utf-8').decode(_decryptedMessage)
|
||||
|
||||
if (decrypted1.includes('messageText')) {
|
||||
let decrypted2 = JSON.parse(decrypted1)
|
||||
let decrypted3 = Object.assign(decrypted2, {isFrivate: true})
|
||||
return JSON.stringify(decrypted3)
|
||||
}
|
||||
|
||||
return new TextDecoder('utf-8').decode(_decryptedMessage)
|
||||
}
|
||||
|
@ -129,7 +129,19 @@ class ChatHead extends LitElement {
|
||||
>
|
||||
${this.chatInfo.groupName ? this.chatInfo.groupName : this.chatInfo.name !== undefined ? this.chatInfo.name : this.chatInfo.address.substr(0, 15)}
|
||||
</span>
|
||||
<mwc-icon style="font-size:18px; color: var(--chat-group);">${this.chatInfo.groupId !== undefined ? 'lock_open' : 'lock'}</mwc-icon>
|
||||
<mwc-icon
|
||||
style="font-size:18px; color:${
|
||||
this.chatInfo.groupId === undefined ? '#f0ad4e' :
|
||||
this.chatInfo.isOpen === false ? '#C6011F' :
|
||||
this.chatInfo.isOpen === true ? '#198754' : '#198754'}"
|
||||
>
|
||||
${
|
||||
this.chatInfo.groupId === undefined ? 'private_connectivity' :
|
||||
this.chatInfo.isOpen === false ? 'lock_outline' :
|
||||
this.chatInfo.isOpen === true ? 'lock_open' :
|
||||
'lock_open'
|
||||
}
|
||||
</mwc-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="about" style="margin-top:7px">
|
||||
|
@ -1106,7 +1106,7 @@ class MessageTemplate extends LitElement {
|
||||
version = parsedMessageObj.version
|
||||
isForwarded = parsedMessageObj.type === 'forward'
|
||||
isEdited = parsedMessageObj.isEdited && true
|
||||
isEncrypted = parsedMessageObj.isFromHub || parsedMessageObj.message ? true : false
|
||||
isEncrypted = parsedMessageObj.isFromHub || parsedMessageObj.isFrivate || parsedMessageObj.message ? true : false
|
||||
|
||||
if (parsedMessageObj.images && Array.isArray(parsedMessageObj.images) && parsedMessageObj.images.length > 0) {
|
||||
image = parsedMessageObj.images[0]
|
||||
|
@ -2893,6 +2893,14 @@ export const decryptChatMessageBase64 = (encryptedMessage, privateKey, recipient
|
||||
return _decryptedMessage
|
||||
}
|
||||
|
||||
let decrypted1 = new TextDecoder('utf-8').decode(_decryptedMessage)
|
||||
|
||||
if (decrypted1.includes('messageText')) {
|
||||
let decrypted2 = JSON.parse(decrypted1)
|
||||
let decrypted3 = Object.assign(decrypted2, {isFrivate: true})
|
||||
return JSON.stringify(decrypted3)
|
||||
}
|
||||
|
||||
return new TextDecoder('utf-8').decode(_decryptedMessage)
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import '@vaadin/grid'
|
||||
|
||||
// Multi language support
|
||||
import { get, registerTranslateConfig, translate, use } from '../../../../core/translate'
|
||||
|
||||
registerTranslateConfig({
|
||||
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
||||
})
|
||||
@ -427,7 +428,9 @@ class NodeManagement extends LitElement {
|
||||
|
||||
async addPeer() {
|
||||
this.addPeerLoading = true
|
||||
|
||||
const addPeerAddress = this.shadowRoot.getElementById('addPeerAddress').value
|
||||
|
||||
await parentEpml.request('apiCall', {
|
||||
url: `/peers?apiKey=${this.getApiKey()}`,
|
||||
method: 'POST',
|
||||
@ -456,7 +459,6 @@ class NodeManagement extends LitElement {
|
||||
addMintingAccount() {
|
||||
this.addMintingAccountLoading = true
|
||||
this.addMintingAccountMessage = 'Loading...'
|
||||
|
||||
this.addMintingAccountKey = this.shadowRoot.querySelector('#addMintingAccountKey').value
|
||||
|
||||
parentEpml.request('apiCall', {
|
||||
@ -479,6 +481,7 @@ class NodeManagement extends LitElement {
|
||||
|
||||
updateMintingAccounts() {
|
||||
this.mintingAccounts = []
|
||||
|
||||
parentEpml.request('apiCall', {
|
||||
url: `/admin/mintingaccounts?apiKey=${this.getApiKey()}`,
|
||||
method: 'GET'
|
||||
@ -518,10 +521,6 @@ class NodeManagement extends LitElement {
|
||||
if (!arr) { return true }
|
||||
return arr.length === 0
|
||||
}
|
||||
|
||||
round(number) {
|
||||
return (Math.round(parseFloat(number) * 1e8) / 1e8).toFixed(8)
|
||||
}
|
||||
}
|
||||
|
||||
window.customElements.define('node-management', NodeManagement)
|
@ -10,6 +10,7 @@ import '@vaadin/button'
|
||||
|
||||
// Multi language support
|
||||
import { get, registerTranslateConfig, translate, use } from '../../../../core/translate'
|
||||
|
||||
registerTranslateConfig({
|
||||
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
||||
})
|
||||
@ -144,7 +145,6 @@ class OverviewPage extends LitElement {
|
||||
async firstUpdated() {
|
||||
this.changeTheme()
|
||||
this.changeLanguage()
|
||||
|
||||
this.nodeConfig = window.parent.reduxStore.getState().app.nodeConfig
|
||||
this.accountInfo = window.parent.reduxStore.getState().app.accountInfo
|
||||
|
||||
@ -199,11 +199,13 @@ class OverviewPage extends LitElement {
|
||||
|
||||
changeTheme() {
|
||||
const checkTheme = localStorage.getItem('qortalTheme')
|
||||
|
||||
if (checkTheme === 'dark') {
|
||||
this.theme = 'dark'
|
||||
} else {
|
||||
this.theme = 'light'
|
||||
}
|
||||
|
||||
document.querySelector('html').setAttribute('theme', this.theme)
|
||||
}
|
||||
|
||||
@ -225,6 +227,7 @@ class OverviewPage extends LitElement {
|
||||
async refreshItems() {
|
||||
this.nodeConfig = window.parent.reduxStore.getState().app.nodeConfig
|
||||
this.accountInfo = window.parent.reduxStore.getState().app.accountInfo
|
||||
|
||||
await this.getNodeInfo()
|
||||
await this.getCoreInfo()
|
||||
await this.getBalanceInfo()
|
||||
@ -234,12 +237,14 @@ class OverviewPage extends LitElement {
|
||||
async getMintingKeysList() {
|
||||
this.check1 = false
|
||||
this.check2 = false
|
||||
|
||||
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||
const nodeStatus = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
|
||||
const statusUrl = `${nodeStatus}/admin/mintingaccounts`
|
||||
const statusUrl = `${nodeStatus}/admin/mintingaccounts?apiKey=${this.getApiKey()}`
|
||||
|
||||
try {
|
||||
const res = await fetch(statusUrl)
|
||||
|
||||
this.listAccounts = await res.json()
|
||||
|
||||
const addressInfo = window.parent.reduxStore.getState().app.accountInfo.addressInfo
|
||||
@ -249,7 +254,6 @@ class OverviewPage extends LitElement {
|
||||
const findRemovedSponsorsKey = this.listAccounts.filter((my) => my.address)
|
||||
|
||||
this.check1 = findMyMintingAccount !== undefined
|
||||
|
||||
this.check2 = findMyMintingRecipient !== undefined
|
||||
|
||||
if (findRemovedSponsorsKey.length > 0) {
|
||||
@ -285,8 +289,7 @@ class OverviewPage extends LitElement {
|
||||
this.cssStatus = ''
|
||||
return html`<span class="btn btn-sm btn-info float-right">${translate("walletprofile.wp1")}</span>`
|
||||
} else if (this.nodeInfo.isMintingPossible === true && this.nodeInfo.isSynchronizing === false && this.check1 === false && this.check2 === true && addressInfo.level == 0 && addressInfo.blocksMinted < 7200) {
|
||||
this.cssStatus = ''
|
||||
return html`<span class="btn btn-sm btn-info float-right">${translate("becomeMinterPage.bchange12")}</span>`
|
||||
return html`<span class="float-right"><start-minting-now></start-minting-now></span>`
|
||||
} else if (this.check1 === false && this.check2 === false && myMintingKey === true) {
|
||||
return html`<span class="float-right"><start-minting-now></start-minting-now></span>`
|
||||
} else if (myMintingKey === false) {
|
||||
@ -319,6 +322,7 @@ class OverviewPage extends LitElement {
|
||||
const infoNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||
const infoNodeUrl = infoNode.protocol + '://' + infoNode.domain + ':' + infoNode.port
|
||||
const nodeUrl = `${infoNodeUrl}/admin/status`
|
||||
|
||||
await fetch(nodeUrl).then(response => {
|
||||
return response.json()
|
||||
}).then(data => {
|
||||
@ -332,6 +336,7 @@ class OverviewPage extends LitElement {
|
||||
const infoCore = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||
const infoCoreUrl = infoCore.protocol + '://' + infoCore.domain + ':' + infoCore.port
|
||||
const coreUrl = `${infoCoreUrl}/admin/info`
|
||||
|
||||
await fetch(coreUrl).then(response => {
|
||||
return response.json()
|
||||
}).then(data => {
|
||||
@ -344,6 +349,7 @@ class OverviewPage extends LitElement {
|
||||
const infoBalance = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||
const infoBalanceUrl = infoBalance.protocol + '://' + infoBalance.domain + ':' + infoBalance.port
|
||||
const balanceUrl = `${infoBalanceUrl}/addresses/balance/${this.accountInfo.addressInfo.address}`
|
||||
|
||||
await fetch(balanceUrl).then(response => {
|
||||
return response.json()
|
||||
}).then(data => {
|
||||
@ -422,7 +428,7 @@ class StartMintingNow extends LitElement {
|
||||
async getMintingAcccounts() {
|
||||
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 url = `${nodeUrl}/admin/mintingaccounts`
|
||||
const url = `${nodeUrl}/admin/mintingaccounts?apiKey=${this.getApiKey()}`
|
||||
try {
|
||||
const res = await fetch(url)
|
||||
this.mintingAccountData = await res.json()
|
||||
@ -484,7 +490,9 @@ class StartMintingNow extends LitElement {
|
||||
|
||||
let interval = null
|
||||
let stop = false
|
||||
|
||||
this.status = 2
|
||||
|
||||
const getAnswer = async () => {
|
||||
const rewardShares = async (minterAddr) => {
|
||||
const url = `${nodeUrl}/addresses/rewardshares?minters=${minterAddr}&recipients=${minterAddr}`
|
||||
@ -508,6 +516,7 @@ class StartMintingNow extends LitElement {
|
||||
stop = false
|
||||
}
|
||||
}
|
||||
|
||||
interval = setInterval(getAnswer, 5000)
|
||||
}
|
||||
|
||||
|
@ -1207,6 +1207,20 @@ class Chat extends LitElement {
|
||||
}
|
||||
}
|
||||
|
||||
async getGroupType(newGroupId) {
|
||||
try {
|
||||
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 response = await fetch(`${nodeUrl}/groups/${newGroupId}`)
|
||||
const data = await response.json()
|
||||
|
||||
return data.isOpen
|
||||
} catch (error) {
|
||||
console.error('Error fetching group type', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
async setChatHeads(chatObj) {
|
||||
const chatObjGroups = Array.isArray(chatObj.groups) ? chatObj.groups : []
|
||||
const chatObjDirect = Array.isArray(chatObj.direct) ? chatObj.direct : []
|
||||
@ -1216,12 +1230,14 @@ class Chat extends LitElement {
|
||||
url: `group/${group.groupId}`,
|
||||
groupName: 'Qortal General Chat',
|
||||
timestamp: group.timestamp === undefined ? 2 : group.timestamp,
|
||||
sender: group.sender
|
||||
sender: group.sender,
|
||||
isOpen: true
|
||||
} : {
|
||||
...group,
|
||||
timestamp: group.timestamp === undefined ? 1 : group.timestamp,
|
||||
url: `group/${group.groupId}`,
|
||||
ownerName: group.ownerName === undefined ? await this.getOwnerName(group.groupId) : 'undefined'
|
||||
ownerName: group.ownerName === undefined ? await this.getOwnerName(group.groupId) : 'undefined',
|
||||
isOpen: group.isOpen === undefined ? await this.getGroupType(group.groupId) : true
|
||||
}))
|
||||
|
||||
let directList = chatObjDirect.map(dc => {
|
||||
|
@ -13,6 +13,7 @@ import '@vaadin/grid'
|
||||
|
||||
// Multi language support
|
||||
import { get, registerTranslateConfig, translate, use } from '../../../../core/translate'
|
||||
|
||||
registerTranslateConfig({
|
||||
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
|
||||
})
|
||||
@ -346,7 +347,7 @@ class RewardShare extends LitElement {
|
||||
getTxnRequestResponse(myTransaction)
|
||||
}
|
||||
} else if (accountDetails.address === recipientAddress) {
|
||||
if (accountDetails.level >= 1 && accountDetails.level <= 4) {
|
||||
if (accountDetails.level <= 4) {
|
||||
this.error = false
|
||||
this.message = ''
|
||||
let myTransaction = await makeTransactionRequest(lastRef)
|
||||
@ -361,7 +362,6 @@ class RewardShare extends LitElement {
|
||||
getTxnRequestResponse(myTransaction)
|
||||
}
|
||||
} else if (accountDetails.level >= 5) {
|
||||
|
||||
this.error = false
|
||||
this.message = ''
|
||||
let myTransaction = await makeTransactionRequest(lastRef)
|
||||
@ -504,7 +504,7 @@ class RewardShare extends LitElement {
|
||||
getTxnRequestResponse(myTransaction)
|
||||
}
|
||||
} else if (accountDetails.address === recipientAddress) {
|
||||
if (accountDetails.level >= 1 && accountDetails.level <= 4) {
|
||||
if (accountDetails.level <= 4) {
|
||||
this.error = false
|
||||
this.message = ''
|
||||
let myTransaction = await makeTransactionRequest(lastRef)
|
||||
@ -519,7 +519,6 @@ class RewardShare extends LitElement {
|
||||
getTxnRequestResponse(myTransaction)
|
||||
}
|
||||
} else if (accountDetails.level >= 5) {
|
||||
|
||||
this.error = false
|
||||
this.message = ''
|
||||
let myTransaction = await makeTransactionRequest(lastRef)
|
||||
|
Loading…
x
Reference in New Issue
Block a user