From f2afe9c1473f084614ca6736527b50605330cf31 Mon Sep 17 00:00:00 2001
From: AlphaX-Projects <77661270+AlphaX-Projects@users.noreply.github.com>
Date: Fri, 15 Mar 2024 09:13:17 +0100
Subject: [PATCH 1/2] Remove not needed files
---
.eslintignore | 1 -
.eslintrc.json | 15 -------
.travis.yml | 71 -------------------------------
blog-test.json | 23 ----------
core/.eslintignore | 1 -
core/.eslintrc.json | 22 ----------
install-dependencies.sh | 71 -------------------------------
push-updates-with-travis-build.sh | 42 ------------------
8 files changed, 246 deletions(-)
delete mode 100644 .eslintignore
delete mode 100644 .eslintrc.json
delete mode 100644 .travis.yml
delete mode 100644 blog-test.json
delete mode 100644 core/.eslintignore
delete mode 100644 core/.eslintrc.json
delete mode 100644 install-dependencies.sh
delete mode 100644 push-updates-with-travis-build.sh
diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index 30bc1627..00000000
--- a/.eslintignore
+++ /dev/null
@@ -1 +0,0 @@
-/node_modules
\ No newline at end of file
diff --git a/.eslintrc.json b/.eslintrc.json
deleted file mode 100644
index 3737f840..00000000
--- a/.eslintrc.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "env": {
- "browser": true,
- "es2021": true
- },
- "plugins": ["lit", "wc"],
- "extends": ["eslint:recommended", "plugin:lit/recommended", "plugin:wc/recommended"],
- "parserOptions": {
- "ecmaVersion": 12,
- "sourceType": "module"
- },
- "rules": {
- "no-mixed-spaces-and-tabs": 0
- }
-}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index a02331c0..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,71 +0,0 @@
-
-branches:
- except:
- - master
-
-language: node_js
-node_js: "14.17.0"
-
-cache:
- yarn: true
- directories:
- - node_modules
- # - qortal-ui-core/node_modules
- # - qortal-ui-plugins/node_modules
- # - qortal-ui-crypto/node_modules
- - $HOME/.cache/electron
- - $HOME/.cache/electron-builder
-
-install:
- - sh install-dependencies.sh
-
-env:
- global:
- - ELECTRON_CACHE=$HOME/.cache/electron
- - ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
- - ELECTRON_ENABLE_LOGGING=true
-
-jobs:
- include:
- - stage: Deploy Linux
- if: tag IS present
- os: linux
- dist: bionic
- sudo: required
- addons:
- apt:
- packages:
- # default Electron dependencies
- - build-essential
- - gconf2
- - gconf-service
- - libgtk-3-0
- - libnotify4
- - libxss-dev
- - libxss1
- - xdg-utils
- - libatspi2.0-0
- - libappindicator1
- - libxext-dev
- - libxtst6
- - libxtst-dev
- - libnss3
- script:
- - newVersion=$(git describe --abbrev=0)
- - yarn version --new-version $newVersion
- - sh set-up-snap.sh
- - yarn run release
- - stage: Deploy Windows & Mac
- if: tag IS present
- os: osx
- osx_image: xcode12.5.1
- script:
- - newVersion=$(git describe --abbrev=0)
- - yarn version --new-version $newVersion
- - yarn run release -- --mac --win
- before_cache:
- - rm -rf $HOME/.cache/electron-builder/wine
- # - stage: Update GitHub with Builds
- # if: tag IS present
- # script:
- # - sh push-updates-with-travis-build.sh
diff --git a/blog-test.json b/blog-test.json
deleted file mode 100644
index 04dd800a..00000000
--- a/blog-test.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "name": "Q-Blog",
- "defaultFeedIndex": 0,
- "feed": [
- {
- "id": "post-creation",
- "version": 1,
- "updated": 1696646223261,
- "title": "Q-Blog Post creations",
- "description": "Get your friends Q-Blog posts on your feed",
- "search": {
- "query": "-post-",
- "identifier": "q-blog-",
- "service": "BLOG_POST",
- "exactmatchnames": true
- },
- "click": "qortal://APP/Q-Blog/$${resource.name}$$/blog/$${resource.identifier}$$",
- "display": {
- "title": "$${rawdata.title}$$"
- }
- }
- ]
-}
diff --git a/core/.eslintignore b/core/.eslintignore
deleted file mode 100644
index 30bc1627..00000000
--- a/core/.eslintignore
+++ /dev/null
@@ -1 +0,0 @@
-/node_modules
\ No newline at end of file
diff --git a/core/.eslintrc.json b/core/.eslintrc.json
deleted file mode 100644
index f7ac8a1b..00000000
--- a/core/.eslintrc.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "extends" : "standard",
- "rules": {
- "indent": [
- "error",
- 4,
- {
- "SwitchCase": 1
- }
- ]
- },
- "env": {
- "es6": true,
- "browser": true,
- "worker": true
- },
- "parser": "babel-eslint",
- "parserOptions": {
- "sourceType": "module",
- "allowImportExportEverywhere": true
- }
-}
\ No newline at end of file
diff --git a/install-dependencies.sh b/install-dependencies.sh
deleted file mode 100644
index 23cdec1d..00000000
--- a/install-dependencies.sh
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/sh
-
-# Qortal Blockchain Project - 2021
-
-# Travis Script to install dependencies...
-
-set -ev
-
-# install every repository needed, install dependencies, clone git repos, do yarn linking and building, and build and run final UI
-
-install_dependencies()
-{
- echo -e '---INSTALLING DEPENDENCIES!---'
- echo -e '---INSTALLING ALL UI REPOSITORIES---'
-
- cd ../
- cd qortal-ui-core
- yarn install --pure-lockfile
- cd ../
- mkdir qortal-ui/qortal-ui-core
- rsync -a qortal-ui-core/ qortal-ui/qortal-ui-core --exclude .git
- cd qortal-ui/qortal-ui-core
- yarn link
- cd ../../
-
- cd qortal-ui-plugins
- yarn install --pure-lockfile
- cd ../
- mkdir qortal-ui/qortal-ui-plugins
- rsync -a qortal-ui-plugins/ qortal-ui/qortal-ui-plugins --exclude .git
- cd qortal-ui/qortal-ui-plugins
- yarn link
- cd ../../
-
- cd qortal-ui-crypto
- yarn install --pure-lockfile
- cd ../
- mkdir qortal-ui/qortal-ui-crypto
- rsync -a qortal-ui-crypto/ qortal-ui/qortal-ui-crypto --exclude .git
- cd qortal-ui/qortal-ui-crypto
- yarn link
- cd ../
-
- echo -e '---INSTALL ALL DEPENDENCIES---'
- yarn install --pure-lockfile
-
- echo -e '---LINKING UI FOLDERS ---'
- yarn link qortal-ui-core
- yarn link qortal-ui-crypto
- yarn link qortal-ui-plugins
-
- echo -e '---BUILDING UI DEPENDENCIES!---'
- yarn build
-
- echo -e '---UPDATE PACKAGE-JSON UI DEPENDENCIES!---'
- yarn update-package-json
-
- echo -e '---REMOVE MODULES AND UNUSED DEPENDENCIES!---'
- cd qortal-ui-core
- yarn install --production --ignore-scripts --prefer-offline
- cd ../
- cd qortal-ui-plugins
- rm -R node_modules
- cd ../
- cd qortal-ui-crypto
- rm -R node_modules
- cd ../
- rm -R qortal-ui-crypto
-}
-
-install_dependencies
diff --git a/push-updates-with-travis-build.sh b/push-updates-with-travis-build.sh
deleted file mode 100644
index 7abe8254..00000000
--- a/push-updates-with-travis-build.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-
-set -x
-
-setup_git() {
- git config --global user.email "travis@travis-ci.org"
- git config --global user.name "Travis CI"
-}
-
-commit_version_push() {
- # Add New Remote
- git remote add ci https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git > /dev/null 2>&1
- # Show Remotes
- git remote -v
- # Create Version variable
- newVersion=$(git describe --abbrev=0)
- # Checkout and Switch to master branch
- # git checkout master
- # Disable yarn version-git-tag
- yarn config set version-git-tag false
- # Update package.json version
- yarn version --new-version $newVersion
- # Stage file for commit
- git add package.json
- # Create a new commit with a build version
- git commit --message "Build Version: $newVersion"
- # PUSH TO GITHUB
- git push ci master
-}
-
-setup_git
-
-commit_version_push
-
-
-# # Attempt to commit to git only if "git commit" succeeded
-# if [ $? -eq 0 ]; then
-# echo "Commit the new version. Built and Pushing to GitHub"
-# push_build
-# else
-# echo "Cannot commit new version"
-# fi
From 732f3f97f2e8720935310a028cf62bfac487309a Mon Sep 17 00:00:00 2001
From: AlphaX-Projects <77661270+AlphaX-Projects@users.noreply.github.com>
Date: Sun, 17 Mar 2024 12:48:05 +0100
Subject: [PATCH 2/2] Rollback electron and cleanup code
---
README.md | 2 +-
core/src/components/app-info.js | 251 +--
core/src/components/wallet-profile.js | 137 +-
electron.js | 78 +-
package-lock.json | 489 ++---
package.json | 26 +-
plugins/plugins/core/components/ChatHead.js | 44 +-
.../core/messaging/q-chat/q-chat-css.src.js | 934 ++++----
.../core/messaging/q-chat/q-chat.src.js | 1917 ++++++++---------
9 files changed, 1838 insertions(+), 2040 deletions(-)
diff --git a/README.md b/README.md
index 2449f9cf..6af149dc 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ Easiest way to install the lastest required packages on Linux is via nvm.
``` source ~/.profile ``` (For Debian based distro)
``` source ~/.bashrc ``` (For Fedora / CentOS)
``` nvm ls-remote ``` (Fetch list of available versions)
-``` nvm install v20.9.0 ``` (LTS: Iron supported by Electron)
+``` nvm install v18.17.1 ``` (LTS: Hydrogen supported by Electron V27)
``` npm --location=global install npm@10.5.0 ```
Adding via binary package mirror will only work if you have set the package path. You can do a node or java build via ports instead by downloading ports with portsnap fetch method.
diff --git a/core/src/components/app-info.js b/core/src/components/app-info.js
index c3cc86da..c5d4aa95 100644
--- a/core/src/components/app-info.js
+++ b/core/src/components/app-info.js
@@ -1,105 +1,70 @@
import {css, html, LitElement} from 'lit'
import {connect} from 'pwa-helpers'
import {store} from '../store.js'
-import {doPageUrl} from '../redux/app/app-actions.js'
-import {translate} from '../../translate/index.js'
-import WebWorker from 'web-worker:./computePowWorker.js';
-import {routes} from '../plugins/routes.js';
-
-import '@material/mwc-icon'
-import '@material/mwc-button'
+import {translate} from '../../translate'
class AppInfo extends connect(store)(LitElement) {
static get properties() {
return {
- blockInfo: { type: Object },
- nodeStatus: { type: Object },
nodeInfo: { type: Array },
coreInfo: { type: Array },
nodeConfig: { type: Object },
- pageUrl: { type: String },
- publicizeAddress: { type: String },
theme: { type: String, reflect: true }
}
}
static get styles() {
- return [
- css`
- * {
- --mdc-theme-primary: rgb(3, 169, 244);
- --paper-input-container-focus-color: var(--mdc-theme-primary);
- }
- .normal {
- --mdc-theme-primary: rgb(3, 169, 244);
- }
+ return css`
+ * {
+ --mdc-theme-primary: rgb(3, 169, 244);
+ --paper-input-container-focus-color: var(--mdc-theme-primary);
+ }
- .normal-button {
- --mdc-theme-primary: rgb(3, 169, 244);
- --mdc-theme-on-primary: white;
- }
+ .normal {
+ --mdc-theme-primary: rgb(3, 169, 244);
+ }
- mwc-button.normal-button {
- --mdc-theme-primary: rgb(3, 169, 244);
- --mdc-theme-on-primary: white;
- }
- .test-net {
- --mdc-theme-primary: black;
- }
+ #profileInMenu {
+ flex: 0 0 100px;
+ padding:12px;
+ border-top: 1px solid var(--border);
+ background: var(--sidetopbar);
+ }
- .test-net-button {
- --mdc-theme-primary: black;
- --mdc-theme-on-primary: white;
- }
+ .info {
+ margin: 0;
+ font-size: 14px;
+ font-weight: 100;
+ display: inline-block;
+ width: 100%;
+ padding-bottom: 8px;
+ color: var(--black);
+ }
- mwc-button.test-net-button {
- --mdc-theme-primary: black;
- --mdc-theme-on-primary: white;
- }
- #profileInMenu {
- flex: 0 0 100px;
- padding:12px;
- border-top: 1px solid var(--border);
- background: var(--sidetopbar);
- }
- .info {
- margin: 0;
- font-size: 14px;
- font-weight:100;
- display: inline-block;
- width:100%;
- padding-bottom:8px;
- color: var(--black);
- }
- .blue {
- color: #03a9f4;
- margin: 0;
- font-size: 14px;
- font-weight:200;
- display: inline;
- }
- .black {
- color: var(--black);
- margin: 0;
- font-size: 14px;
- font-weight:200;
- display: inline;
- }
- `
- ]
+ .blue {
+ color: #03a9f4;
+ margin: 0;
+ font-size: 14px;
+ font-weight: 200;
+ display: inline;
+ }
+
+ .black {
+ color: var(--black);
+ margin: 0;
+ font-size: 14px;
+ font-weight: 200;
+ display: inline;
+ }
+ `
}
constructor() {
super()
- this.blockInfo = {}
this.nodeInfo = []
this.coreInfo = []
this.nodeStatus = {}
- this.pageUrl = ''
- this.publicizeAddress = ''
this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light'
- this.publicKeyisOnChainConfirmation = false
- this.interval
}
render() {
@@ -115,133 +80,25 @@ class AppInfo extends connect(store)(LitElement) {
}
firstUpdated() {
- this.publicizeAddress = store.getState().app.selectedAddress.address + '_publicize'
- this.setStorage()
this.getNodeInfo()
this.getCoreInfo()
- // try {
- // this.confirmPublicKeyOnChain(store.getState().app.selectedAddress.address)
- // } catch (error) {
- // console.error(error)
- // }
setInterval(() => {
this.getNodeInfo()
this.getCoreInfo()
- }, 30000)
- }
-
- setStorage() {
- if (localStorage.getItem(this.publicizeAddress) === null) {
- localStorage.setItem(this.publicizeAddress, 'false')
- }
- }
-
- async confirmPublicKeyOnChain(address) {
- const _computePow2 = async (chatBytes) => {
- const difficulty = 14
- const path = window.parent.location.origin + '/memory-pow/memory-pow.wasm.full'
- const worker = new WebWorker();
- let nonce = null
- let chatBytesArray = null
- await new Promise((res, rej) => {
- worker.postMessage({chatBytes, path, difficulty})
-
- worker.onmessage = e => {
- worker.terminate()
- chatBytesArray = e.data.chatBytesArray
- nonce = e.data.nonce
- res()
- }
- })
-
- let _response = await routes.sign_chat({
- data: {
- nonce: store.getState().app.selectedAddress.nonce,
- chatBytesArray: chatBytesArray,
- chatNonce: nonce
- },
- })
- return _response
- }
-
- let stop = false
- const checkPublicKey = async () => {
- if (!stop) {
- stop = true
- try {
- if(localStorage.getItem(this.publicizeAddress) === 'true') {
- clearInterval(this.interval)
- return
- }
- const myNode = store.getState().app.nodeConfig.knownNodes[store.getState().app.nodeConfig.node]
- const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port
- const url = `${nodeUrl}/addresses/publickey/${address}`
- const res = await fetch(url)
- let data = ''
- try {
- data = await res.text()
- } catch (error) {
- data = {
- error: 'error'
- }
- }
- if(data === 'false' && this.nodeInfo.isSynchronizing !== true) {
- let _reference = new Uint8Array(64)
- window.crypto.getRandomValues(_reference)
- let reference = window.parent.Base58.encode(_reference)
- const chatRes = await routes.chat({
- data: {
- type: 19,
- nonce: store.getState().app.selectedAddress.nonce,
- params: {
- lastReference: reference,
- proofOfWorkNonce: 0,
- fee: 0,
- timestamp: Date.now(),
- },
- disableModal: true
- },
- disableModal: true,
- });
-
- try {
- const powRes = await _computePow2(chatRes)
- if(powRes === true) {
- clearInterval(this.interval)
- localStorage.removeItem(this.publicizeAddress)
- localStorage.setItem(this.publicizeAddress, 'true')
- }
- } catch (error) {
- console.error(error)
- }
- }
-
- if (!data.error && data !== 'false' && data) {
- clearInterval(this.interval)
- localStorage.removeItem(this.publicizeAddress)
- localStorage.setItem(this.publicizeAddress, 'true')
- }
-
- } catch (error) {
- }
- stop = false
- }
- }
- this.interval = setInterval(checkPublicKey, 5000);
+ }, 60000)
}
async getNodeInfo() {
const appinfoNode = store.getState().app.nodeConfig.knownNodes[store.getState().app.nodeConfig.node]
const appinfoUrl = appinfoNode.protocol + '://' + appinfoNode.domain + ':' + appinfoNode.port
const url = `${appinfoUrl}/admin/status`
+
await fetch(url).then(response => {
return response.json()
- })
- .then(data => {
+ }).then(data => {
this.nodeInfo = data
- })
- .catch(err => {
+ }).catch(err => {
console.error('Request failed', err)
})
}
@@ -250,13 +107,12 @@ class AppInfo extends connect(store)(LitElement) {
const appinfoNode = store.getState().app.nodeConfig.knownNodes[store.getState().app.nodeConfig.node]
const appinfoUrl = appinfoNode.protocol + '://' + appinfoNode.domain + ':' + appinfoNode.port
const url = `${appinfoUrl}/admin/info`
+
await fetch(url).then(response => {
return response.json()
- })
- .then(data => {
+ }).then(data => {
this.coreInfo = data
- })
- .catch(err => {
+ }).catch(err => {
console.error('Request failed', err)
})
}
@@ -283,21 +139,8 @@ class AppInfo extends connect(store)(LitElement) {
return html`${translate("appinfo.coreversion")}: ${this.coreInfo.buildVersion ? this.coreInfo.buildVersion : ''}`
}
- gotoPage(url) {
- const myLink = this.shadowRoot.querySelector('#pageLink')
- myLink.href = url
- myLink.click()
- store.dispatch(doPageUrl(''))
- }
-
stateChanged(state) {
- this.blockInfo = state.app.blockInfo
- this.nodeStatus = state.app.nodeStatus
this.nodeConfig = state.app.nodeConfig
- this.pageUrl = state.app.pageUrl
- if (this.pageUrl.length > 5) {
- this.gotoPage(this.pageUrl)
- }
}
}
diff --git a/core/src/components/wallet-profile.js b/core/src/components/wallet-profile.js
index 83e8c01d..33d92282 100644
--- a/core/src/components/wallet-profile.js
+++ b/core/src/components/wallet-profile.js
@@ -1,10 +1,7 @@
import {css, html, LitElement} from 'lit'
import {connect} from 'pwa-helpers'
import {store} from '../store.js'
-import {translate} from '../../translate/index.js'
-
-import '@polymer/paper-toast'
-import '@material/mwc-icon-button'
+import {translate} from '../../translate'
class WalletProfile extends connect(store)(LitElement) {
static get properties() {
@@ -12,82 +9,76 @@ class WalletProfile extends connect(store)(LitElement) {
wallet: { type: Object },
nodeConfig: { type: Object },
accountInfo: { type: Object },
- imageUrl: { type: String },
theme: { type: String, reflect: true }
}
}
static get styles() {
- return [
- css`
- `
- ]
+ return css`
+ #profileInMenu {
+ padding: 12px;
+ border-top: var(--border);
+ background: var(--sidetopbar);
+ color: var(--black);
+ }
+
+ #accountName {
+ margin: 0;
+ font-size: 18px;
+ font-weight: 500;
+ width: 100%;
+ padding-bottom: 8px;
+ display: flex;
+ }
+
+ #blocksMinted {
+ margin:0;
+ margin-top: 0;
+ font-size: 12px;
+ color: #03a9f4;
+ }
+
+ #address {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ margin:0;
+ margin-top: 8px;
+ font-size: 11px;
+ }
+
+ .round-fullinfo {
+ position: relative;
+ width: 68px;
+ height: 68px;
+ border-radius: 50%;
+ }
+
+ .full-info-logo {
+ width: 68px;
+ height: 68px;
+ border-radius: 50%;
+ }
+
+ .inline-block-child {
+ flex: 1;
+ }
+ `
}
constructor() {
super()
+ this.wallet = {}
this.nodeConfig = {}
this.accountInfo = {
names: [],
addressInfo: {}
}
- this.imageUrl = ''
this.theme = localStorage.getItem('qortalTheme') ? localStorage.getItem('qortalTheme') : 'light'
}
render() {
return html`
-
${this.wallet.addresses[0].address}
${translate("chatpage.cchange6")}
-${translate("chatpage.cchange38")}
-${translate("chatpage.cchange6")}
+${translate("chatpage.cchange38")}
+