4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-23 15:45:48 +00:00

Merge pull request #355 from AlphaX-Qortal/master

Various updates
This commit is contained in:
AlphaX 2025-02-13 17:24:28 +01:00 committed by GitHub
commit af8dcae748
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 81 additions and 19 deletions

View File

@ -86,5 +86,16 @@ export const defaultQappsTabs = [
"pluginNumber": "plugin-GGHiHzW6pe", "pluginNumber": "plugin-GGHiHzW6pe",
"menus": [], "menus": [],
"parent": false "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
} }
] ]

View File

@ -50,5 +50,13 @@ export const decryptChatMessageBase64 = (encryptedMessage, privateKey, recipient
return _decryptedMessage 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) return new TextDecoder('utf-8').decode(_decryptedMessage)
} }

View File

@ -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)} ${this.chatInfo.groupName ? this.chatInfo.groupName : this.chatInfo.name !== undefined ? this.chatInfo.name : this.chatInfo.address.substr(0, 15)}
</span> </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> </div>
<div class="about" style="margin-top:7px"> <div class="about" style="margin-top:7px">

View File

@ -1106,7 +1106,7 @@ class MessageTemplate extends LitElement {
version = parsedMessageObj.version version = parsedMessageObj.version
isForwarded = parsedMessageObj.type === 'forward' isForwarded = parsedMessageObj.type === 'forward'
isEdited = parsedMessageObj.isEdited && true 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) { if (parsedMessageObj.images && Array.isArray(parsedMessageObj.images) && parsedMessageObj.images.length > 0) {
image = parsedMessageObj.images[0] image = parsedMessageObj.images[0]

View File

@ -2893,6 +2893,14 @@ export const decryptChatMessageBase64 = (encryptedMessage, privateKey, recipient
return _decryptedMessage 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) return new TextDecoder('utf-8').decode(_decryptedMessage)
} }

View File

@ -12,6 +12,7 @@ import '@vaadin/grid'
// Multi language support // Multi language support
import { get, registerTranslateConfig, translate, use } from '../../../../core/translate' import { get, registerTranslateConfig, translate, use } from '../../../../core/translate'
registerTranslateConfig({ registerTranslateConfig({
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
}) })
@ -427,7 +428,9 @@ class NodeManagement extends LitElement {
async addPeer() { async addPeer() {
this.addPeerLoading = true this.addPeerLoading = true
const addPeerAddress = this.shadowRoot.getElementById('addPeerAddress').value const addPeerAddress = this.shadowRoot.getElementById('addPeerAddress').value
await parentEpml.request('apiCall', { await parentEpml.request('apiCall', {
url: `/peers?apiKey=${this.getApiKey()}`, url: `/peers?apiKey=${this.getApiKey()}`,
method: 'POST', method: 'POST',
@ -456,7 +459,6 @@ class NodeManagement extends LitElement {
addMintingAccount() { addMintingAccount() {
this.addMintingAccountLoading = true this.addMintingAccountLoading = true
this.addMintingAccountMessage = 'Loading...' this.addMintingAccountMessage = 'Loading...'
this.addMintingAccountKey = this.shadowRoot.querySelector('#addMintingAccountKey').value this.addMintingAccountKey = this.shadowRoot.querySelector('#addMintingAccountKey').value
parentEpml.request('apiCall', { parentEpml.request('apiCall', {
@ -479,6 +481,7 @@ class NodeManagement extends LitElement {
updateMintingAccounts() { updateMintingAccounts() {
this.mintingAccounts = [] this.mintingAccounts = []
parentEpml.request('apiCall', { parentEpml.request('apiCall', {
url: `/admin/mintingaccounts?apiKey=${this.getApiKey()}`, url: `/admin/mintingaccounts?apiKey=${this.getApiKey()}`,
method: 'GET' method: 'GET'
@ -518,10 +521,6 @@ class NodeManagement extends LitElement {
if (!arr) { return true } if (!arr) { return true }
return arr.length === 0 return arr.length === 0
} }
round(number) {
return (Math.round(parseFloat(number) * 1e8) / 1e8).toFixed(8)
}
} }
window.customElements.define('node-management', NodeManagement) window.customElements.define('node-management', NodeManagement)

View File

@ -10,6 +10,7 @@ import '@vaadin/button'
// Multi language support // Multi language support
import { get, registerTranslateConfig, translate, use } from '../../../../core/translate' import { get, registerTranslateConfig, translate, use } from '../../../../core/translate'
registerTranslateConfig({ registerTranslateConfig({
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
}) })
@ -144,7 +145,6 @@ class OverviewPage extends LitElement {
async firstUpdated() { async firstUpdated() {
this.changeTheme() this.changeTheme()
this.changeLanguage() this.changeLanguage()
this.nodeConfig = window.parent.reduxStore.getState().app.nodeConfig this.nodeConfig = window.parent.reduxStore.getState().app.nodeConfig
this.accountInfo = window.parent.reduxStore.getState().app.accountInfo this.accountInfo = window.parent.reduxStore.getState().app.accountInfo
@ -199,11 +199,13 @@ class OverviewPage extends LitElement {
changeTheme() { changeTheme() {
const checkTheme = localStorage.getItem('qortalTheme') const checkTheme = localStorage.getItem('qortalTheme')
if (checkTheme === 'dark') { if (checkTheme === 'dark') {
this.theme = 'dark' this.theme = 'dark'
} else { } else {
this.theme = 'light' this.theme = 'light'
} }
document.querySelector('html').setAttribute('theme', this.theme) document.querySelector('html').setAttribute('theme', this.theme)
} }
@ -225,6 +227,7 @@ class OverviewPage extends LitElement {
async refreshItems() { async refreshItems() {
this.nodeConfig = window.parent.reduxStore.getState().app.nodeConfig this.nodeConfig = window.parent.reduxStore.getState().app.nodeConfig
this.accountInfo = window.parent.reduxStore.getState().app.accountInfo this.accountInfo = window.parent.reduxStore.getState().app.accountInfo
await this.getNodeInfo() await this.getNodeInfo()
await this.getCoreInfo() await this.getCoreInfo()
await this.getBalanceInfo() await this.getBalanceInfo()
@ -234,12 +237,14 @@ class OverviewPage extends LitElement {
async getMintingKeysList() { async getMintingKeysList() {
this.check1 = false this.check1 = false
this.check2 = false this.check2 = false
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 nodeStatus = myNode.protocol + '://' + myNode.domain + ':' + myNode.port const nodeStatus = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
const statusUrl = `${nodeStatus}/admin/mintingaccounts` const statusUrl = `${nodeStatus}/admin/mintingaccounts?apiKey=${this.getApiKey()}`
try { try {
const res = await fetch(statusUrl) const res = await fetch(statusUrl)
this.listAccounts = await res.json() this.listAccounts = await res.json()
const addressInfo = window.parent.reduxStore.getState().app.accountInfo.addressInfo 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) const findRemovedSponsorsKey = this.listAccounts.filter((my) => my.address)
this.check1 = findMyMintingAccount !== undefined this.check1 = findMyMintingAccount !== undefined
this.check2 = findMyMintingRecipient !== undefined this.check2 = findMyMintingRecipient !== undefined
if (findRemovedSponsorsKey.length > 0) { if (findRemovedSponsorsKey.length > 0) {
@ -285,8 +289,7 @@ class OverviewPage extends LitElement {
this.cssStatus = '' this.cssStatus = ''
return html`<span class="btn btn-sm btn-info float-right">${translate("walletprofile.wp1")}</span>` 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) { } 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="float-right"><start-minting-now></start-minting-now></span>`
return html`<span class="btn btn-sm btn-info float-right">${translate("becomeMinterPage.bchange12")}</span>`
} else if (this.check1 === false && this.check2 === false && myMintingKey === true) { } else if (this.check1 === false && this.check2 === false && myMintingKey === true) {
return html`<span class="float-right"><start-minting-now></start-minting-now></span>` return html`<span class="float-right"><start-minting-now></start-minting-now></span>`
} else if (myMintingKey === false) { } 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 infoNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
const infoNodeUrl = infoNode.protocol + '://' + infoNode.domain + ':' + infoNode.port const infoNodeUrl = infoNode.protocol + '://' + infoNode.domain + ':' + infoNode.port
const nodeUrl = `${infoNodeUrl}/admin/status` const nodeUrl = `${infoNodeUrl}/admin/status`
await fetch(nodeUrl).then(response => { await fetch(nodeUrl).then(response => {
return response.json() return response.json()
}).then(data => { }).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 infoCore = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
const infoCoreUrl = infoCore.protocol + '://' + infoCore.domain + ':' + infoCore.port const infoCoreUrl = infoCore.protocol + '://' + infoCore.domain + ':' + infoCore.port
const coreUrl = `${infoCoreUrl}/admin/info` const coreUrl = `${infoCoreUrl}/admin/info`
await fetch(coreUrl).then(response => { await fetch(coreUrl).then(response => {
return response.json() return response.json()
}).then(data => { }).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 infoBalance = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
const infoBalanceUrl = infoBalance.protocol + '://' + infoBalance.domain + ':' + infoBalance.port const infoBalanceUrl = infoBalance.protocol + '://' + infoBalance.domain + ':' + infoBalance.port
const balanceUrl = `${infoBalanceUrl}/addresses/balance/${this.accountInfo.addressInfo.address}` const balanceUrl = `${infoBalanceUrl}/addresses/balance/${this.accountInfo.addressInfo.address}`
await fetch(balanceUrl).then(response => { await fetch(balanceUrl).then(response => {
return response.json() return response.json()
}).then(data => { }).then(data => {
@ -422,7 +428,7 @@ class StartMintingNow extends LitElement {
async getMintingAcccounts() { async getMintingAcccounts() {
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
const url = `${nodeUrl}/admin/mintingaccounts` const url = `${nodeUrl}/admin/mintingaccounts?apiKey=${this.getApiKey()}`
try { try {
const res = await fetch(url) const res = await fetch(url)
this.mintingAccountData = await res.json() this.mintingAccountData = await res.json()
@ -484,7 +490,9 @@ class StartMintingNow extends LitElement {
let interval = null let interval = null
let stop = false let stop = false
this.status = 2 this.status = 2
const getAnswer = async () => { const getAnswer = async () => {
const rewardShares = async (minterAddr) => { const rewardShares = async (minterAddr) => {
const url = `${nodeUrl}/addresses/rewardshares?minters=${minterAddr}&recipients=${minterAddr}` const url = `${nodeUrl}/addresses/rewardshares?minters=${minterAddr}&recipients=${minterAddr}`
@ -508,6 +516,7 @@ class StartMintingNow extends LitElement {
stop = false stop = false
} }
} }
interval = setInterval(getAnswer, 5000) interval = setInterval(getAnswer, 5000)
} }

View File

@ -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) { async setChatHeads(chatObj) {
const chatObjGroups = Array.isArray(chatObj.groups) ? chatObj.groups : [] const chatObjGroups = Array.isArray(chatObj.groups) ? chatObj.groups : []
const chatObjDirect = Array.isArray(chatObj.direct) ? chatObj.direct : [] const chatObjDirect = Array.isArray(chatObj.direct) ? chatObj.direct : []
@ -1216,12 +1230,14 @@ class Chat extends LitElement {
url: `group/${group.groupId}`, url: `group/${group.groupId}`,
groupName: 'Qortal General Chat', groupName: 'Qortal General Chat',
timestamp: group.timestamp === undefined ? 2 : group.timestamp, timestamp: group.timestamp === undefined ? 2 : group.timestamp,
sender: group.sender sender: group.sender,
isOpen: true
} : { } : {
...group, ...group,
timestamp: group.timestamp === undefined ? 1 : group.timestamp, timestamp: group.timestamp === undefined ? 1 : group.timestamp,
url: `group/${group.groupId}`, 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 => { let directList = chatObjDirect.map(dc => {

View File

@ -13,6 +13,7 @@ import '@vaadin/grid'
// Multi language support // Multi language support
import { get, registerTranslateConfig, translate, use } from '../../../../core/translate' import { get, registerTranslateConfig, translate, use } from '../../../../core/translate'
registerTranslateConfig({ registerTranslateConfig({
loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) loader: lang => fetch(`/language/${lang}.json`).then(res => res.json())
}) })
@ -346,7 +347,7 @@ class RewardShare extends LitElement {
getTxnRequestResponse(myTransaction) getTxnRequestResponse(myTransaction)
} }
} else if (accountDetails.address === recipientAddress) { } else if (accountDetails.address === recipientAddress) {
if (accountDetails.level >= 1 && accountDetails.level <= 4) { if (accountDetails.level <= 4) {
this.error = false this.error = false
this.message = '' this.message = ''
let myTransaction = await makeTransactionRequest(lastRef) let myTransaction = await makeTransactionRequest(lastRef)
@ -361,7 +362,6 @@ class RewardShare extends LitElement {
getTxnRequestResponse(myTransaction) getTxnRequestResponse(myTransaction)
} }
} else if (accountDetails.level >= 5) { } else if (accountDetails.level >= 5) {
this.error = false this.error = false
this.message = '' this.message = ''
let myTransaction = await makeTransactionRequest(lastRef) let myTransaction = await makeTransactionRequest(lastRef)
@ -504,7 +504,7 @@ class RewardShare extends LitElement {
getTxnRequestResponse(myTransaction) getTxnRequestResponse(myTransaction)
} }
} else if (accountDetails.address === recipientAddress) { } else if (accountDetails.address === recipientAddress) {
if (accountDetails.level >= 1 && accountDetails.level <= 4) { if (accountDetails.level <= 4) {
this.error = false this.error = false
this.message = '' this.message = ''
let myTransaction = await makeTransactionRequest(lastRef) let myTransaction = await makeTransactionRequest(lastRef)
@ -519,7 +519,6 @@ class RewardShare extends LitElement {
getTxnRequestResponse(myTransaction) getTxnRequestResponse(myTransaction)
} }
} else if (accountDetails.level >= 5) { } else if (accountDetails.level >= 5) {
this.error = false this.error = false
this.message = '' this.message = ''
let myTransaction = await makeTransactionRequest(lastRef) let myTransaction = await makeTransactionRequest(lastRef)