From 3b83967426710ca0c036bce55071c149b56be3d0 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Sat, 5 Feb 2022 14:28:30 -0700 Subject: [PATCH 01/85] Silicoin as per Discord. --- .github/workflows/develop-silicoin.yaml | 46 +++++++++ .github/workflows/main-silicoin.yaml | 50 ++++++++++ .github/workflows/test-silicoin.yaml | 47 +++++++++ CHANGELOG.md | 3 + VERSION | 2 +- api/views/certificates/resources.py | 3 + common/config/blockchains.json | 4 +- docker/dockerfile | 4 +- scripts/farmr_setup.sh | 3 + scripts/forks/hddcoin_install.sh | 2 +- scripts/forks/silicoin_install.sh | 29 ++++++ scripts/forks/silicoin_launch.sh | 121 ++++++++++++++++++++++++ scripts/worker_port_warning.sh | 3 + web/models/chia.py | 6 +- web/templates/worker_launch.html | 19 +++- 15 files changed, 333 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/develop-silicoin.yaml create mode 100644 .github/workflows/main-silicoin.yaml create mode 100644 .github/workflows/test-silicoin.yaml create mode 100644 scripts/forks/silicoin_install.sh create mode 100644 scripts/forks/silicoin_launch.sh diff --git a/.github/workflows/develop-silicoin.yaml b/.github/workflows/develop-silicoin.yaml new file mode 100644 index 00000000..f8cb6d82 --- /dev/null +++ b/.github/workflows/develop-silicoin.yaml @@ -0,0 +1,46 @@ +name: develop-silicoin + +on: + push: + branches: + - 'develop' +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + file: docker/dockerfile + context: . + platforms: linux/amd64 + push: true + build-args: | + "MACHINARIS_STREAM=develop" + "SILICOIN_BRANCH=main" + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:develop + ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:develop diff --git a/.github/workflows/main-silicoin.yaml b/.github/workflows/main-silicoin.yaml new file mode 100644 index 00000000..839def9e --- /dev/null +++ b/.github/workflows/main-silicoin.yaml @@ -0,0 +1,50 @@ +name: release-silicoin + +on: + workflow_dispatch: + inputs: + version: + description: 'Release Version' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + file: docker/dockerfile + context: . + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + "MACHINARIS_STREAM=latest" + "SILICOIN_BRANCH=main" + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:latest + ${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:v${{ github.event.inputs.version }} + ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:latest + ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:v${{ github.event.inputs.version }} diff --git a/.github/workflows/test-silicoin.yaml b/.github/workflows/test-silicoin.yaml new file mode 100644 index 00000000..4484ecdc --- /dev/null +++ b/.github/workflows/test-silicoin.yaml @@ -0,0 +1,47 @@ +name: test-silicoin + +on: + push: + branches: + - 'integration' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + file: docker/dockerfile + context: . + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + "MACHINARIS_STREAM=test" + "SILICOIN_BRANCH=main" + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:test + ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris-silicoin:test diff --git a/CHANGELOG.md b/CHANGELOG.md index b60ee37d..1ffd4c2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.7.0] - 2022-03-04 + - [Silicoin](https://github.com/silicoin-network/silicoin-blockchain) - supported again as per Discord votes. + ## [0.6.9] - 2022-02-04 - [MMX](https://github.com/madMAx43v3r/mmx-node) - support for this new blockchain, which requires its own plot files. - [HDDCoin](https://github.com/HDDcoin-Network/hddcoin-blockchain/releases) - update to version 2.0.0 diff --git a/VERSION b/VERSION index 18640022..bcaffe19 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.6.9 \ No newline at end of file +0.7.0 \ No newline at end of file diff --git a/api/views/certificates/resources.py b/api/views/certificates/resources.py index 62731ad0..9bd7bbd8 100644 --- a/api/views/certificates/resources.py +++ b/api/views/certificates/resources.py @@ -63,6 +63,9 @@ def get(self): elif type == "shibgreen": blockchain = "shibgreen" dir = "/root/.shibgreen/mainnet/config/ssl/ca" + elif type == "silicoin": + blockchain = "silicoin" + dir = "/root/.sit/mainnet/config/ssl/ca" elif type == "stai": blockchain = "staicoin" dir = "/root/.stai/mainnet/config/ssl/ca" diff --git a/common/config/blockchains.json b/common/config/blockchains.json index 624b3093..2ecf22fd 100644 --- a/common/config/blockchains.json +++ b/common/config/blockchains.json @@ -209,8 +209,8 @@ "network_path": "/root/.sit/mainnet", "network_name": "mainnet", "network_port": 22222, - "farmer_port": "TBD", - "fullnode_rpc_port": "TBD", + "farmer_port": 22447, + "fullnode_rpc_port": 22555, "worker_port": 8941, "reward": 1.0, "mojos_per_coin": 1000000000000, diff --git a/docker/dockerfile b/docker/dockerfile index 0f13f848..883b39f5 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -15,6 +15,7 @@ ARG MAIZE_BRANCH ARG MMX_BRANCH ARG NCHAIN_BRANCH ARG SHIBGREEN_BRANCH +ARG SILICOIN_BRANCH ARG STAICOIN_BRANCH ARG STOR_BRANCH @@ -38,9 +39,10 @@ RUN \ && /usr/bin/bash /machinaris/scripts/forks/mmx_install.sh ${MMX_BRANCH} \ && /usr/bin/bash /machinaris/scripts/forks/nchain_install.sh ${NCHAIN_BRANCH} \ && /usr/bin/bash /machinaris/scripts/forks/shibgreen_install.sh ${SHIBGREEN_BRANCH} \ + && /usr/bin/bash /machinaris/scripts/forks/silicoin_install.sh ${SILICOIN_BRANCH} \ && /usr/bin/bash /machinaris/scripts/forks/staicoin_install.sh ${STAICOIN_BRANCH} \ && /usr/bin/bash /machinaris/scripts/forks/stor_install.sh ${STOR_BRANCH} \ - && /usr/bin/bash /machinaris/scripts/pull_3rd_party_libs.sh \ + && /usr/bin/bash /machinaris/scripts/pull_3rd_party_libs.sh \ && /usr/bin/bash /machinaris/scripts/machinaris_install.sh \ && rm -rf \ /root/.cache \ diff --git a/scripts/farmr_setup.sh b/scripts/farmr_setup.sh index 04dca878..b5d54d97 100644 --- a/scripts/farmr_setup.sh +++ b/scripts/farmr_setup.sh @@ -71,6 +71,9 @@ if [[ "${farmr_skip_launch}" == 'false' && (${mode} == 'fullnode' || ${mode} =~ elif [[ ${blockchains} == 'nchain' ]]; then cp -n blockchain/nch.json.template blockchain/nch.json echo "/chia-blockchain/venv/bin/chia" > override-nch-binary.txt + elif [[ ${blockchains} == 'silicoin' ]]; then + cp -n blockchain/sit.json.template blockchain/sit.json + echo "/silicoin-blockchain/venv/bin/sit" > override-sit-binary.txt elif [[ ${blockchains} == 'staicoin' ]]; then cp -n blockchain/stai.json.template blockchain/stai.json echo "/staicoin-blockchain/venv/bin/staicoin" > override-stai-binary.txt diff --git a/scripts/forks/hddcoin_install.sh b/scripts/forks/hddcoin_install.sh index 4607b089..4c544378 100644 --- a/scripts/forks/hddcoin_install.sh +++ b/scripts/forks/hddcoin_install.sh @@ -5,7 +5,7 @@ HDDCOIN_BRANCH=$1 # On 2022-01-22 -HASH=1b7f475af43dd251d6b8e866066a0834712f45ec +HASH=75d13c065a417f97f335849adf41ed5592f49543 if [ -z ${HDDCOIN_BRANCH} ]; then echo 'Skipping HDDCoin install as not requested.' diff --git a/scripts/forks/silicoin_install.sh b/scripts/forks/silicoin_install.sh new file mode 100644 index 00000000..2db926a8 --- /dev/null +++ b/scripts/forks/silicoin_install.sh @@ -0,0 +1,29 @@ +#!/bin/env bash +# +# Installs Silicoin as per https://github.com/silicoin-network/silicoin-blockchain +# + +SILICOIN_BRANCH=$1 +# On 2022-02-05 +HASH=ca482fa66f05e883891705c86bfdff63e101e3a4 + +if [ -z ${SILICOIN_BRANCH} ]; then + echo 'Skipping Silicoin install as not requested.' +else + rm -rf /root/.cache + git clone --branch ${SILICOIN_BRANCH} --single-branch https://github.com/silicoin-network/silicoin-blockchain /silicoin-blockchain + cd /silicoin-blockchain + git submodule update --init mozilla-ca + git checkout $HASH + chmod +x install.sh + # 2022-01-30: pip broke due to https://github.com/pypa/pip/issues/10825 + sed -i 's/upgrade\ pip$/upgrade\ "pip<22.0"/' install.sh + /usr/bin/sh ./install.sh + + if [ ! -d /chia-blockchain/venv ]; then + cd / + rmdir /chia-blockchain + ln -s /silicoin-blockchain /chia-blockchain + ln -s /silicoin-blockchain/venv/bin/sit /chia-blockchain/venv/bin/chia + fi +fi diff --git a/scripts/forks/silicoin_launch.sh b/scripts/forks/silicoin_launch.sh new file mode 100644 index 00000000..a247ef6c --- /dev/null +++ b/scripts/forks/silicoin_launch.sh @@ -0,0 +1,121 @@ +#!/bin/env bash +# +# Initialize Silicoin service, depending on mode of system requested +# + +cd /silicoin-blockchain + +. ./activate + +# Only the /root/.chia folder is volume-mounted so store sit within +mkdir -p /root/.chia/sit +rm -f /root/.sit +ln -s /root/.chia/sit /root/.sit + +mkdir -p /root/.sit/mainnet/log +sit init >> /root/.sit/mainnet/log/init.log 2>&1 + +if [[ "${blockchain_db_download}" == 'true' ]] \ + && [[ "${mode}" == 'fullnode' ]] \ + && [[ ! -f /root/.sit/mainnet/db/blockchain_v1_mainnet.sqlite ]]; then + mkdir -p /root/.sit/mainnet/db/ && cd /root/.sit/mainnet/db/ + echo "Sorry, Silicoin does not offer a recent blockchain DB for download via script. Standard sync will happen over a few days..." + echo "It is recommended to add some peer node connections on the Connections page of Machinaris from: https://alltheblocks.net/sit" +fi + +echo 'Configuring Silicoin...' +if [ -f /root/.sit/mainnet/config/config.yaml ]; then + sed -i 's/log_stdout: true/log_stdout: false/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/log_level: WARNING/log_level: INFO/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/localhost/127.0.0.1/g' /root/.sit/mainnet/config/config.yaml + # Fix port conflicts with other blockchains + sed -i 's/11000/22000/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/11222/22222/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/11256/22256/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/11445/22445/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/11446/22446/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/11447/22447/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/11448/22448/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/11449/22449/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/11555/22555/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/11559/22559/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/11560/22560/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/12444/22444/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/21234/22234/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/22222/22222/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/: 514/: 22514/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/56400/22400/g' /root/.sit/mainnet/config/config.yaml + sed -i 's/56402/22402/g' /root/.sit/mainnet/config/config.yaml +fi + +# Loop over provided list of key paths +for k in ${keys//:/ }; do + if [[ "${k}" == "persistent" ]]; then + echo "Not touching key directories." + elif [ -s ${k} ]; then + echo "Adding key at path: ${k}" + sit keys add -f ${k} > /dev/null + fi +done + +# Loop over provided list of completed plot directories +IFS=':' read -r -a array <<< "$plots_dir" +joined=$(printf ", %s" "${array[@]}") +echo "Adding plot directories at: ${joined:1}" +for p in ${plots_dir//:/ }; do + sit plots add -d ${p} +done + +chmod 755 -R /root/.sit/mainnet/config/ssl/ &> /dev/null +sit init --fix-ssl-permissions > /dev/null + +# Start services based on mode selected. Default is 'fullnode' +if [[ ${mode} == 'fullnode' ]]; then + for k in ${keys//:/ }; do + while [[ "${k}" != "persistent" ]] && [[ ! -s ${k} ]]; do + echo 'Waiting for key to be created/imported into mnemonic.txt. See: http://localhost:8926' + sleep 10 # Wait 10 seconds before checking for mnemonic.txt presence + if [ -s ${k} ]; then + sit keys add -f ${k} + sleep 10 + fi + done + done + sit start farmer +elif [[ ${mode} =~ ^farmer.* ]]; then + if [ ! -f ~/.sit/mainnet/config/ssl/wallet/public_wallet.key ]; then + echo "No wallet key found, so not starting farming services. Please add your Chia mnemonic.txt to the ~/.machinaris/ folder and restart." + else + sit start farmer-only + fi +elif [[ ${mode} =~ ^harvester.* ]]; then + if [[ -z ${farmer_address} || -z ${farmer_port} ]]; then + echo "A farmer peer address and port are required." + exit + else + if [ ! -f /root/.sit/farmer_ca/private_ca.crt ]; then + mkdir -p /root/.sit/farmer_ca + response=$(curl --write-out '%{http_code}' --silent http://${farmer_address}:8941/certificates/?type=silicoin --output /tmp/certs.zip) + if [ $response == '200' ]; then + unzip /tmp/certs.zip -d /root/.sit/farmer_ca + else + echo "Certificates response of ${response} from http://${farmer_address}:8941/certificates/?type=silicoin. Try clicking 'New Worker' button on 'Workers' page first." + fi + rm -f /tmp/certs.zip + fi + if [ -f /root/.sit/farmer_ca/private_ca.crt ]; then + sit init -c /root/.sit/farmer_ca 2>&1 > /root/.sit/mainnet/log/init.log + chmod 755 -R /root/.sit/mainnet/config/ssl/ &> /dev/null + sit init --fix-ssl-permissions > /dev/null + else + echo "Did not find your farmer's certificates within /root/.sit/farmer_ca." + echo "See: https://github.com/guydavis/machinaris/wiki/Workers#harvester" + fi + echo "Configuring farmer peer at ${farmer_address}:${farmer_port}" + sit configure --set-farmer-peer ${farmer_address}:${farmer_port} + sit configure --enable-upnp false + sit start harvester -r + fi +elif [[ ${mode} == 'plotter' ]]; then + echo "Starting in Plotter-only mode. Run Plotman from either CLI or WebUI." +fi diff --git a/scripts/worker_port_warning.sh b/scripts/worker_port_warning.sh index 0b2a125f..44b5c0fd 100644 --- a/scripts/worker_port_warning.sh +++ b/scripts/worker_port_warning.sh @@ -35,6 +35,9 @@ fi if [[ "${blockchains}" == "shibgreen" && "${worker_api_port}" != '8939' ]]; then echo "Shibgreen worker with non-standard worker_api_port of ${worker_api_port} found. Did you mean to use 8939?" fi +if [[ "${blockchains}" == "silicoin" && "${worker_api_port}" != '8941' ]]; then + echo "Silicoin worker with non-standard worker_api_port of ${worker_api_port} found. Did you mean to use 8941?" +fi if [[ "${blockchains}" == "staicoin" && "${worker_api_port}" != '8934' ]]; then echo "Staicoin worker with non-standard worker_api_port of ${worker_api_port} found. Did you mean to use 8934?" fi diff --git a/web/models/chia.py b/web/models/chia.py index 28d55553..95c3a963 100644 --- a/web/models/chia.py +++ b/web/models/chia.py @@ -439,9 +439,11 @@ def get_add_connection_example(self, blockchain): if blockchain == 'maize': return "212.159.183.209:8644" if blockchain == 'nchain': - return "218.88.205.216:58445" + return "218.88.205.216:58445" if blockchain == 'shibgreen': return "218.89.239.144:7442" + if blockchain == 'silicoin': + return "67.172.84.54:22222" if blockchain == 'staicoin': return "173.54.12.193:1999" if blockchain == 'stor': @@ -470,6 +472,8 @@ def blockchain_port(self,blockchain): return 12331 if blockchain == 'maize': return 8644 + if blockchain == 'silicoin': + return 22447 if blockchain == 'shibgreen': return 7442 if blockchain == 'silicoin': diff --git a/web/templates/worker_launch.html b/web/templates/worker_launch.html index 1b04f24c..9bcd7b19 100644 --- a/web/templates/worker_launch.html +++ b/web/templates/worker_launch.html @@ -173,6 +173,9 @@ if (blockchain == 'shibgreen') { return 8939; } + if (blockchain == 'silicoin') { + return 8941; + } if (blockchain == 'staicoin') { return 8934; } @@ -219,6 +222,9 @@ if (blockchain == 'shibgreen') { return 18974; } + if (blockchain == 'silicoin') { + return 22447; + } if (blockchain == 'staicoin') { return 1692; } @@ -535,8 +541,6 @@

Machinaris Worker - Launch Config

Flora - -
@@ -544,6 +548,8 @@

Machinaris Worker - Launch Config

HDDCoin
+
+
@@ -572,6 +578,13 @@

Machinaris Worker - Launch Config

SHIBGreen
+
+ + +
@@ -586,7 +599,7 @@

Machinaris Worker - Launch Config

Stor
- +
 
From ff9ae0702a7bf7e88d2951fe4ab585447f828412 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Sat, 5 Feb 2022 21:48:57 -0700 Subject: [PATCH 02/85] Fix certs path lookup for Silicoin. --- api/views/certificates/resources.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/api/views/certificates/resources.py b/api/views/certificates/resources.py index 9bd7bbd8..42571c5d 100644 --- a/api/views/certificates/resources.py +++ b/api/views/certificates/resources.py @@ -57,9 +57,6 @@ def get(self): elif type == "maize": blockchain = "maize" dir = "/root/.maize/mainnet/config/ssl/ca" - elif type == "silicoin": - blockchain = "silicoin" - dir = "/root/.silicoin/mainnet/config/ssl/ca" elif type == "shibgreen": blockchain = "shibgreen" dir = "/root/.shibgreen/mainnet/config/ssl/ca" From 71b9e2be9fbfb95efd360200e32db06f8acd00c7 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Sun, 6 Feb 2022 08:32:54 -0700 Subject: [PATCH 03/85] Add 'All' page length option to Workers page - table listing. --- web/templates/workers.html | 1 + 1 file changed, 1 insertion(+) diff --git a/web/templates/workers.html b/web/templates/workers.html index 3b4d658d..8c66f7bf 100644 --- a/web/templates/workers.html +++ b/web/templates/workers.html @@ -127,6 +127,7 @@
For more, see the Machinaris Date: Mon, 7 Feb 2022 07:14:12 +0000 Subject: [PATCH 04/85] Bump actions/setup-python from 2.3.1 to 2.3.2 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2.3.1 to 2.3.2. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v2.3.1...v2.3.2) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/unit-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 1e236a6e..b3ca2374 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python 3.9 - uses: actions/setup-python@v2.3.1 + uses: actions/setup-python@v2.3.2 with: python-version: 3.9 - name: Install dependencies From 29884e348d1ab75a2e9fba4a5c673ef530d7a537 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Mon, 7 Feb 2022 11:33:10 -0700 Subject: [PATCH 05/85] Farmr + Silicoin - ports update --- scripts/farmr_setup.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/farmr_setup.sh b/scripts/farmr_setup.sh index b5d54d97..ca0dcc49 100644 --- a/scripts/farmr_setup.sh +++ b/scripts/farmr_setup.sh @@ -72,6 +72,11 @@ if [[ "${farmr_skip_launch}" == 'false' && (${mode} == 'fullnode' || ${mode} =~ cp -n blockchain/nch.json.template blockchain/nch.json echo "/chia-blockchain/venv/bin/chia" > override-nch-binary.txt elif [[ ${blockchains} == 'silicoin' ]]; then + sed -i 's/11560/22560/g' blockchain/sit.json.template + sed -i 's/11559/22559/g' blockchain/sit.json.template + sed -i 's/11555/22555/g' blockchain/sit.json.template + sed -i 's/11256/22256/g' blockchain/sit.json.template + sed -i 's/56402/22402/g' blockchain/sit.json.template cp -n blockchain/sit.json.template blockchain/sit.json echo "/silicoin-blockchain/venv/bin/sit" > override-sit-binary.txt elif [[ ${blockchains} == 'staicoin' ]]; then From c3d0cd8f3c4e0b78562d2ab5d10dcadb6db03d46 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Mon, 7 Feb 2022 12:09:24 -0700 Subject: [PATCH 06/85] Testing Chia main branch - DO NOT RUN! --- .github/workflows/develop-chia.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/develop-chia.yaml b/.github/workflows/develop-chia.yaml index 01f6bf05..cf7b619b 100644 --- a/.github/workflows/develop-chia.yaml +++ b/.github/workflows/develop-chia.yaml @@ -41,7 +41,7 @@ jobs: push: true build-args: | "MACHINARIS_STREAM=develop" - "CHIA_BRANCH=1.2.11" + "CHIA_BRANCH=main" tags: | ${{ secrets.DOCKERHUB_USERNAME }}/machinaris:develop ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris:develop From 3614ecc16442e426e623c55fadbef7976bcabeff Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Mon, 7 Feb 2022 12:13:48 -0700 Subject: [PATCH 07/85] Latest hash, disable pip fix to test. --- scripts/forks/chia_install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/forks/chia_install.sh b/scripts/forks/chia_install.sh index df47ab5b..5582c584 100644 --- a/scripts/forks/chia_install.sh +++ b/scripts/forks/chia_install.sh @@ -4,8 +4,8 @@ # CHIA_BRANCH=$1 -# On 2021-11-06 -HASH=b74a3f3849cadeece2fac3efa3cb55d7d3a0647f +# On 2022-02-07 +HASH=f2fe1dca6266f9b1f8ab61798ad40e5985f50b23 if [ -z ${CHIA_BRANCH} ]; then echo 'Skipping Chia install as not requested.' @@ -16,6 +16,6 @@ else git checkout $HASH chmod +x install.sh # 2022-01-30: pip broke due to https://github.com/pypa/pip/issues/10825 - sed -i 's/upgrade\ pip$/upgrade\ "pip<22.0"/' install.sh + #sed -i 's/upgrade\ pip$/upgrade\ "pip<22.0"/' install.sh /usr/bin/sh ./install.sh fi From 8dc5ac6f0bdc7c79d1cd1ce29777962b7d795870 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Mon, 7 Feb 2022 13:49:07 -0700 Subject: [PATCH 08/85] Temporarily disable add-ons to isolate Chia blockchain breakage. --- docker/entrypoint.sh | 14 +++++++------- scripts/forks/chia_install.sh | 2 -- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index cc9a88e3..b11942dd 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -54,10 +54,10 @@ if /usr/bin/bash /machinaris/scripts/forks/${blockchains}_launch.sh; then trap "chia stop all -d; exit 0" SIGINT SIGTERM # Conditionally install plotman on plotters and fullnodes, after the plotters setup - /usr/bin/bash /machinaris/scripts/plotman_setup.sh > /tmp/plotman_setup.log 2>&1 + #/usr/bin/bash /machinaris/scripts/plotman_setup.sh > /tmp/plotman_setup.log 2>&1 # Conditionally install chiadog on harvesters and fullnodes - /usr/bin/bash /machinaris/scripts/chiadog_setup.sh > /tmp/chiadog_setup.log 2>&1 + #/usr/bin/bash /machinaris/scripts/chiadog_setup.sh > /tmp/chiadog_setup.log 2>&1 # During concurrent startup of multiple fork containers, stagger less important setups sleep $[ ( $RANDOM % 180 ) + 1 ]s @@ -66,19 +66,19 @@ if /usr/bin/bash /machinaris/scripts/forks/${blockchains}_launch.sh; then /usr/bin/bash /machinaris/scripts/farmr_setup.sh > /tmp/farmr_setup.log 2>&1 # Conditionally install fd-cli on fullnodes, excluding Chia and Chives - /usr/bin/bash /machinaris/scripts/fd-cli_setup.sh > /tmp/fd-cli_setup.log 2>&1 + #/usr/bin/bash /machinaris/scripts/fd-cli_setup.sh > /tmp/fd-cli_setup.log 2>&1 # Conditionally build bladebit on plotters and fullnodes, sleep a bit first - /usr/bin/bash /machinaris/scripts/bladebit_setup.sh > /tmp/bladebit_setup.log 2>&1 + #/usr/bin/bash /machinaris/scripts/bladebit_setup.sh > /tmp/bladebit_setup.log 2>&1 # Conditionally madmax on plotters and fullnodes, sleep a bit first - /usr/bin/bash /machinaris/scripts/madmax_setup.sh > /tmp/madmax_setup.log 2>&1 + #/usr/bin/bash /machinaris/scripts/madmax_setup.sh > /tmp/madmax_setup.log 2>&1 # Conditionally install plotman on plotters and fullnodes, after the plotters setup - /usr/bin/bash /machinaris/scripts/plotman_autoplot.sh > /tmp/plotman_autoplot.log 2>&1 + #/usr/bin/bash /machinaris/scripts/plotman_autoplot.sh > /tmp/plotman_autoplot.log 2>&1 # Conditionally install forktools on fullnodes - /usr/bin/bash /machinaris/scripts/forktools_setup.sh > /tmp/forktools_setup.log 2>&1 + #/usr/bin/bash /machinaris/scripts/forktools_setup.sh > /tmp/forktools_setup.log 2>&1 fi diff --git a/scripts/forks/chia_install.sh b/scripts/forks/chia_install.sh index 5582c584..3a63803a 100644 --- a/scripts/forks/chia_install.sh +++ b/scripts/forks/chia_install.sh @@ -15,7 +15,5 @@ else git submodule update --init mozilla-ca git checkout $HASH chmod +x install.sh - # 2022-01-30: pip broke due to https://github.com/pypa/pip/issues/10825 - #sed -i 's/upgrade\ pip$/upgrade\ "pip<22.0"/' install.sh /usr/bin/sh ./install.sh fi From 4117ff6d30ea51265b0bc6c92c9a900935a1e5f8 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Mon, 7 Feb 2022 14:43:00 -0700 Subject: [PATCH 09/85] Packaging lib issue. --- scripts/plotman_setup.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/plotman_setup.sh b/scripts/plotman_setup.sh index 4dc6f4cf..e398e1f3 100644 --- a/scripts/plotman_setup.sh +++ b/scripts/plotman_setup.sh @@ -3,13 +3,17 @@ # Installs Plotman for plotting management; customized for non-interactive use by Machinaris # -PLOTMAN_REPO_URL=https://github.com/guydavis/plotman@development +PLOTMAN_BRANCH=development if [[ (${mode} == 'fullnode' || ${mode} =~ "plotter") && (${blockchains} == 'chia' || ${blockchains} == 'chives' || ${blockchains} == 'mmx') ]]; then if [[ ! -f /chia-blockchain/venv/bin/plotman ]]; then - cd /chia-blockchain echo 'Installing Plotman...' - venv/bin/pip3 install git+${PLOTMAN_REPO_URL} || venv/bin/pip3 install git+${PLOTMAN_REPO_URL} + cd / + git clone --branch ${PLOTMAN_BRANCH} https://github.com/guydavis/plotman.git + cd plotman + # Chia 1.3 requires packaging==21.0 + sed -i 's/20.9/21.0/g' setup.cfg + /chia-blockchain/venv/bin/python setup.py install apt update && apt install -y rsync fi fi \ No newline at end of file From 74289ed04ee34c7825407ad1ec75f909ee5622c3 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Mon, 7 Feb 2022 14:58:28 -0700 Subject: [PATCH 10/85] Re-enable add-ons after fixing Plotman library versioning. --- docker/entrypoint.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index b11942dd..cc9a88e3 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -54,10 +54,10 @@ if /usr/bin/bash /machinaris/scripts/forks/${blockchains}_launch.sh; then trap "chia stop all -d; exit 0" SIGINT SIGTERM # Conditionally install plotman on plotters and fullnodes, after the plotters setup - #/usr/bin/bash /machinaris/scripts/plotman_setup.sh > /tmp/plotman_setup.log 2>&1 + /usr/bin/bash /machinaris/scripts/plotman_setup.sh > /tmp/plotman_setup.log 2>&1 # Conditionally install chiadog on harvesters and fullnodes - #/usr/bin/bash /machinaris/scripts/chiadog_setup.sh > /tmp/chiadog_setup.log 2>&1 + /usr/bin/bash /machinaris/scripts/chiadog_setup.sh > /tmp/chiadog_setup.log 2>&1 # During concurrent startup of multiple fork containers, stagger less important setups sleep $[ ( $RANDOM % 180 ) + 1 ]s @@ -66,19 +66,19 @@ if /usr/bin/bash /machinaris/scripts/forks/${blockchains}_launch.sh; then /usr/bin/bash /machinaris/scripts/farmr_setup.sh > /tmp/farmr_setup.log 2>&1 # Conditionally install fd-cli on fullnodes, excluding Chia and Chives - #/usr/bin/bash /machinaris/scripts/fd-cli_setup.sh > /tmp/fd-cli_setup.log 2>&1 + /usr/bin/bash /machinaris/scripts/fd-cli_setup.sh > /tmp/fd-cli_setup.log 2>&1 # Conditionally build bladebit on plotters and fullnodes, sleep a bit first - #/usr/bin/bash /machinaris/scripts/bladebit_setup.sh > /tmp/bladebit_setup.log 2>&1 + /usr/bin/bash /machinaris/scripts/bladebit_setup.sh > /tmp/bladebit_setup.log 2>&1 # Conditionally madmax on plotters and fullnodes, sleep a bit first - #/usr/bin/bash /machinaris/scripts/madmax_setup.sh > /tmp/madmax_setup.log 2>&1 + /usr/bin/bash /machinaris/scripts/madmax_setup.sh > /tmp/madmax_setup.log 2>&1 # Conditionally install plotman on plotters and fullnodes, after the plotters setup - #/usr/bin/bash /machinaris/scripts/plotman_autoplot.sh > /tmp/plotman_autoplot.log 2>&1 + /usr/bin/bash /machinaris/scripts/plotman_autoplot.sh > /tmp/plotman_autoplot.log 2>&1 # Conditionally install forktools on fullnodes - #/usr/bin/bash /machinaris/scripts/forktools_setup.sh > /tmp/forktools_setup.log 2>&1 + /usr/bin/bash /machinaris/scripts/forktools_setup.sh > /tmp/forktools_setup.log 2>&1 fi From 86c97563ac11a9ff9ba7f5728531e81c476b5661 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Mon, 7 Feb 2022 15:17:47 -0700 Subject: [PATCH 11/85] Exclude CAT wallet types from sum. --- CHANGELOG.md | 1 + web/models/chia.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ffd4c2e..a4670044 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [0.7.0] - 2022-03-04 + - [Chia](https://github.com/Chia-Network/chia-blockchain) - testing of upcoming v1.3 release (labelled as v1.2.12 now) - [Silicoin](https://github.com/silicoin-network/silicoin-blockchain) - supported again as per Discord votes. ## [0.6.9] - 2022-02-04 diff --git a/web/models/chia.py b/web/models/chia.py index 95c3a963..5ee1719d 100644 --- a/web/models/chia.py +++ b/web/models/chia.py @@ -224,6 +224,19 @@ def __init__(self, wallets, cold_wallet_addresses={}): 'usd_balance': converters.to_usd(wallet.blockchain, total_balance), 'updated_at': wallet.updated_at }) + def exclude_cat_wallets(self, wallet_details): + skip = 0 + details = [] + for line in wallet_details.split('\n'): + if "type CAT" in line: + skip = 3 # Skip next 3 lines for this CAT wallet + elif skip > 0: + skip = skip -1 + else: + details.append(line) + print('\n'.join(details)) + return '\n'.join(details) + def sum_chia_wallet_balance(self, hostname, blockchain, include_cold_balance=True): numeric_const_pattern = '-Total\sBalance:\s+((?: (?: \d* \. \d+ ) | (?: \d+ \.? ) )(?: [Ee] [+-]? \d+ )?)' rx = re.compile(numeric_const_pattern, re.VERBOSE) @@ -232,7 +245,7 @@ def sum_chia_wallet_balance(self, hostname, blockchain, include_cold_balance=Tru for wallet in self.wallets: if wallet.hostname == hostname and wallet.blockchain == blockchain: try: - for balance in rx.findall(wallet.details): + for balance in rx.findall(self.exclude_cat_wallets(wallet.details)): #app.logger.info("Found balance of {0} for for {1} - {2}".format(balance, # wallet.hostname, wallet.blockchain)) sum += locale.atof(balance) From 6cb98052cdffff6d2c4e218e2da1788654cbb69c Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Mon, 7 Feb 2022 18:05:31 -0700 Subject: [PATCH 12/85] More debugging for Summary page issue report in Discord. --- web/actions/chia.py | 4 ++++ web/models/chia.py | 2 +- web/templates/alerts.html | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/web/actions/chia.py b/web/actions/chia.py index 1771867b..0564b7e4 100644 --- a/web/actions/chia.py +++ b/web/actions/chia.py @@ -130,10 +130,14 @@ def load_blockchains(): return None def load_summaries(): + app.logger.info("Loading Summary page data...") try: blockchains = load_blockchains() + app.logger.info("Found {0} blockchains states for summary page.".format(len(blockchains.rows))) farms = load_farm_summary() + app.logger.info("Found {0} blockchain farms for summary page.".format(len(farms.farms))) summary_stats = stats.load_summary_stats(blockchains.rows) + app.logger.info("Found {0} blockchain stats.".format(len(summary_stats))) return Summaries(blockchains, farms.farms, farms.wallets, summary_stats) except Exception as ex: app.logger.error("Error loading summary: {0}".format(str(ex))) diff --git a/web/models/chia.py b/web/models/chia.py index 5ee1719d..2fbc2f52 100644 --- a/web/models/chia.py +++ b/web/models/chia.py @@ -23,6 +23,7 @@ def __init__(self, blockchains, farms, wallets, stats): for blockchain in blockchains.rows: farm = self.find_farm(farms, blockchain['blockchain']) wallet = self.find_wallet(wallets, blockchain['blockchain']) + app.logger.info("Adding summary row for {0}".format(blockchain['blockchain'])) self.rows.append({ 'blockchain': blockchain['blockchain'], 'status': blockchain['status'], @@ -234,7 +235,6 @@ def exclude_cat_wallets(self, wallet_details): skip = skip -1 else: details.append(line) - print('\n'.join(details)) return '\n'.join(details) def sum_chia_wallet_balance(self, hostname, blockchain, include_cold_balance=True): diff --git a/web/templates/alerts.html b/web/templates/alerts.html index 727e2366..2b108f46 100644 --- a/web/templates/alerts.html +++ b/web/templates/alerts.html @@ -131,7 +131,8 @@
Expect at least a summary notification once daily as long as running above.< } $(document).ready(function () { $('#data').DataTable({ - "order": [[5, "desc"]], + "pageLength": 10, + "lengthMenu": [ [10, 25, 50, 100, 200, -1], [10, 25, 50, 100, 200, "All"] ], "columnDefs": [{ "orderable": false, targets: [0] }], }); $("#btnStart").click(function () { From 38145bb2706508f874e0777f28a62c1c986e21da Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Tue, 8 Feb 2022 15:32:37 -0700 Subject: [PATCH 13/85] Fix connection parsing for MMX to match their latest behavior. --- api/commands/pools_cli.py | 14 ++++++------ web/models/chia.py | 36 +++++++++++++++++++++---------- web/routes.py | 4 +++- web/templates/connections.html | 7 +++++- web/templates/settings/pools.html | 10 ++++----- 5 files changed, 46 insertions(+), 25 deletions(-) diff --git a/api/commands/pools_cli.py b/api/commands/pools_cli.py index 8c726b0c..49b0ee06 100644 --- a/api/commands/pools_cli.py +++ b/api/commands/pools_cli.py @@ -122,7 +122,7 @@ def process_pool_save(blockchain, choice, pool_wallet_id, pool_url, current_pool def process_pool_leave(blockchain, pool_wallet_id): chia_binary = globals.get_blockchain_binary(blockchain) - cmd = "{0} plotnft leave -y -i {1}".format(chia_binary, pool_wallet_id) + cmd = "wallet_num{0} plotnft leave -y -i {1}".format(chia_binary, pool_wallet_id) app.logger.info("Attempting to leave pool: {0}".format(cmd)) result = "" child = pexpect.spawn(cmd) @@ -147,7 +147,7 @@ def process_pool_leave(blockchain, pool_wallet_id): for line in stdout_lines: if "Error" in line: raise Exception('Error while leaving pool: ' + line) - return 'Successfully left pool, switching to self plotting. Please wait a while to complete, then refresh page. View the log for details.' + return 'Successfully left pool, switching to self plotting. Please wait a few minutes or more to complete. DO NOT immediately re-submit your request. View the log for details.' def process_pool_join(blockchain, pool_url, pool_wallet_id): chia_binary = globals.get_blockchain_binary(blockchain) @@ -162,10 +162,10 @@ def process_pool_join(blockchain, pool_url, pool_wallet_id): if not result.netloc: raise Exception("No hostname or IP provided.") if pool_wallet_id: # Just joining a pool with existing NFT - cmd = "{0} plotnft join -y -u {1} -i {2}".format(chia_binary, pool_url, pool_wallet_id) + cmd = "wallet_num{0} plotnft join -y -u {1} -i {2}".format(chia_binary, pool_url, pool_wallet_id) pool_wallet_id = pool_wallet_id else: # Both creating NFT and joining pool in one setp - cmd = "{0} plotnft create -y -u {1} -s pool".format(chia_binary, pool_url) + cmd = "wallet_num{0} plotnft create -y -u {1} -s pool".format(chia_binary, pool_url) pool_wallet_id = 1 app.logger.info("Executing: {0}".format(cmd)) result = "" @@ -191,11 +191,11 @@ def process_pool_join(blockchain, pool_url, pool_wallet_id): for line in stdout_lines: if "Error" in line: raise Exception('Error while joining Chia pool. Please double-check pool URL: {0} {1}'.format(pool_url, line)) - return 'Successfully joined {0} pool by creating Chia NFT. Please wait a while to complete, then refresh this page. DO NOT immediately re-submit the request. Be patient! View the log for details.'.format(pool_url) + return 'Successfully joined {0} pool by creating Chia NFT. Please wait a few minutes or more to complete. DO NOT immediately re-submit your request. Be patient! View the log for details.'.format(pool_url) def process_self_pool(blockchain, pool_wallet_id): chia_binary = globals.get_blockchain_binary(blockchain) - cmd = "{0} plotnft create -y -s local".format(chia_binary) + cmd = "wallet_num{0} plotnft create -y -s local".format(chia_binary) app.logger.info("Attempting to create NFT for self-pooling. {0}".format(cmd)) result = "" child = pexpect.spawn(cmd) @@ -220,4 +220,4 @@ def process_self_pool(blockchain, pool_wallet_id): for line in stdout_lines: if "Error" in line: raise Exception('Error while creating self-pooling NFT: {0}'.format(line)) - return 'Successfully created a NFT for self-pooling. Please wait a while to complete, then refresh the page. DO NOT immediately re-submit the request. Be patient! View the log for details.' + return 'Successfully created a NFT for self-pooling. Please wait a few minutes or more to complete. DO NOT immediately re-submit your request. Be patient! View the log for details.' diff --git a/web/models/chia.py b/web/models/chia.py index 2fbc2f52..2348fa95 100644 --- a/web/models/chia.py +++ b/web/models/chia.py @@ -482,7 +482,7 @@ def blockchain_port(self,blockchain): if blockchain == 'nchain': return 58445 if blockchain == 'mmx': - return 12331 + return 12334 if blockchain == 'maize': return 8644 if blockchain == 'silicoin': @@ -502,7 +502,9 @@ def parse_chia(self, connection, blockchain): conns = [] for line in connection.details.split('\n'): try: - if line.strip().startswith('Connections:'): + if line.strip().startswith('Connections:') or \ + line.strip().startswith('Connection error.') or \ + line.strip().startswith('This is normal if full node'): pass elif line.strip().startswith('Type'): self.columns = line.lower().replace('last connect', 'last_connect') \ @@ -522,14 +524,13 @@ def parse_chia(self, connection, blockchain): else: vals = line.strip().split() if len(vals) > 7: + last_connect = str(datetime.datetime.today().year) + ' ' + vals[4] + ' ' + vals[5] + ' ' + vals[6] connection = { 'type': vals[0], 'ip': vals[1], 'ports': vals[2], 'nodeid': vals[3].replace('...',''), - 'last_connect': datetime.datetime.strptime( \ - str(datetime.datetime.today().year) + ' ' + vals[4] + ' ' + vals[5] + ' ' + vals[6], - '%Y %b %d %H:%M:%S'), + 'last_connect': datetime.datetime.strptime(last_connect, '%Y %b %d %H:%M:%S'), 'mib_up': float(vals[7].split('|')[0]), 'mib_down': float(vals[7].split('|')[1]) } @@ -541,6 +542,7 @@ def parse_chia(self, connection, blockchain): else: app.logger.info("Bad connection line: {0}".format(line)) except: + app.logger.info("Exception parsing connection line: {0}".format(line)) app.logger.info(traceback.format_exc()) return conns @@ -549,18 +551,18 @@ def parse_mmx(self, connection, blockchain): for line in connection.details.split('\n'): try: #app.logger.info(line) - m = re.match("\[(.+)\] height = (\d+), (\d+\.?\d*) MB recv, (\d*\.?\d*) MB sent, timeout = (\d+\.?\d*) sec", line.strip(), re.IGNORECASE) + m = re.match("\[(.+)\]\s+height\s+=\s+(\!?\d+), (\w+) \(\d+\.\d+\), (\d+\.?\d*) (\w)B/s recv, (\d*\.?\d*) (\w)B/s send,.* since (\d+) min, .* (\d+\.?\d?) sec timeout", line.strip(), re.IGNORECASE) if m: connection = { - 'type': 'peer', + 'type': m.group(3), 'ip': m.group(1), 'height': m.group(2), 'ports': '', 'nodeid': '', - 'last_connect': '', - 'mib_up': m.group(4), - 'mib_down': m.group(3), - 'timeout': m.group(5) + 'last_connect': 'since {0} min'.format(m.group(8)), + 'mib_up': "%.1f"% round(self.rate_to_mb(m.group(6), m.group(7)) * int(m.group(8)) * 60, 2), + 'mib_down': "%.1f"% round(self.rate_to_mb(m.group(4), m.group(5)) * int(m.group(8)) * 60, 2), + 'timeout': m.group(9) } conns.append(connection) elif line.strip(): @@ -569,3 +571,15 @@ def parse_mmx(self, connection, blockchain): app.logger.info(traceback.format_exc()) return conns + def rate_to_mb(self, rate, unit): + if unit.lower() == 'k': + try: + return float(rate) / 1024 + except: + app.logger.error("Invalid transmission rate in KB/sec provided: {0}".format(rate)) + return rate + elif unit.lower() == 'm': + return float(rate) + else: + app.logger.error("Unknown transmission rate unit character of {0} encountered.".format(unit)) + return rate diff --git a/web/routes.py b/web/routes.py index 5041c8e9..f2dde069 100644 --- a/web/routes.py +++ b/web/routes.py @@ -316,7 +316,9 @@ def settings_pools(): selected_fullnode = worker.get_fullnode(selected_blockchain) launcher_ids = request.form.getlist('{0}-launcher_id'.format(selected_blockchain)) wallet_nums = request.form.getlist('{0}-wallet_num'.format(selected_blockchain)) - choices = request.form.getlist('{0}-choice'.format(selected_blockchain)) + choices = [] + for num in wallet_nums: + choices.append(request.form.get('{0}-choice-{1}'.format(selected_blockchain, num))) pool_urls = request.form.getlist('{0}-pool_url'.format(selected_blockchain)) current_pool_urls = request.form.getlist('{0}-current_pool_url'.format(selected_blockchain)) p.send_request(selected_fullnode, selected_blockchain, launcher_ids, choices, pool_urls, wallet_nums, current_pool_urls) diff --git a/web/templates/connections.html b/web/templates/connections.html index ca7ac63c..3d08f2e4 100644 --- a/web/templates/connections.html +++ b/web/templates/connections.html @@ -103,12 +103,13 @@
+ {% if connection.blockchain != 'mmx' %} + {% endif %}
-
+ {% if connection.blockchain != 'mmx' %} + {% endif %}
+ {% if connection.blockchain != 'mmx' %} + {% endif %}
diff --git a/web/templates/settings/pools.html b/web/templates/settings/pools.html index e177b44a..66648f13 100644 --- a/web/templates/settings/pools.html +++ b/web/templates/settings/pools.html @@ -103,8 +103,8 @@
Wallet ID: {{ plotnft.wallet_num }}
{% endif %}
-
-  
-
From 77d5e6c86b8ce358b791d0ded48fa4968aa066b9 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Wed, 9 Feb 2022 09:35:44 -0700 Subject: [PATCH 14/85] Chiadog config for Silicoin. --- config/chiadog/silicoin.sample.yaml | 91 +++++++++++++++++++++++++++++ scripts/chiadog_setup.sh | 2 +- 2 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 config/chiadog/silicoin.sample.yaml diff --git a/config/chiadog/silicoin.sample.yaml b/config/chiadog/silicoin.sample.yaml new file mode 100644 index 00000000..99276c3b --- /dev/null +++ b/config/chiadog/silicoin.sample.yaml @@ -0,0 +1,91 @@ +# This is useful to differentiate multiple +# instances monitoring multiple harvesters +notification_title_prefix: '$HOSTNAME-silicoin' +log_level: INFO +coin_name: 'silicoin' +coin_symbol: 'sit' + +# Only one consumer can be enabled at a time, you can +# delete the section for the consumer which you aren't using +# DON'T CHANGE file_path IT'S ALREADY SET IN-CONTAINER FOR MACHINARIS! +chia_logs: + file_log_consumer: + enable: true + prefix: 'chia' + file_path: '~/.chia/sit/mainnet/log/debug.log' + +# Enable this and chiadog will ping a remote server every 5 minutes +# That way you can know that the monitoring is running as expected +#keep_alive_monitor: +# enable_remote_ping: false +# ping_url: '' + +# Enable this and you'll receive a daily summary notification +# on your farm performance at the specified time of the day. +daily_stats: + enable: true + time_of_day: 21 + +# We support a lot of notifiers, please check the README for more +# information. You can delete the sections which you aren't using. +# You can also enable more than one notifier and send different +# notifications to each of them. E.g. enable daily_stats only to E-mail. +# If you enable wallet_events you'll get notifications anytime your +# wallet receives some XCH (e.g. farming reward). +notifier: + pushover: + enable: false + daily_stats: true + wallet_events: true + credentials: + api_token: 'dummy_token' + user_key: 'dummy_key' + telegram: + enable: false + daily_stats: true + wallet_events: true + credentials: + bot_token: 'dummy_bot_token' + chat_id: 'dummy_chat_id' + smtp: + enable: false + daily_stats: true + wallet_events: true + credentials: + sender: 'silicoin@example.com' + sender_name: 'Machinaris' + recipient: 'you@example.com' + username_smtp: 'username' + password_smtp: 'password' + host: 'smtp.example.com' + port: 587 + script: + # DON'T CHANGE THIS SCRIPT NOTIFIER, IT'S USED BY MACHINARIS! + enable: true + daily_stats: true + wallet_events: true + script_path: '/root/.chia/chiadog/notifier.sh' + discord: + enable: false + daily_stats: true + wallet_events: true + credentials: + webhook_url: 'https://discord.com/api/webhooks/...' + slack: + enable: false + daily_stats: true + wallet_events: true + credentials: + webhook_url: 'https://hooks.slack.com/services/...' + mqtt: + enable: false + daily_stats: true + wallet_events: true + topic: silicoin/silicoindog/alert + qos: 1 + retain: false + credentials: + host: '192.168.0.10' + port: 8883 + username: '' + password: '' diff --git a/scripts/chiadog_setup.sh b/scripts/chiadog_setup.sh index 147d686f..fce751c2 100644 --- a/scripts/chiadog_setup.sh +++ b/scripts/chiadog_setup.sh @@ -22,7 +22,7 @@ if [[ (${mode} == 'fullnode' || ${mode} =~ "harvester") && ${blockchains} != 'mm echo 'Configuring Chiadog...' mkdir -p /root/.chia/chiadog/logs cp -n /machinaris/config/chiadog/${blockchains}.sample.yaml /root/.chia/chiadog/config.yaml - sed "s/\$HOSTNAME/`hostname -s`/g" /root/.chia/chiadog/config.yaml + sed -i "s/\$HOSTNAME/`hostname -s`/g" /root/.chia/chiadog/config.yaml cp -f /machinaris/scripts/chiadog_notifier.sh /root/.chia/chiadog/notifier.sh && chmod 755 /root/.chia/chiadog/notifier.sh echo 'Starting Chiadog...' cd /chiadog From 7dc87ca7ba6e94f4b9eb5dde686466046ebb0dff Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Fri, 11 Feb 2022 10:45:21 -0700 Subject: [PATCH 15/85] Use Chia main branch. --- .github/workflows/develop-mmx.yaml | 2 +- .github/workflows/main-chia.yaml | 2 +- .github/workflows/main-mmx.yaml | 2 +- .github/workflows/test-chia.yaml | 2 +- .github/workflows/test-mmx.yaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/develop-mmx.yaml b/.github/workflows/develop-mmx.yaml index 3f46a7ab..7b6810c6 100644 --- a/.github/workflows/develop-mmx.yaml +++ b/.github/workflows/develop-mmx.yaml @@ -42,7 +42,7 @@ jobs: build-args: | "MACHINARIS_STREAM=develop" "MMX_BRANCH=master" - "CHIA_BRANCH=1.2.11" + "CHIA_BRANCH=main" tags: | ${{ secrets.DOCKERHUB_USERNAME }}/machinaris-mmx:develop ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris-mmx:develop diff --git a/.github/workflows/main-chia.yaml b/.github/workflows/main-chia.yaml index 93f143c7..c4cdcb27 100644 --- a/.github/workflows/main-chia.yaml +++ b/.github/workflows/main-chia.yaml @@ -42,7 +42,7 @@ jobs: push: true build-args: | "MACHINARIS_STREAM=latest" - "CHIA_BRANCH=1.2.11" + "CHIA_BRANCH=main" tags: | ${{ secrets.DOCKERHUB_USERNAME }}/machinaris:latest ${{ secrets.DOCKERHUB_USERNAME }}/machinaris:v${{ github.event.inputs.version }} diff --git a/.github/workflows/main-mmx.yaml b/.github/workflows/main-mmx.yaml index b808d591..73f8b44c 100644 --- a/.github/workflows/main-mmx.yaml +++ b/.github/workflows/main-mmx.yaml @@ -43,7 +43,7 @@ jobs: build-args: | "MACHINARIS_STREAM=latest" "MMX_BRANCH=master" - "CHIA_BRANCH=1.2.11" + "CHIA_BRANCH=main" tags: | ${{ secrets.DOCKERHUB_USERNAME }}/machinaris-mmx:latest ${{ secrets.DOCKERHUB_USERNAME }}/machinaris-mmx:v${{ github.event.inputs.version }} diff --git a/.github/workflows/test-chia.yaml b/.github/workflows/test-chia.yaml index f3589be2..52f98121 100644 --- a/.github/workflows/test-chia.yaml +++ b/.github/workflows/test-chia.yaml @@ -41,7 +41,7 @@ jobs: push: true build-args: | "MACHINARIS_STREAM=test" - "CHIA_BRANCH=1.2.11" + "CHIA_BRANCH=main" tags: | ${{ secrets.DOCKERHUB_USERNAME }}/machinaris:test ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris:test diff --git a/.github/workflows/test-mmx.yaml b/.github/workflows/test-mmx.yaml index 6b4f57cb..ec0f3374 100644 --- a/.github/workflows/test-mmx.yaml +++ b/.github/workflows/test-mmx.yaml @@ -42,7 +42,7 @@ jobs: build-args: | "MACHINARIS_STREAM=test" "MMX_BRANCH=master" - "CHIA_BRANCH=1.2.11" + "CHIA_BRANCH=main" tags: | ${{ secrets.DOCKERHUB_USERNAME }}/machinaris-mmx:test ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/machinaris-mmx:test From 2c342b0b77f5b5874fd39a5c424fa06490007fb4 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Sat, 12 Feb 2022 15:20:14 -0700 Subject: [PATCH 16/85] Link to Chia 1.3 beta. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4670044..367e7a69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [0.7.0] - 2022-03-04 - - [Chia](https://github.com/Chia-Network/chia-blockchain) - testing of upcoming v1.3 release (labelled as v1.2.12 now) + - [Chia](https://www.chia.net/2022/02/09/1.3-beta-release.en.html) - beta of v1.3 release (chia version reports v1.2.12dev254 currently) - [Silicoin](https://github.com/silicoin-network/silicoin-blockchain) - supported again as per Discord votes. ## [0.6.9] - 2022-02-04 From f2eb5ab101c0a14f61e39466638c76d6fe894e88 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Sat, 12 Feb 2022 15:52:51 -0700 Subject: [PATCH 17/85] Start on localization. --- docker/dockerfile.base | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/dockerfile.base b/docker/dockerfile.base index a58429c3..320ad749 100644 --- a/docker/dockerfile.base +++ b/docker/dockerfile.base @@ -17,6 +17,8 @@ RUN apt-get update \ iproute2 \ iputils-ping \ jq \ + locales \ + locales-all \ logrotate \ lsb-release \ openssl \ From e0ecc79c17ab1ab8af9030b446886aa2e0e542ca Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Sat, 12 Feb 2022 15:57:58 -0700 Subject: [PATCH 18/85] Default locale. --- docker/dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/dockerfile b/docker/dockerfile index 883b39f5..086c1a27 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -85,6 +85,9 @@ ENV FORKTOOLSHIDDENDIRS=/root ENV PATH="${PATH}:/chia-blockchain/venv/bin:/forktools:/mmx-node/build" ENV TZ=Etc/UTC +ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 ENV FLASK_ENV=production ENV XDG_CONFIG_HOME=/root/.chia ENV AUTO_PLOT=false From 1fbbbcc1069bea123665c4e6093fbdf990a46979 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Sun, 13 Feb 2022 20:11:54 -0700 Subject: [PATCH 19/85] Start on translations. --- api/__init__.py | 9 +- api/babel.cfg | 3 + api/default_settings.py | 2 + api/translations/de/LC_MESSAGES/messages.po | 20 +++ api/translations/fr/LC_MESSAGES/messages.po | 20 +++ common/config/globals.py | 2 +- docker/dockerfile | 1 + scripts/forks/mmx_launch.sh | 5 + scripts/i18n/compile.sh | 21 ++++ scripts/i18n/extract.sh | 17 +++ scripts/i18n/init.sh | 20 +++ web/__init__.py | 9 +- web/babel.cfg | 3 + web/default_settings.py | 2 + web/routes.py | 26 ++-- web/templates/setup.html | 50 ++++---- web/translations/de/LC_MESSAGES/messages.po | 129 +++++++++++++++++++ web/translations/fr/LC_MESSAGES/messages.po | 130 ++++++++++++++++++++ 18 files changed, 425 insertions(+), 44 deletions(-) create mode 100644 api/babel.cfg create mode 100644 api/translations/de/LC_MESSAGES/messages.po create mode 100644 api/translations/fr/LC_MESSAGES/messages.po create mode 100644 scripts/i18n/compile.sh create mode 100644 scripts/i18n/extract.sh create mode 100644 scripts/i18n/init.sh create mode 100644 web/babel.cfg create mode 100644 web/translations/de/LC_MESSAGES/messages.po create mode 100644 web/translations/fr/LC_MESSAGES/messages.po diff --git a/api/__init__.py b/api/__init__.py index 1f49401f..70c3b9e7 100644 --- a/api/__init__.py +++ b/api/__init__.py @@ -5,7 +5,7 @@ import logging -from flask import Flask +from flask import Flask, request from flask_babel import Babel from flask_migrate import Migrate from sqlalchemy.engine import Engine @@ -32,6 +32,13 @@ def set_sqlite_pragma(dbapi_connection, connection_record): app.config.from_envvar('API_SETTINGS_FILE', silent=True) babel = Babel(app) +@babel.localeselector +def get_locale(): + for d in babel.translation_directories: + app.logger.debug(d) + app.logger.debug("Returning locale: {0}".format(request.accept_languages.best_match(app.config['LANGUAGES']))) + return request.accept_languages.best_match(app.config['LANGUAGES']) + from common.extensions.database import db migrate = Migrate(app, db) diff --git a/api/babel.cfg b/api/babel.cfg new file mode 100644 index 00000000..0cc0baca --- /dev/null +++ b/api/babel.cfg @@ -0,0 +1,3 @@ +[python: **.py] +[jinja2: **/templates/**.html] +extensions=jinja2.ext.autoescape,jinja2.ext.with_ \ No newline at end of file diff --git a/api/default_settings.py b/api/default_settings.py index 2c87a676..a275a31c 100644 --- a/api/default_settings.py +++ b/api/default_settings.py @@ -49,3 +49,5 @@ class DefaultConfig: STATUS_EVERY_X_MINUTES = 2 # Run status collection once every two minutes by default ALLOW_HARVESTER_CERT_LAN_DOWNLOAD = True + + LANGUAGES = ['de', 'fr'] diff --git a/api/translations/de/LC_MESSAGES/messages.po b/api/translations/de/LC_MESSAGES/messages.po new file mode 100644 index 00000000..c327094c --- /dev/null +++ b/api/translations/de/LC_MESSAGES/messages.po @@ -0,0 +1,20 @@ +# German translations for PROJECT. +# Copyright (C) 2022 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2022. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2022-02-13 15:24-0700\n" +"PO-Revision-Date: 2022-02-13 13:45-0700\n" +"Last-Translator: FULL NAME \n" +"Language: de\n" +"Language-Team: de \n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + diff --git a/api/translations/fr/LC_MESSAGES/messages.po b/api/translations/fr/LC_MESSAGES/messages.po new file mode 100644 index 00000000..157c0932 --- /dev/null +++ b/api/translations/fr/LC_MESSAGES/messages.po @@ -0,0 +1,20 @@ +# French translations for PROJECT. +# Copyright (C) 2022 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2022. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2022-02-13 15:24-0700\n" +"PO-Revision-Date: 2022-02-13 13:45-0700\n" +"Last-Translator: FULL NAME \n" +"Language: fr\n" +"Language-Team: fr \n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + diff --git a/common/config/globals.py b/common/config/globals.py index 38ba35b0..3a6514c5 100644 --- a/common/config/globals.py +++ b/common/config/globals.py @@ -148,7 +148,7 @@ def is_setup(): CHIA_BLOCKCHAIN_DB_SIZE = 45 * 1024 * 1024 * 1024 # Almost 45 uncompressed GB in early 2022 def blockchain_downloading(): db_path = '/root/.chia/mainnet/db' - if path.exists(f"{db_path}/blockchain_v1_mainnet.sqlite"): + if path.exists(f"{db_path}/blockchain_v1_mainnet.sqlite") or path.exists(f"{db_path}/blockchain_v2_mainnet.sqlite"): return [100, None] tmp_path = f"{db_path}/chia" if not path.exists(tmp_path): diff --git a/docker/dockerfile b/docker/dockerfile index 086c1a27..84dc6866 100644 --- a/docker/dockerfile +++ b/docker/dockerfile @@ -44,6 +44,7 @@ RUN \ && /usr/bin/bash /machinaris/scripts/forks/stor_install.sh ${STOR_BRANCH} \ && /usr/bin/bash /machinaris/scripts/pull_3rd_party_libs.sh \ && /usr/bin/bash /machinaris/scripts/machinaris_install.sh \ + && /usr/bin/bash /machinaris/scripts/i18n/compile.sh \ && rm -rf \ /root/.cache \ /tmp/* \ diff --git a/scripts/forks/mmx_launch.sh b/scripts/forks/mmx_launch.sh index 22f7ef8d..231ee0bf 100644 --- a/scripts/forks/mmx_launch.sh +++ b/scripts/forks/mmx_launch.sh @@ -44,6 +44,11 @@ elif [[ ${OPENCL_GPU} == 'amd' ]]; then # If AMD GPU is older than vega 10,use under command, but can't promise work normally. # Because, with --opencl=legacy, dkms will must be installed, it may pollute your kernel # amdgpu-install -y --usecase=opencl --opencl=rocr,legacy --no-32 --accept-eula +elif [[ ${OPENCL_GPU} == 'intel' ]]; then + apt update + apt install -y intel-opencl-icd +else + echo "No OPENCL_GPU provided. MMX blockchain will use use CPU instead." fi # Symlink the NETWORK file, use 'test4' for now diff --git a/scripts/i18n/compile.sh b/scripts/i18n/compile.sh new file mode 100644 index 00000000..bcd0263a --- /dev/null +++ b/scripts/i18n/compile.sh @@ -0,0 +1,21 @@ +# +# Compile current messages.po into messages.mo for use at runtime. +# + +# If building on Github servers, change to deployment root +if [ `pwd` != '/code/machinaris' ]; then # else stay in code root + cd /machinaris +fi + +for d in 'web' 'api'; +do + pushd $d >/dev/null + LANGS=$(grep -oP "LANGUAGES = \[\K(.*)\]" ./default_settings.py | cut -d ']' -f 1 | tr -d \'\" | tr -d ' ') + IFS=','; + for lang in $LANGS; + do + pybabel compile -d ./translations + chmod 777 ./translations/$lang/LC_MESSAGES/* + done + popd >/dev/null +done diff --git a/scripts/i18n/extract.sh b/scripts/i18n/extract.sh new file mode 100644 index 00000000..a80e3c65 --- /dev/null +++ b/scripts/i18n/extract.sh @@ -0,0 +1,17 @@ +# +# Generate messages for internationalization. +# + +for d in 'web' 'api'; +do + pushd $d >/dev/null + LANGS=$(grep -oP "LANGUAGES = \[\K(.*)\]" ./default_settings.py | cut -d ']' -f 1 | tr -d \'\" | tr -d ' ') + IFS=','; + for lang in $LANGS; + do + pybabel extract -F babel.cfg -k _l -o messages.pot . + pybabel update -i messages.pot -d ./translations + chmod 777 ./translations/$lang/LC_MESSAGES/* + done + popd >/dev/null +done diff --git a/scripts/i18n/init.sh b/scripts/i18n/init.sh new file mode 100644 index 00000000..8565b0ee --- /dev/null +++ b/scripts/i18n/init.sh @@ -0,0 +1,20 @@ +# +# Initialize translation files for each supported language. +# + +for d in 'web' 'api'; +do + pushd $d >/dev/null + LANGS=$(grep -oP "LANGUAGES = \[\K(.*)\]" ./default_settings.py | cut -d ']' -f 1 | tr -d \'\" | tr -d ' ') + IFS=','; + for lang in $LANGS; + do + #if [ -d ./translations/$lang ]; then + # echo "Skipping initialization of $d/$lang as translations folder already exists." + #else + pybabel init -i messages.pot -d ./translations -l $lang + chmod 777 ./translations/$lang/LC_MESSAGES/* + #fi + done + popd >/dev/null +done diff --git a/web/__init__.py b/web/__init__.py index 4a0299fc..ff95f360 100644 --- a/web/__init__.py +++ b/web/__init__.py @@ -3,7 +3,7 @@ import pytz import re -from flask import Flask +from flask import Flask, request from flask_babel import Babel from flask_sqlalchemy import SQLAlchemy from sqlalchemy.engine import Engine @@ -18,6 +18,13 @@ app.config.from_envvar('WEB_SETTINGS_FILE', silent=True) babel = Babel(app) +@babel.localeselector +def get_locale(): + for d in babel.translation_directories: + app.logger.debug(d) + app.logger.debug("Returning locale: {0}".format(request.accept_languages.best_match(app.config['LANGUAGES']))) + return request.accept_languages.best_match(app.config['LANGUAGES']) + @event.listens_for(Engine, "connect") def set_sqlite_pragma(dbapi_connection, connection_record): cursor = dbapi_connection.cursor() diff --git a/web/babel.cfg b/web/babel.cfg new file mode 100644 index 00000000..0cc0baca --- /dev/null +++ b/web/babel.cfg @@ -0,0 +1,3 @@ +[python: **.py] +[jinja2: **/templates/**.html] +extensions=jinja2.ext.autoescape,jinja2.ext.with_ \ No newline at end of file diff --git a/web/default_settings.py b/web/default_settings.py index ddb43012..e6483446 100644 --- a/web/default_settings.py +++ b/web/default_settings.py @@ -37,3 +37,5 @@ class DefaultConfig: CONTROLLER_PORT = os.environ['controller_api_port'] if 'controller_api_port' in os.environ else '8926' MAX_CHART_CHALLENGES_MINS = 15 + + LANGUAGES = ['de', 'fr'] diff --git a/web/routes.py b/web/routes.py index f2dde069..b5754f9a 100644 --- a/web/routes.py +++ b/web/routes.py @@ -10,6 +10,8 @@ from datetime import datetime from flask import Flask, flash, redirect, render_template, abort, \ request, session, url_for, send_from_directory, make_response +from flask_babel import _ +from flask_babel import lazy_gettext as _l from common.config import globals from common.models import pools as po @@ -63,7 +65,7 @@ def setup(): elif request.form.get('action') == 'import': show_setup = not chia.import_key(key_paths[0], request.form.get('mnemonic'), globals.enabled_blockchains()[0]) [download_percentage, blockchain_download_size] = globals.blockchain_downloading() - app.logger.info(f"Blockchain download @ {download_percentage}% - {blockchain_download_size}") + app.logger.info(_("Blockchain download") + f" @ {download_percentage}% - {blockchain_download_size}") if show_setup: return render_template('setup.html', key_paths = key_paths, blockchain_download_size=blockchain_download_size, download_percentage=download_percentage) @@ -95,7 +97,7 @@ def plotting_jobs(): plot_ids = request.form.getlist('plot_id') plotman.action_plots(action, plot_ids) else: - app.logger.info("Unknown plotting form: {0}".format(request.form)) + app.logger.info(_("Unknown plotting form") + ": {0}".format(request.form)) return redirect(url_for('plotting_jobs')) # Force a redirect to allow time to update status plotters = plotman.load_plotters() plotting = plotman.load_plotting_summary() @@ -144,7 +146,7 @@ def farming_data(): return make_response({'draw': draw, 'recordsTotal': recordsTotal, 'recordsFiltered': recordsFiltered, "data": data}, 200) except: traceback.print_exc() - return make_response("Error! Please see logs.", 500) + return make_response(_("Error! Please see logs."), 500) @app.route('/farming/workers') def farming_workers(): @@ -170,7 +172,7 @@ def alerts(): elif request.form.get('action') == 'purge': chiadog.remove_all_alerts() else: - app.logger.info("Unknown alerts form: {0}".format(request.form)) + app.logger.info(_("Unknown alerts form") + ": {0}".format(request.form)) return redirect(url_for('alerts')) # Force a redirect to allow time to update status farmers = chiadog.load_farmers() notifications = chiadog.get_notifications() @@ -239,7 +241,7 @@ def connections(): elif request.form.get('action') == 'remove': chia.remove_connection(request.form.getlist('nodeid'), request.form.get('hostname'), request.form.get('blockchain')) else: - app.logger.info("Unknown form action: {0}".format(request.form)) + app.logger.info(_("Unknown form action") + ": {0}".format(request.form)) connections = chia.load_connections() return render_template('connections.html', reload_seconds=120, selected_blockchain = selected_blockchain, connections=connections, global_config=gc) @@ -354,31 +356,31 @@ def views_settings_config(path): config_type = request.args.get('type') w = worker.get_worker(request.args.get('worker'), request.args.get('blockchain')) if not w: - app.logger.info("No worker at {0} for fork {1}. Please select another fork.".format( - request.args.get('worker'), request.args.get('blockchain'))) + app.logger.info(_l("No worker at %{worker} for fork %{blockchain}. Please select another fork.", + worker=request.args.get('worker'), blockchain=request.args.get('blockchain'))) abort(404) if config_type == "alerts": try: response = make_response(chiadog.load_config(w, request.args.get('blockchain')), 200) except requests.exceptions.ConnectionError as ex: - response = make_response("For Alerts config, found no responding fullnode found for {0}. Please check your workers.".format(request.args.get('blockchain'))) + response = make_response(_("For Alerts config, found no responding fullnode found for %{blockchain}. Please check your workers.", blockchain=request.args.get('blockchain'))) elif config_type == "farming": try: response = make_response(chia.load_config(w, request.args.get('blockchain')), 200) except requests.exceptions.ConnectionError as ex: - response = make_response("For Farming config, found no responding fullnode found for {0}. Please check your workers.".format(request.args.get('blockchain'))) + response = make_response(_("For Farming config, found no responding fullnode found for %{blockchain}. Please check your workers.", blockchain=request.args.get('blockchain'))) elif config_type == "plotting": try: [replaced, config] = plotman.load_config(w, request.args.get('blockchain')) response = make_response(config, 200) response.headers.set('ConfigReplacementsOccurred', replaced) except requests.exceptions.ConnectionError as ex: - response = make_response("For Plotting config, found no responding fullnode found for {0}. Please check your workers.".format(request.args.get('blockchain'))) + response = make_response(_("For Plotting config, found no responding fullnode found for %{blockchain}. Please check your workers.", blockchain=request.args.get('blockchain'))) elif config_type == "tools": try: response = make_response(forktools.load_config(w, request.args.get('blockchain')), 200) except requests.exceptions.ConnectionError as ex: - response = make_response("No responding fullnode found for {0}. Please check your workers.".format(request.args.get('blockchain'))) + response = make_response(_("No responding fullnode found for %{blockchain}. Please check your workers.", blockchain=request.args.get('blockchain'))) else: abort("Unsupported config type: {0}".format(config_type), 400) response.mimetype = "application/x-yaml" @@ -397,7 +399,7 @@ def logfile(): blockchain = request.args.get("blockchain") return log_handler.get_log_lines(w, log_type, log_id, blockchain) else: - abort(500, "Unsupported log type: {0}".format(log_type)) + abort(500, _("Unsupported log type") + ": {0}".format(log_type)) @app.route('/worker_launch') def worker_launch(): diff --git a/web/templates/setup.html b/web/templates/setup.html index 0c8c6b7a..4c2b2a32 100644 --- a/web/templates/setup.html +++ b/web/templates/setup.html @@ -24,8 +24,8 @@
-
Welcome to Machinaris!
-
An easy-to-use WebUI for Chia™ plotting and farming.
+
{{_('Welcome to Machinaris!')}}
+
{{_('An easy-to-use WebUI for Chia%(trademark)s plotting and farming.', trademark='™')}}


@@ -58,13 +58,11 @@

-

On very first launch, the Chia blockchain database (~20 GB compressed) is being downloaded from - https://www.chia-database.com/. - At about 45 GB in uncompressed size (progress shown above), this will take a while.

- -

However minutes of download now, will save you multiple days of blockchain syncing later. - Please be patient!

- +

{{_( + 'On very first launch, the Chia compressed blockchain database %(compressed)s is being downloaded from %(dl_link)s. At about %(uncompressed)s in uncompressed size (progress shown above), this will take a while. However minutes of download now, will save you multiple days of blockchain syncing later. Please be patient!', + compressed="(~20 GB)", uncompressed="45 GB", + dl_link='https://www.chia-database.com/' + )}}




@@ -74,33 +72,28 @@

-

NOTE: If you would prefer to allow Chia to sync the blockchain over many days, - see the Wiki for details. Similarly, you may instead - import your own blockchain if you have one from a previous Chia install. -

+

{{_( + 'NOTE: If you would prefer to allow Chia to sync the blockchain over many days, see the %(init_link)s for details. Similarly, you may instead %(import_link_open)s import your own blockchain %(import_link_close)s if you have one from a previous Chia install.', + init_link='Wiki', + import_link_open='', import_link_close='' + )}}

{% else %} -

To get started with Machinaris as a Chia™ fullnode, either import your existing - 24-word - mnemonic seed phrase:

+

{{_('To get started with Machinaris as a Chia%(trademark)s fullnode, either import your existing 24-word mnemonic seed phrase', trademark='™')}}:


- -

OR

+ +

{{_('OR')}}

-

You can generate a brand-new mnemonic phrase that will be written to this in-container - path: {{ key_paths[0] }} +

{{_('You can generate a brand-new mnemonic phrase that will be written to this in-container path')}}: + {{ key_paths[0] }}

- +

@@ -112,10 +105,9 @@

OR



-

NOTE: If you would prefer to instead import your mnenmoic seed phrase yourself - at the command-line, - see the Wiki for details.

+

{{_('NOTE: If you would prefer to instead import your mnenmoic seed phrase yourself at the command-line, see the %(wiki_link)s for details.', + wiki_link='Wiki')}} +

{% endif %}
diff --git a/web/translations/de/LC_MESSAGES/messages.po b/web/translations/de/LC_MESSAGES/messages.po new file mode 100644 index 00000000..2e6b4d90 --- /dev/null +++ b/web/translations/de/LC_MESSAGES/messages.po @@ -0,0 +1,129 @@ +# German translations for PROJECT. +# Copyright (C) 2022 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2022. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2022-02-13 15:24-0700\n" +"PO-Revision-Date: 2022-02-13 13:45-0700\n" +"Last-Translator: FULL NAME \n" +"Language: de\n" +"Language-Team: de \n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: routes.py:68 +msgid "Blockchain download" +msgstr "" + +#: routes.py:100 +msgid "Unknown plotting form" +msgstr "" + +#: routes.py:149 +msgid "Error! Please see logs." +msgstr "" + +#: routes.py:175 +msgid "Unknown alerts form" +msgstr "" + +#: routes.py:244 +msgid "Unknown form action" +msgstr "" + +#: routes.py:360 +msgid "No worker at %{worker} for fork %{blockchain}. Please select another fork." +msgstr "" + +#: routes.py:366 +msgid "" +"For Alerts config, found no responding fullnode found for %{blockchain}. " +"Please check your workers." +msgstr "" + +#: routes.py:371 +msgid "" +"For Farming config, found no responding fullnode found for %{blockchain}." +" Please check your workers." +msgstr "" + +#: routes.py:378 +msgid "" +"For Plotting config, found no responding fullnode found for " +"%{blockchain}. Please check your workers." +msgstr "" + +#: routes.py:383 +msgid "No responding fullnode found for %{blockchain}. Please check your workers." +msgstr "" + +#: routes.py:402 +msgid "Unsupported log type" +msgstr "" + +#: templates/setup.html:27 +msgid "Welcome to Machinaris!" +msgstr "Willkommen zu" + +#: templates/setup.html:28 +#, python-format +msgid "An easy-to-use WebUI for Chia%(trademark)s plotting and farming." +msgstr "" + +#: templates/setup.html:61 +#, python-format +msgid "" +"On very first launch, the Chia compressed blockchain database " +"%(compressed)s is being downloaded from %(dl_link)s. At about " +"%(uncompressed)s in uncompressed size (progress shown above), this will " +"take a while. However minutes of download now, will save you multiple " +"days of blockchain syncing later. Please be patient!" +msgstr "" + +#: templates/setup.html:75 +#, python-format +msgid "" +"NOTE: If you would prefer to allow Chia to sync the blockchain over many " +"days, see the %(init_link)s for details. Similarly, you may instead " +"%(import_link_open)s import your own blockchain %(import_link_close)s if " +"you have one from a previous Chia install." +msgstr "" + +#: templates/setup.html:83 +#, python-format +msgid "" +"To get started with Machinaris as a Chia%(trademark)s fullnode, either " +"import your existing 24-word mnemonic seed phrase" +msgstr "" + +#: templates/setup.html:90 +msgid "Import Existing Key" +msgstr "" + +#: templates/setup.html:91 +msgid "OR" +msgstr "" + +#: templates/setup.html:93 +msgid "" +"You can generate a brand-new mnemonic phrase that will be written to this" +" in-container path" +msgstr "" + +#: templates/setup.html:96 +msgid "Generate New Key" +msgstr "" + +#: templates/setup.html:108 +#, python-format +msgid "" +"NOTE: If you would prefer to instead import your mnenmoic seed phrase " +"yourself at the command-line, see the %(wiki_link)s for details." +msgstr "" diff --git a/web/translations/fr/LC_MESSAGES/messages.po b/web/translations/fr/LC_MESSAGES/messages.po new file mode 100644 index 00000000..c19803dd --- /dev/null +++ b/web/translations/fr/LC_MESSAGES/messages.po @@ -0,0 +1,130 @@ +# French translations for PROJECT. +# Copyright (C) 2022 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2022. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2022-02-13 15:24-0700\n" +"PO-Revision-Date: 2022-02-13 13:45-0700\n" +"Last-Translator: FULL NAME \n" +"Language: fr\n" +"Language-Team: fr \n" +"Plural-Forms: nplurals=2; plural=(n > 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: routes.py:68 +msgid "Blockchain download" +msgstr "" + +#: routes.py:100 +msgid "Unknown plotting form" +msgstr "" + +#: routes.py:149 +msgid "Error! Please see logs." +msgstr "" + +#: routes.py:175 +msgid "Unknown alerts form" +msgstr "" + +#: routes.py:244 +msgid "Unknown form action" +msgstr "" + +#: routes.py:360 +msgid "No worker at %{worker} for fork %{blockchain}. Please select another fork." +msgstr "" + +#: routes.py:366 +msgid "" +"For Alerts config, found no responding fullnode found for %{blockchain}. " +"Please check your workers." +msgstr "" + +#: routes.py:371 +msgid "" +"For Farming config, found no responding fullnode found for %{blockchain}." +" Please check your workers." +msgstr "" + +#: routes.py:378 +msgid "" +"For Plotting config, found no responding fullnode found for " +"%{blockchain}. Please check your workers." +msgstr "" + +#: routes.py:383 +msgid "No responding fullnode found for %{blockchain}. Please check your workers." +msgstr "" + +#: routes.py:402 +msgid "Unsupported log type" +msgstr "" + +#: templates/setup.html:27 +msgid "Welcome to Machinaris!" +msgstr "Bienvenue à Machinaris!" + +#: templates/setup.html:28 +#, python-format +msgid "An easy-to-use WebUI for Chia%(trademark)s plotting and farming." +msgstr "" + +#: templates/setup.html:61 +#, python-format +msgid "" +"On very first launch, the Chia compressed blockchain database " +"%(compressed)s is being downloaded from %(dl_link)s. At about " +"%(uncompressed)s in uncompressed size (progress shown above), this will " +"take a while. However minutes of download now, will save you multiple " +"days of blockchain syncing later. Please be patient!" +msgstr "" + +#: templates/setup.html:75 +#, python-format +msgid "" +"NOTE: If you would prefer to allow Chia to sync the blockchain over many " +"days, see the %(init_link)s for details. Similarly, you may instead " +"%(import_link_open)s import your own blockchain %(import_link_close)s if " +"you have one from a previous Chia install." +msgstr "" + +#: templates/setup.html:83 +#, python-format +msgid "" +"To get started with Machinaris as a Chia%(trademark)s fullnode, either " +"import your existing 24-word mnemonic seed phrase" +msgstr "" + +#: templates/setup.html:90 +msgid "Import Existing Key" +msgstr "" + +#: templates/setup.html:91 +msgid "OR" +msgstr "" + +#: templates/setup.html:93 +msgid "" +"You can generate a brand-new mnemonic phrase that will be written to this" +" in-container path" +msgstr "" + +#: templates/setup.html:96 +msgid "Generate New Key" +msgstr "" + +#: templates/setup.html:108 +#, python-format +msgid "" +"NOTE: If you would prefer to instead import your mnenmoic seed phrase " +"yourself at the command-line, see the %(wiki_link)s for details." +msgstr "" + From a3c0d16512dc856e30d64a71b471ee69c359dcaf Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Sun, 13 Feb 2022 20:54:31 -0700 Subject: [PATCH 20/85] Build fix. --- scripts/i18n/compile.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/i18n/compile.sh b/scripts/i18n/compile.sh index bcd0263a..499b9cda 100644 --- a/scripts/i18n/compile.sh +++ b/scripts/i18n/compile.sh @@ -3,7 +3,7 @@ # # If building on Github servers, change to deployment root -if [ `pwd` != '/code/machinaris' ]; then # else stay in code root +if [ "$PWD" != '/code/machinaris' ]; then # else stay in code root cd /machinaris fi From fe08a6f0f1baf940d5b5ad8ba3ae7e46ebe7a56d Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Sun, 13 Feb 2022 21:04:41 -0700 Subject: [PATCH 21/85] Full path to pybabel. --- scripts/i18n/compile.sh | 2 +- scripts/i18n/extract.sh | 4 ++-- scripts/i18n/init.sh | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/i18n/compile.sh b/scripts/i18n/compile.sh index 499b9cda..e4fc2349 100644 --- a/scripts/i18n/compile.sh +++ b/scripts/i18n/compile.sh @@ -14,7 +14,7 @@ do IFS=','; for lang in $LANGS; do - pybabel compile -d ./translations + /chia-blockchain/venv/bin/pybabel compile -d ./translations chmod 777 ./translations/$lang/LC_MESSAGES/* done popd >/dev/null diff --git a/scripts/i18n/extract.sh b/scripts/i18n/extract.sh index a80e3c65..25e3544a 100644 --- a/scripts/i18n/extract.sh +++ b/scripts/i18n/extract.sh @@ -9,8 +9,8 @@ do IFS=','; for lang in $LANGS; do - pybabel extract -F babel.cfg -k _l -o messages.pot . - pybabel update -i messages.pot -d ./translations + /chia-blockchain/venv/bin/pybabel extract -F babel.cfg -k _l -o messages.pot . + /chia-blockchain/venv/bin/pybabel update -i messages.pot -d ./translations chmod 777 ./translations/$lang/LC_MESSAGES/* done popd >/dev/null diff --git a/scripts/i18n/init.sh b/scripts/i18n/init.sh index 8565b0ee..e7ff0dff 100644 --- a/scripts/i18n/init.sh +++ b/scripts/i18n/init.sh @@ -9,10 +9,10 @@ do IFS=','; for lang in $LANGS; do - #if [ -d ./translations/$lang ]; then - # echo "Skipping initialization of $d/$lang as translations folder already exists." - #else - pybabel init -i messages.pot -d ./translations -l $lang + if [ -d ./translations/$lang ]; then + echo "Skipping initialization of $d/$lang as translations folder already exists." + else + /chia-blockchain/venv/bin/pybabel init -i messages.pot -d ./translations -l $lang chmod 777 ./translations/$lang/LC_MESSAGES/* #fi done From 92716fad81d97c4ef101a814c19039ec53bebb03 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Tue, 15 Feb 2022 16:08:55 -0700 Subject: [PATCH 22/85] More translation support. --- CREDITS.md | 2 + api/__init__.py | 2 +- api/default_settings.py | 3 +- api/translations/de/LC_MESSAGES/messages.po | 8 +- api/translations/fr/LC_MESSAGES/messages.po | 8 +- api/translations/it/LC_MESSAGES/messages.po | 24 +++ api/translations/zh/LC_MESSAGES/messages.po | 24 +++ api/views/logs/resources.py | 1 + api/views/ping/resources.py | 9 +- scripts/i18n/compile.sh | 9 +- scripts/i18n/extract.sh | 11 +- scripts/i18n/init.sh | 2 +- web/__init__.py | 2 +- web/actions/log_handler.py | 4 +- web/default_settings.py | 4 +- web/routes.py | 37 ++-- web/templates/index.html | 24 +-- web/templates/setup.html | 7 +- web/translations/de/LC_MESSAGES/messages.po | 84 +++++++-- web/translations/fr/LC_MESSAGES/messages.po | 126 ++++++++++--- web/translations/it/LC_MESSAGES/messages.po | 185 ++++++++++++++++++++ web/translations/zh/LC_MESSAGES/messages.po | 185 ++++++++++++++++++++ web/utils.py | 19 +- 23 files changed, 679 insertions(+), 101 deletions(-) create mode 100644 api/translations/it/LC_MESSAGES/messages.po create mode 100644 api/translations/zh/LC_MESSAGES/messages.po create mode 100644 web/translations/it/LC_MESSAGES/messages.po create mode 100644 web/translations/zh/LC_MESSAGES/messages.po diff --git a/CREDITS.md b/CREDITS.md index 3d818092..45721767 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -23,6 +23,7 @@ A huge thank-you to the great teams/devs behind these projects, being used by Ma * [Toplevel](https://github.com/and-semakin/marshmallow-toplevel): Used for list of objects sent to REST API. * [DataTables.js](https://datatables.net/): Filter/search/pagination of dynamic tables, as per [this tutorial](https://blog.miguelgrinberg.com/post/beautiful-interactive-tables-for-your-flask-templates). * [Charts.js](https://www.chartjs.org/): dynamic charting library. +* [Flask-Babel](https://pythonhosted.org/Flask-BabelEx/): internationaliztion and localization, as per [this tutorial](https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xiii-i18n-and-l10n). ## Blockchains * [BTCgreen](https://github.com/BTCgreen-Network/btcgreen-blockchain) @@ -90,6 +91,7 @@ A big thanks to all that contributed with dev and test including: * bafff * tjb_altf4 * halfroom (aka Sagittarius) +* vfarmer.antcasq ## Trademark Notice CHIA NETWORK INC, CHIA™, the CHIA BLOCKCHAIN™, the CHIA PROTOCOL™, CHIALISP™ and the “leaf Logo” (including the leaf logo alone when it refers to or indicates Chia), are trademarks or registered trademarks of Chia Network, Inc., a Delaware corporation. *There is no affliation between this Machinaris project and the main Chia Network project.* \ No newline at end of file diff --git a/api/__init__.py b/api/__init__.py index 70c3b9e7..7e0e977f 100644 --- a/api/__init__.py +++ b/api/__init__.py @@ -36,7 +36,7 @@ def set_sqlite_pragma(dbapi_connection, connection_record): def get_locale(): for d in babel.translation_directories: app.logger.debug(d) - app.logger.debug("Returning locale: {0}".format(request.accept_languages.best_match(app.config['LANGUAGES']))) + app.logger.debug("API=> Returning locale: {0}".format(request.accept_languages.best_match(app.config['LANGUAGES']))) return request.accept_languages.best_match(app.config['LANGUAGES']) from common.extensions.database import db diff --git a/api/default_settings.py b/api/default_settings.py index a275a31c..a30da8f4 100644 --- a/api/default_settings.py +++ b/api/default_settings.py @@ -50,4 +50,5 @@ class DefaultConfig: STATUS_EVERY_X_MINUTES = 2 # Run status collection once every two minutes by default ALLOW_HARVESTER_CERT_LAN_DOWNLOAD = True - LANGUAGES = ['de', 'fr'] + BABEL_TRANSLATION_DIRECTORIES = "api/translations" + LANGUAGES = ['de', 'fr', 'it', 'zh'] diff --git a/api/translations/de/LC_MESSAGES/messages.po b/api/translations/de/LC_MESSAGES/messages.po index c327094c..c5230150 100644 --- a/api/translations/de/LC_MESSAGES/messages.po +++ b/api/translations/de/LC_MESSAGES/messages.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-13 15:24-0700\n" -"PO-Revision-Date: 2022-02-13 13:45-0700\n" +"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"PO-Revision-Date: 2022-02-15 14:29-0700\n" "Last-Translator: FULL NAME \n" "Language: de\n" "Language-Team: de \n" @@ -18,3 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" +#: views/ping/resources.py:26 +msgid "Pong!" +msgstr "" + diff --git a/api/translations/fr/LC_MESSAGES/messages.po b/api/translations/fr/LC_MESSAGES/messages.po index 157c0932..7fe5d6e2 100644 --- a/api/translations/fr/LC_MESSAGES/messages.po +++ b/api/translations/fr/LC_MESSAGES/messages.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-13 15:24-0700\n" -"PO-Revision-Date: 2022-02-13 13:45-0700\n" +"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"PO-Revision-Date: 2022-02-15 14:29-0700\n" "Last-Translator: FULL NAME \n" "Language: fr\n" "Language-Team: fr \n" @@ -18,3 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" +#: views/ping/resources.py:26 +msgid "Pong!" +msgstr "Le pong!" + diff --git a/api/translations/it/LC_MESSAGES/messages.po b/api/translations/it/LC_MESSAGES/messages.po new file mode 100644 index 00000000..df856d22 --- /dev/null +++ b/api/translations/it/LC_MESSAGES/messages.po @@ -0,0 +1,24 @@ +# Italian translations for PROJECT. +# Copyright (C) 2022 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2022. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"PO-Revision-Date: 2022-02-15 14:29-0700\n" +"Last-Translator: FULL NAME \n" +"Language: it\n" +"Language-Team: it \n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: views/ping/resources.py:26 +msgid "Pong!" +msgstr "" + diff --git a/api/translations/zh/LC_MESSAGES/messages.po b/api/translations/zh/LC_MESSAGES/messages.po new file mode 100644 index 00000000..5719670a --- /dev/null +++ b/api/translations/zh/LC_MESSAGES/messages.po @@ -0,0 +1,24 @@ +# Chinese translations for PROJECT. +# Copyright (C) 2022 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2022. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"PO-Revision-Date: 2022-02-15 14:29-0700\n" +"Last-Translator: FULL NAME \n" +"Language: zh\n" +"Language-Team: zh \n" +"Plural-Forms: nplurals=1; plural=0\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: views/ping/resources.py:26 +msgid "Pong!" +msgstr "" + diff --git a/api/views/logs/resources.py b/api/views/logs/resources.py index f6fee774..fc276562 100644 --- a/api/views/logs/resources.py +++ b/api/views/logs/resources.py @@ -31,6 +31,7 @@ def get(self): class LogByType(MethodView): def get(self, type): + app.logger.info(request.headers) log = log_parser.get_log_lines(type, log_id=request.args.get('log_id'), blockchain=request.args.get('blockchain')) response = make_response(log, 200) response.mimetype = "plain/text" diff --git a/api/views/ping/resources.py b/api/views/ping/resources.py index b90b7d12..ef74ae28 100644 --- a/api/views/ping/resources.py +++ b/api/views/ping/resources.py @@ -4,6 +4,7 @@ from flask import request, make_response, abort from flask.views import MethodView +from flask_babel import _, lazy_gettext as _l from api import app from api.extensions.api import Blueprint @@ -20,9 +21,13 @@ class Logs(MethodView): def get(self): + app.logger.info("IN PING, LANGUAGES ARE {0}".format(app.config['LANGUAGES'])) + app.logger.info("IN PING, LANG={0}".format(request.headers['Accept-Language'])) + app.logger.info("IN PING, MATCH IS {0}".format(request.accept_languages.best_match(app.config['LANGUAGES']))) + app.logger.info("IN PING, PONG IS {0}".format(_('Pong!'))) response = make_response( - """Pong! -""", 200) + """{0} +""".format(_('Pong!')), 200) response.mimetype = "plain/text" return response diff --git a/scripts/i18n/compile.sh b/scripts/i18n/compile.sh index e4fc2349..c6c65e0b 100644 --- a/scripts/i18n/compile.sh +++ b/scripts/i18n/compile.sh @@ -10,12 +10,7 @@ fi for d in 'web' 'api'; do pushd $d >/dev/null - LANGS=$(grep -oP "LANGUAGES = \[\K(.*)\]" ./default_settings.py | cut -d ']' -f 1 | tr -d \'\" | tr -d ' ') - IFS=','; - for lang in $LANGS; - do - /chia-blockchain/venv/bin/pybabel compile -d ./translations - chmod 777 ./translations/$lang/LC_MESSAGES/* - done + /chia-blockchain/venv/bin/pybabel compile -d ./translations + chmod -R 777 $PWD/translations popd >/dev/null done diff --git a/scripts/i18n/extract.sh b/scripts/i18n/extract.sh index 25e3544a..1af7eb4f 100644 --- a/scripts/i18n/extract.sh +++ b/scripts/i18n/extract.sh @@ -5,13 +5,8 @@ for d in 'web' 'api'; do pushd $d >/dev/null - LANGS=$(grep -oP "LANGUAGES = \[\K(.*)\]" ./default_settings.py | cut -d ']' -f 1 | tr -d \'\" | tr -d ' ') - IFS=','; - for lang in $LANGS; - do - /chia-blockchain/venv/bin/pybabel extract -F babel.cfg -k _l -o messages.pot . - /chia-blockchain/venv/bin/pybabel update -i messages.pot -d ./translations - chmod 777 ./translations/$lang/LC_MESSAGES/* - done + /chia-blockchain/venv/bin/pybabel extract -F babel.cfg -k _l -o messages.pot . + /chia-blockchain/venv/bin/pybabel update -i messages.pot -d ./translations + chmod -R 777 $PWD/translations popd >/dev/null done diff --git a/scripts/i18n/init.sh b/scripts/i18n/init.sh index e7ff0dff..db350c68 100644 --- a/scripts/i18n/init.sh +++ b/scripts/i18n/init.sh @@ -14,7 +14,7 @@ do else /chia-blockchain/venv/bin/pybabel init -i messages.pot -d ./translations -l $lang chmod 777 ./translations/$lang/LC_MESSAGES/* - #fi + fi done popd >/dev/null done diff --git a/web/__init__.py b/web/__init__.py index ff95f360..a1f590b4 100644 --- a/web/__init__.py +++ b/web/__init__.py @@ -22,7 +22,7 @@ def get_locale(): for d in babel.translation_directories: app.logger.debug(d) - app.logger.debug("Returning locale: {0}".format(request.accept_languages.best_match(app.config['LANGUAGES']))) + app.logger.debug("WEB=> Returning locale: {0}".format(request.accept_languages.best_match(app.config['LANGUAGES']))) return request.accept_languages.best_match(app.config['LANGUAGES']) @event.listens_for(Engine, "connect") diff --git a/web/actions/log_handler.py b/web/actions/log_handler.py index a5f1785d..252bc2b7 100644 --- a/web/actions/log_handler.py +++ b/web/actions/log_handler.py @@ -17,14 +17,14 @@ from web import app, db, utils -def get_log_lines(worker, log_type, log_id, blockchain): +def get_log_lines(lang, worker, log_type, log_id, blockchain): try: payload = {"type": log_type } if log_id != 'undefined': payload['log_id'] = log_id if blockchain != 'undefined': payload['blockchain'] = blockchain - response = utils.send_get(worker, "/logs/{0}".format(log_type), payload, debug=False) + response = utils.send_get(lang, worker, "/logs/{0}".format(log_type), payload, debug=True) return response.content.decode('utf-8') except: app.logger.info(traceback.format_exc()) diff --git a/web/default_settings.py b/web/default_settings.py index e6483446..70616e97 100644 --- a/web/default_settings.py +++ b/web/default_settings.py @@ -38,4 +38,6 @@ class DefaultConfig: MAX_CHART_CHALLENGES_MINS = 15 - LANGUAGES = ['de', 'fr'] + # Note, babel looks in /machinaris/web/translations with this path. + BABEL_TRANSLATION_DIRECTORIES = "translations" + LANGUAGES = ['de', 'fr', 'it', 'zh'] diff --git a/web/routes.py b/web/routes.py index b5754f9a..a4ef4ee2 100644 --- a/web/routes.py +++ b/web/routes.py @@ -10,14 +10,30 @@ from datetime import datetime from flask import Flask, flash, redirect, render_template, abort, \ request, session, url_for, send_from_directory, make_response -from flask_babel import _ -from flask_babel import lazy_gettext as _l +from flask_babel import _, lazy_gettext as _l from common.config import globals from common.models import pools as po from web import app, utils from web.actions import chia, pools as p, plotman, chiadog, worker, log_handler, stats, warnings, forktools +def get_lang(request): + lang = None + if "Accept-Language" in request.headers: + lang = request.headers["Accept-Language"] + return lang + +def find_selected_worker(hosts, hostname, blockchain= None): + if len(hosts) == 0: + return None + if not blockchain: + hosts[0].workers[0] + for host in hosts: + for worker in host.workers: + if worker['hostname'] == hostname and worker['blockchain'] == blockchain: + return worker + return hosts[0].workers[0] + @app.route('/') def landing(): gc = globals.load() @@ -246,17 +262,6 @@ def connections(): return render_template('connections.html', reload_seconds=120, selected_blockchain = selected_blockchain, connections=connections, global_config=gc) -def find_selected_worker(hosts, hostname, blockchain= None): - if len(hosts) == 0: - return None - if not blockchain: - hosts[0].workers[0] - for host in hosts: - for worker in host.workers: - if worker['hostname'] == hostname and worker['blockchain'] == blockchain: - return worker - return hosts[0].workers[0] - @app.route('/settings/plotting', methods=['GET', 'POST']) def settings_plotting(): selected_worker_hostname = None @@ -356,7 +361,7 @@ def views_settings_config(path): config_type = request.args.get('type') w = worker.get_worker(request.args.get('worker'), request.args.get('blockchain')) if not w: - app.logger.info(_l("No worker at %{worker} for fork %{blockchain}. Please select another fork.", + app.logger.info(_l("No worker at %{worker} for blockchain %{blockchain}. Please select another blockchain.", worker=request.args.get('worker'), blockchain=request.args.get('blockchain'))) abort(404) if config_type == "alerts": @@ -388,7 +393,7 @@ def views_settings_config(path): @app.route('/logs') def logs(): - return render_template('logs.html') + return render_template('logs.html') @app.route('/logfile') def logfile(): @@ -397,7 +402,7 @@ def logfile(): if log_type in [ 'alerts', 'farming', 'plotting', 'archiving', 'apisrv', 'webui', 'pooling']: log_id = request.args.get("log_id") blockchain = request.args.get("blockchain") - return log_handler.get_log_lines(w, log_type, log_id, blockchain) + return log_handler.get_log_lines(get_lang(request), w, log_type, log_id, blockchain) else: abort(500, _("Unsupported log type") + ": {0}".format(log_type)) diff --git a/web/templates/index.html b/web/templates/index.html index bc008390..77e967c2 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -27,7 +27,7 @@
-

{{ blockchain|capitalize }} - Expected Time to Win: +

{{ blockchain|capitalize }} - {{_('Expected Time to Win')}}: {{ farms[blockchain].expected_time_to_win }}

@@ -38,7 +38,7 @@

{{ blockchain|capitalize }} - Expected Time to Win:
-
Plotting: +
{{_('Plotting')}}: {{ plotting[blockchain] }} @@ -47,7 +47,7 @@
Plotting:
-
Farming: +
{{_('Farming')}}: Farming:

{{farms[blockchain].plot_count }}

-
Total Plots
+
{{_('Total Plots')}}

{{farms[blockchain].plots_display_size }}

-
Total Plots Size
+
{{_('Total Plots Size')}}
@@ -86,14 +86,14 @@
Total Plots Size

{{farms[blockchain].wallet_balance }}

-
{{ farms[blockchain].currency_symbol }} Balance
+
{{ farms[blockchain].currency_symbol }} {{_('Balance')}}

{{farms[blockchain].total_coins }}

-
{{ farms[blockchain].currency_symbol }} Farmed
+
{{ farms[blockchain].currency_symbol }} {{_('Farmed')}}
@@ -102,7 +102,7 @@
{{ farms[blockchain].currency_symbol }} Farmed

{{farms[blockchain].netspace_display_size }}

-
{{ blockchain|capitalize }} Netspace
+
{{ blockchain|capitalize }} {{_('Netspace')}}

@@ -117,7 +117,7 @@
{{ blockchain|capitalize }} Netspace
-
{{blockchain|capitalize}} - Challenges from Harvesters
+
{{blockchain|capitalize}} - {{_('Challenges from Harvesters')}}
@@ -133,7 +133,7 @@
{{blockchain|capitalize}} - Challenges from Ha -
{{blockchain|capitalize}} - Partial Proofs for Pools
+
{{blockchain|capitalize}} - {{_('Partial Proofs for Pools')}}
@@ -144,11 +144,11 @@
{{blockchain|capitalize}} - Partial Proofs for diff --git a/web/templates/setup.html b/web/templates/setup.html index 4c2b2a32..515142c0 100644 --- a/web/templates/setup.html +++ b/web/templates/setup.html @@ -105,10 +105,13 @@

{{_('OR')}}



-

{{_('NOTE: If you would prefer to instead import your mnenmoic seed phrase yourself at the command-line, see the %(wiki_link)s for details.', + {% autoescape false %} +

+ {{_('NOTE: If you would prefer to instead import your mnenmoic seed phrase yourself at the command-line, see the %(wiki_link)s for details.', wiki_link='Wiki')}}

- + {% endautoescape %} + {% endif %} diff --git a/web/translations/de/LC_MESSAGES/messages.po b/web/translations/de/LC_MESSAGES/messages.po index 2e6b4d90..cd64856c 100644 --- a/web/translations/de/LC_MESSAGES/messages.po +++ b/web/translations/de/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-13 15:24-0700\n" +"POT-Creation-Date: 2022-02-15 14:38-0700\n" "PO-Revision-Date: 2022-02-13 13:45-0700\n" "Last-Translator: FULL NAME \n" "Language: de\n" @@ -18,56 +18,106 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -#: routes.py:68 +#: routes.py:84 msgid "Blockchain download" msgstr "" -#: routes.py:100 +#: routes.py:116 msgid "Unknown plotting form" msgstr "" -#: routes.py:149 +#: routes.py:165 msgid "Error! Please see logs." msgstr "" -#: routes.py:175 +#: routes.py:191 msgid "Unknown alerts form" msgstr "" -#: routes.py:244 +#: routes.py:260 msgid "Unknown form action" msgstr "" -#: routes.py:360 -msgid "No worker at %{worker} for fork %{blockchain}. Please select another fork." +#: routes.py:365 +msgid "" +"No worker at %{worker} for blockchain %{blockchain}. Please select " +"another blockchain." msgstr "" -#: routes.py:366 +#: routes.py:371 msgid "" "For Alerts config, found no responding fullnode found for %{blockchain}. " "Please check your workers." msgstr "" -#: routes.py:371 +#: routes.py:376 msgid "" "For Farming config, found no responding fullnode found for %{blockchain}." " Please check your workers." msgstr "" -#: routes.py:378 +#: routes.py:383 msgid "" "For Plotting config, found no responding fullnode found for " "%{blockchain}. Please check your workers." msgstr "" -#: routes.py:383 +#: routes.py:388 msgid "No responding fullnode found for %{blockchain}. Please check your workers." msgstr "" -#: routes.py:402 +#: routes.py:407 msgid "Unsupported log type" msgstr "" +#: templates/index.html:30 +msgid "Expected Time to Win" +msgstr "" + +#: templates/index.html:41 +msgid "Plotting" +msgstr "" + +#: templates/index.html:50 +msgid "Farming" +msgstr "" + +#: templates/index.html:72 +msgid "Total Plots" +msgstr "" + +#: templates/index.html:79 +msgid "Total Plots Size" +msgstr "" + +#: templates/index.html:89 +msgid "Balance" +msgstr "" + +#: templates/index.html:96 +msgid "Farmed" +msgstr "" + +#: templates/index.html:105 +msgid "Netspace" +msgstr "" + +#: templates/index.html:120 +msgid "Challenges from Harvesters" +msgstr "" + +#: templates/index.html:136 +msgid "Partial Proofs for Pools" +msgstr "" + +#: templates/index.html:147 +msgid "Previous" +msgstr "" + +#: templates/index.html:151 +msgid "Next" +msgstr "" + #: templates/setup.html:27 msgid "Welcome to Machinaris!" msgstr "Willkommen zu" @@ -121,9 +171,15 @@ msgstr "" msgid "Generate New Key" msgstr "" -#: templates/setup.html:108 +#: templates/setup.html:110 #, python-format msgid "" "NOTE: If you would prefer to instead import your mnenmoic seed phrase " "yourself at the command-line, see the %(wiki_link)s for details." msgstr "" + +#~ msgid "" +#~ "No worker at %{worker} for fork " +#~ "%{blockchain}. Please select another fork." +#~ msgstr "" + diff --git a/web/translations/fr/LC_MESSAGES/messages.po b/web/translations/fr/LC_MESSAGES/messages.po index c19803dd..b2bfe226 100644 --- a/web/translations/fr/LC_MESSAGES/messages.po +++ b/web/translations/fr/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-13 15:24-0700\n" +"POT-Creation-Date: 2022-02-15 14:38-0700\n" "PO-Revision-Date: 2022-02-13 13:45-0700\n" "Last-Translator: FULL NAME \n" "Language: fr\n" @@ -18,55 +18,115 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -#: routes.py:68 +#: routes.py:84 msgid "Blockchain download" -msgstr "" +msgstr "Télécharger le blockchain" -#: routes.py:100 +#: routes.py:116 msgid "Unknown plotting form" -msgstr "" +msgstr "Forme inconnue" -#: routes.py:149 +#: routes.py:165 msgid "Error! Please see logs." -msgstr "" +msgstr "Erreur! Veuillez consulter les journaux." -#: routes.py:175 +#: routes.py:191 msgid "Unknown alerts form" -msgstr "" +msgstr "Forme inconnue" -#: routes.py:244 +#: routes.py:260 msgid "Unknown form action" -msgstr "" +msgstr "Action inconnue" -#: routes.py:360 -msgid "No worker at %{worker} for fork %{blockchain}. Please select another fork." +#: routes.py:365 +msgid "" +"No worker at %{worker} for blockchain %{blockchain}. Please select " +"another blockchain." msgstr "" +"Aucun travailleur %{worker} pour la blockchain %{blockchain}. Veuillez " +"sélectionner une autre blockchain." -#: routes.py:366 +#: routes.py:371 msgid "" "For Alerts config, found no responding fullnode found for %{blockchain}. " "Please check your workers." msgstr "" +"Aucun fullnode répondant n'a été trouvé pour notifier%{blockchain}. " +"Veuillez vérifier vos travailleurs." -#: routes.py:371 +#: routes.py:376 msgid "" "For Farming config, found no responding fullnode found for %{blockchain}." " Please check your workers." msgstr "" +"Aucun fullnode répondant n'a été trouvé pour cultiver%{blockchain}. " +"Veuillez vérifier vos travailleurs." -#: routes.py:378 +#: routes.py:383 msgid "" "For Plotting config, found no responding fullnode found for " "%{blockchain}. Please check your workers." msgstr "" +"Aucun fullnode répondant n'a été trouvé pour parceller%{blockchain}. " +"Veuillez vérifier vos travailleurs." -#: routes.py:383 +#: routes.py:388 msgid "No responding fullnode found for %{blockchain}. Please check your workers." msgstr "" +"Aucun fullnode répondant n'a été trouvé pour %{blockchain}. Veuillez " +"vérifier vos travailleurs." -#: routes.py:402 +#: routes.py:407 msgid "Unsupported log type" -msgstr "" +msgstr "Type de journal non pris en charge" + +#: templates/index.html:30 +msgid "Expected Time to Win" +msgstr "Temps prévu pour gagner" + +#: templates/index.html:41 +msgid "Plotting" +msgstr "Parcelle" + +#: templates/index.html:50 +msgid "Farming" +msgstr "Cultiver" + +#: templates/index.html:72 +msgid "Total Plots" +msgstr "Parcelles totales" + +#: templates/index.html:79 +msgid "Total Plots Size" +msgstr "Taille totale des parcelles" + +#: templates/index.html:89 +msgid "Balance" +msgstr "Total" + +#: templates/index.html:96 +msgid "Farmed" +msgstr "A gagné" + +#: templates/index.html:105 +msgid "Netspace" +msgstr "Netspace" + +#: templates/index.html:120 +msgid "Challenges from Harvesters" +msgstr "Défis des moissonneurs" + +#: templates/index.html:136 +msgid "Partial Proofs for Pools" +msgstr "Preuves partielles pour les pools" + +#: templates/index.html:147 +msgid "Previous" +msgstr "Précédent" + +#: templates/index.html:151 +msgid "Next" +msgstr "Suivant" #: templates/setup.html:27 msgid "Welcome to Machinaris!" @@ -75,7 +135,7 @@ msgstr "Bienvenue à Machinaris!" #: templates/setup.html:28 #, python-format msgid "An easy-to-use WebUI for Chia%(trademark)s plotting and farming." -msgstr "" +msgstr "Une WebUI facile pour cultiver Chia%(trademark)s." #: templates/setup.html:61 #, python-format @@ -86,6 +146,12 @@ msgid "" "take a while. However minutes of download now, will save you multiple " "days of blockchain syncing later. Please be patient!" msgstr "" +"Lors du tout premier lancement, la base de données blockchain compressée " +"de Chia %(compressed)s est en cours de téléchargement depuis %(dl_link)s." +" À environ %(uncompressed)s en taille non compressée (progression " +"indiquée ci-dessus), cela prendre un certain temps. Cependant, quelques " +"minutes de téléchargement maintenant vous feront économiser plusieurs " +"jours de synchronisation blockchain plus tard. Soyez patient!" #: templates/setup.html:75 #, python-format @@ -95,6 +161,11 @@ msgid "" "%(import_link_open)s import your own blockchain %(import_link_close)s if " "you have one from a previous Chia install." msgstr "" +"REMARQUE: si vous préférez autoriser Chia à synchroniser la blockchain " +"sur plusieurs jours, consultez les %(init_link)s pour plus de détails. De" +" même, vous pouvez %(import_link_open)s importe votre propre blockchain " +"%(import_link_close)s si vous en avez un d'une installation précédente de" +" Chia." #: templates/setup.html:83 #, python-format @@ -102,29 +173,36 @@ msgid "" "To get started with Machinaris as a Chia%(trademark)s fullnode, either " "import your existing 24-word mnemonic seed phrase" msgstr "" +"Pour démarrer avec Machinaris en tant que fullnode Chia%(trademark)s, " +"soit importez votre phrase de départ mnémonique existante de 24 mots" #: templates/setup.html:90 msgid "Import Existing Key" -msgstr "" +msgstr "Importez votre clé" #: templates/setup.html:91 msgid "OR" -msgstr "" +msgstr "OU" #: templates/setup.html:93 msgid "" "You can generate a brand-new mnemonic phrase that will be written to this" " in-container path" msgstr "" +"Vous pouvez générer une toute nouvelle phrase mnémonique qui sera écrite " +"icichemin dans le conteneur" #: templates/setup.html:96 msgid "Generate New Key" -msgstr "" +msgstr "Créer une nouvelle clé" -#: templates/setup.html:108 +#: templates/setup.html:110 #, python-format msgid "" "NOTE: If you would prefer to instead import your mnenmoic seed phrase " "yourself at the command-line, see the %(wiki_link)s for details." msgstr "" +"REMARQUE: Si vous préférez plutôt importer votre phrase de départ " +"mnenmoic vous-même sur la ligne de commande, consultez les %(wiki_link)s " +"pour plus de détails." diff --git a/web/translations/it/LC_MESSAGES/messages.po b/web/translations/it/LC_MESSAGES/messages.po new file mode 100644 index 00000000..fa816b7d --- /dev/null +++ b/web/translations/it/LC_MESSAGES/messages.po @@ -0,0 +1,185 @@ +# Italian translations for PROJECT. +# Copyright (C) 2022 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2022. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"PO-Revision-Date: 2022-02-15 10:14-0700\n" +"Last-Translator: FULL NAME \n" +"Language: it\n" +"Language-Team: it \n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: routes.py:84 +msgid "Blockchain download" +msgstr "" + +#: routes.py:116 +msgid "Unknown plotting form" +msgstr "" + +#: routes.py:165 +msgid "Error! Please see logs." +msgstr "" + +#: routes.py:191 +msgid "Unknown alerts form" +msgstr "" + +#: routes.py:260 +msgid "Unknown form action" +msgstr "" + +#: routes.py:365 +msgid "" +"No worker at %{worker} for blockchain %{blockchain}. Please select " +"another blockchain." +msgstr "" + +#: routes.py:371 +msgid "" +"For Alerts config, found no responding fullnode found for %{blockchain}. " +"Please check your workers." +msgstr "" + +#: routes.py:376 +msgid "" +"For Farming config, found no responding fullnode found for %{blockchain}." +" Please check your workers." +msgstr "" + +#: routes.py:383 +msgid "" +"For Plotting config, found no responding fullnode found for " +"%{blockchain}. Please check your workers." +msgstr "" + +#: routes.py:388 +msgid "No responding fullnode found for %{blockchain}. Please check your workers." +msgstr "" + +#: routes.py:407 +msgid "Unsupported log type" +msgstr "" + +#: templates/index.html:30 +msgid "Expected Time to Win" +msgstr "" + +#: templates/index.html:41 +msgid "Plotting" +msgstr "" + +#: templates/index.html:50 +msgid "Farming" +msgstr "" + +#: templates/index.html:72 +msgid "Total Plots" +msgstr "" + +#: templates/index.html:79 +msgid "Total Plots Size" +msgstr "" + +#: templates/index.html:89 +msgid "Balance" +msgstr "" + +#: templates/index.html:96 +msgid "Farmed" +msgstr "" + +#: templates/index.html:105 +msgid "Netspace" +msgstr "" + +#: templates/index.html:120 +msgid "Challenges from Harvesters" +msgstr "" + +#: templates/index.html:136 +msgid "Partial Proofs for Pools" +msgstr "" + +#: templates/index.html:147 +msgid "Previous" +msgstr "" + +#: templates/index.html:151 +msgid "Next" +msgstr "" + +#: templates/setup.html:27 +msgid "Welcome to Machinaris!" +msgstr "" + +#: templates/setup.html:28 +#, python-format +msgid "An easy-to-use WebUI for Chia%(trademark)s plotting and farming." +msgstr "" + +#: templates/setup.html:61 +#, python-format +msgid "" +"On very first launch, the Chia compressed blockchain database " +"%(compressed)s is being downloaded from %(dl_link)s. At about " +"%(uncompressed)s in uncompressed size (progress shown above), this will " +"take a while. However minutes of download now, will save you multiple " +"days of blockchain syncing later. Please be patient!" +msgstr "" + +#: templates/setup.html:75 +#, python-format +msgid "" +"NOTE: If you would prefer to allow Chia to sync the blockchain over many " +"days, see the %(init_link)s for details. Similarly, you may instead " +"%(import_link_open)s import your own blockchain %(import_link_close)s if " +"you have one from a previous Chia install." +msgstr "" + +#: templates/setup.html:83 +#, python-format +msgid "" +"To get started with Machinaris as a Chia%(trademark)s fullnode, either " +"import your existing 24-word mnemonic seed phrase" +msgstr "" + +#: templates/setup.html:90 +msgid "Import Existing Key" +msgstr "" + +#: templates/setup.html:91 +msgid "OR" +msgstr "" + +#: templates/setup.html:93 +msgid "" +"You can generate a brand-new mnemonic phrase that will be written to this" +" in-container path" +msgstr "" + +#: templates/setup.html:96 +msgid "Generate New Key" +msgstr "" + +#: templates/setup.html:110 +#, python-format +msgid "" +"NOTE: If you would prefer to instead import your mnenmoic seed phrase " +"yourself at the command-line, see the %(wiki_link)s for details." +msgstr "" + +#~ msgid "" +#~ "No worker at %{worker} for fork " +#~ "%{blockchain}. Please select another fork." +#~ msgstr "" + diff --git a/web/translations/zh/LC_MESSAGES/messages.po b/web/translations/zh/LC_MESSAGES/messages.po new file mode 100644 index 00000000..0d4f653c --- /dev/null +++ b/web/translations/zh/LC_MESSAGES/messages.po @@ -0,0 +1,185 @@ +# Chinese translations for PROJECT. +# Copyright (C) 2022 ORGANIZATION +# This file is distributed under the same license as the PROJECT project. +# FIRST AUTHOR , 2022. +# +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"PO-Revision-Date: 2022-02-15 10:14-0700\n" +"Last-Translator: FULL NAME \n" +"Language: zh\n" +"Language-Team: zh \n" +"Plural-Forms: nplurals=1; plural=0\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: routes.py:84 +msgid "Blockchain download" +msgstr "" + +#: routes.py:116 +msgid "Unknown plotting form" +msgstr "" + +#: routes.py:165 +msgid "Error! Please see logs." +msgstr "" + +#: routes.py:191 +msgid "Unknown alerts form" +msgstr "" + +#: routes.py:260 +msgid "Unknown form action" +msgstr "" + +#: routes.py:365 +msgid "" +"No worker at %{worker} for blockchain %{blockchain}. Please select " +"another blockchain." +msgstr "" + +#: routes.py:371 +msgid "" +"For Alerts config, found no responding fullnode found for %{blockchain}. " +"Please check your workers." +msgstr "" + +#: routes.py:376 +msgid "" +"For Farming config, found no responding fullnode found for %{blockchain}." +" Please check your workers." +msgstr "" + +#: routes.py:383 +msgid "" +"For Plotting config, found no responding fullnode found for " +"%{blockchain}. Please check your workers." +msgstr "" + +#: routes.py:388 +msgid "No responding fullnode found for %{blockchain}. Please check your workers." +msgstr "" + +#: routes.py:407 +msgid "Unsupported log type" +msgstr "" + +#: templates/index.html:30 +msgid "Expected Time to Win" +msgstr "" + +#: templates/index.html:41 +msgid "Plotting" +msgstr "" + +#: templates/index.html:50 +msgid "Farming" +msgstr "" + +#: templates/index.html:72 +msgid "Total Plots" +msgstr "" + +#: templates/index.html:79 +msgid "Total Plots Size" +msgstr "" + +#: templates/index.html:89 +msgid "Balance" +msgstr "" + +#: templates/index.html:96 +msgid "Farmed" +msgstr "" + +#: templates/index.html:105 +msgid "Netspace" +msgstr "" + +#: templates/index.html:120 +msgid "Challenges from Harvesters" +msgstr "" + +#: templates/index.html:136 +msgid "Partial Proofs for Pools" +msgstr "" + +#: templates/index.html:147 +msgid "Previous" +msgstr "" + +#: templates/index.html:151 +msgid "Next" +msgstr "" + +#: templates/setup.html:27 +msgid "Welcome to Machinaris!" +msgstr "" + +#: templates/setup.html:28 +#, python-format +msgid "An easy-to-use WebUI for Chia%(trademark)s plotting and farming." +msgstr "" + +#: templates/setup.html:61 +#, python-format +msgid "" +"On very first launch, the Chia compressed blockchain database " +"%(compressed)s is being downloaded from %(dl_link)s. At about " +"%(uncompressed)s in uncompressed size (progress shown above), this will " +"take a while. However minutes of download now, will save you multiple " +"days of blockchain syncing later. Please be patient!" +msgstr "" + +#: templates/setup.html:75 +#, python-format +msgid "" +"NOTE: If you would prefer to allow Chia to sync the blockchain over many " +"days, see the %(init_link)s for details. Similarly, you may instead " +"%(import_link_open)s import your own blockchain %(import_link_close)s if " +"you have one from a previous Chia install." +msgstr "" + +#: templates/setup.html:83 +#, python-format +msgid "" +"To get started with Machinaris as a Chia%(trademark)s fullnode, either " +"import your existing 24-word mnemonic seed phrase" +msgstr "" + +#: templates/setup.html:90 +msgid "Import Existing Key" +msgstr "" + +#: templates/setup.html:91 +msgid "OR" +msgstr "" + +#: templates/setup.html:93 +msgid "" +"You can generate a brand-new mnemonic phrase that will be written to this" +" in-container path" +msgstr "" + +#: templates/setup.html:96 +msgid "Generate New Key" +msgstr "" + +#: templates/setup.html:110 +#, python-format +msgid "" +"NOTE: If you would prefer to instead import your mnenmoic seed phrase " +"yourself at the command-line, see the %(wiki_link)s for details." +msgstr "" + +#~ msgid "" +#~ "No worker at %{worker} for fork " +#~ "%{blockchain}. Please select another fork." +#~ msgstr "" + diff --git a/web/utils.py b/web/utils.py index e7759391..9caf81f3 100644 --- a/web/utils.py +++ b/web/utils.py @@ -10,31 +10,40 @@ from web import app -def send_get(worker, path, query_params={}, timeout=30, debug=False): +def send_get(worker, path, query_params={}, timeout=30, debug=False, lang=None): if debug: http.client.HTTPConnection.debuglevel = 1 - response = requests.get(worker.url + path, params = query_params, timeout=timeout) + headers = [] + if lang: + headers['Accept-Language'] = lang + response = requests.get(worker.url + path, headers = headers, params = query_params, timeout=timeout) http.client.HTTPConnection.debuglevel = 0 return response -def send_post(worker, path, payload, debug=False): +def send_post(worker, path, payload, debug=False, lang=None): headers = {'Content-type': 'application/json', 'Accept': 'application/json'} + if lang: + headers['Accept-Language'] = lang if debug: http.client.HTTPConnection.debuglevel = 1 response = requests.post(worker.url + path, headers = headers, data = json.dumps(payload)) http.client.HTTPConnection.debuglevel = 0 return response -def send_put(worker, path, payload, debug=False): +def send_put(worker, path, payload, debug=False, lang=None): headers = {'Content-type': 'application/json', 'Accept': 'application/json'} + if lang: + headers['Accept-Language'] = lang if debug: http.client.HTTPConnection.debuglevel = 1 response = requests.put(worker.url + path, headers = headers, data = json.dumps(payload)) http.client.HTTPConnection.debuglevel = 0 return response -def send_delete(worker, path, debug=False): +def send_delete(worker, path, debug=False, lang=None): headers = {'Content-type': 'application/json', 'Accept': 'application/json'} + if lang: + headers['Accept-Language'] = lang if debug: http.client.HTTPConnection.debuglevel = 1 response = requests.delete(worker.url + path, headers = headers) From 6878b81f047201af53f7e3245d5b82adbe4fc1d9 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Tue, 15 Feb 2022 19:22:22 -0700 Subject: [PATCH 23/85] Disable ping language debugging. --- api/views/ping/resources.py | 2 -- web/translations/fr/LC_MESSAGES/messages.po | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/api/views/ping/resources.py b/api/views/ping/resources.py index ef74ae28..64e3e959 100644 --- a/api/views/ping/resources.py +++ b/api/views/ping/resources.py @@ -21,8 +21,6 @@ class Logs(MethodView): def get(self): - app.logger.info("IN PING, LANGUAGES ARE {0}".format(app.config['LANGUAGES'])) - app.logger.info("IN PING, LANG={0}".format(request.headers['Accept-Language'])) app.logger.info("IN PING, MATCH IS {0}".format(request.accept_languages.best_match(app.config['LANGUAGES']))) app.logger.info("IN PING, PONG IS {0}".format(_('Pong!'))) response = make_response( diff --git a/web/translations/fr/LC_MESSAGES/messages.po b/web/translations/fr/LC_MESSAGES/messages.po index b2bfe226..36b6b545 100644 --- a/web/translations/fr/LC_MESSAGES/messages.po +++ b/web/translations/fr/LC_MESSAGES/messages.po @@ -106,7 +106,7 @@ msgstr "Total" #: templates/index.html:96 msgid "Farmed" -msgstr "A gagné" +msgstr "A Gagné" #: templates/index.html:105 msgid "Netspace" From defc48470c7bc7638208630fa2d39a3d1ac59d28 Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Wed, 16 Feb 2022 11:49:52 -0700 Subject: [PATCH 24/85] More i18n message extraction. --- api/default_settings.py | 2 +- api/translations/de/LC_MESSAGES/messages.po | 4 +- api/translations/fr/LC_MESSAGES/messages.po | 4 +- api/translations/it/LC_MESSAGES/messages.po | 4 +- api/translations/zh/LC_MESSAGES/messages.po | 4 +- scripts/i18n/init.sh | 3 + web/__init__.py | 2 +- web/actions/chia.py | 1 + web/actions/log_handler.py | 2 +- web/default_settings.py | 2 +- web/routes.py | 7 +- web/static/{landings.txt => landings/de.txt} | 22 ++-- web/static/landings/en.txt | 63 +++++++++++ web/static/landings/fr.txt | 63 +++++++++++ web/static/landings/it.txt | 63 +++++++++++ web/static/landings/zh.txt | 63 +++++++++++ web/templates/base.html | 60 +++++------ web/translations/de/LC_MESSAGES/messages.po | 95 ++++++++++++++++- web/translations/fr/LC_MESSAGES/messages.po | 106 +++++++++++++++++-- web/translations/it/LC_MESSAGES/messages.po | 94 +++++++++++++++- web/translations/zh/LC_MESSAGES/messages.po | 94 +++++++++++++++- web/utils.py | 2 +- 22 files changed, 674 insertions(+), 86 deletions(-) rename web/static/{landings.txt => landings/de.txt} (72%) create mode 100644 web/static/landings/en.txt create mode 100644 web/static/landings/fr.txt create mode 100644 web/static/landings/it.txt create mode 100644 web/static/landings/zh.txt diff --git a/api/default_settings.py b/api/default_settings.py index a30da8f4..c57747be 100644 --- a/api/default_settings.py +++ b/api/default_settings.py @@ -51,4 +51,4 @@ class DefaultConfig: ALLOW_HARVESTER_CERT_LAN_DOWNLOAD = True BABEL_TRANSLATION_DIRECTORIES = "api/translations" - LANGUAGES = ['de', 'fr', 'it', 'zh'] + LANGUAGES = ['en', 'de', 'fr', 'it', 'zh'] diff --git a/api/translations/de/LC_MESSAGES/messages.po b/api/translations/de/LC_MESSAGES/messages.po index c5230150..ecc9c424 100644 --- a/api/translations/de/LC_MESSAGES/messages.po +++ b/api/translations/de/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"POT-Creation-Date: 2022-02-16 08:55-0700\n" "PO-Revision-Date: 2022-02-15 14:29-0700\n" "Last-Translator: FULL NAME \n" "Language: de\n" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -#: views/ping/resources.py:26 +#: views/ping/resources.py:25 msgid "Pong!" msgstr "" diff --git a/api/translations/fr/LC_MESSAGES/messages.po b/api/translations/fr/LC_MESSAGES/messages.po index 7fe5d6e2..1c4bc1a2 100644 --- a/api/translations/fr/LC_MESSAGES/messages.po +++ b/api/translations/fr/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"POT-Creation-Date: 2022-02-16 08:55-0700\n" "PO-Revision-Date: 2022-02-15 14:29-0700\n" "Last-Translator: FULL NAME \n" "Language: fr\n" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -#: views/ping/resources.py:26 +#: views/ping/resources.py:25 msgid "Pong!" msgstr "Le pong!" diff --git a/api/translations/it/LC_MESSAGES/messages.po b/api/translations/it/LC_MESSAGES/messages.po index df856d22..24cc721c 100644 --- a/api/translations/it/LC_MESSAGES/messages.po +++ b/api/translations/it/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"POT-Creation-Date: 2022-02-16 08:55-0700\n" "PO-Revision-Date: 2022-02-15 14:29-0700\n" "Last-Translator: FULL NAME \n" "Language: it\n" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -#: views/ping/resources.py:26 +#: views/ping/resources.py:25 msgid "Pong!" msgstr "" diff --git a/api/translations/zh/LC_MESSAGES/messages.po b/api/translations/zh/LC_MESSAGES/messages.po index 5719670a..9bf174a0 100644 --- a/api/translations/zh/LC_MESSAGES/messages.po +++ b/api/translations/zh/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"POT-Creation-Date: 2022-02-16 08:55-0700\n" "PO-Revision-Date: 2022-02-15 14:29-0700\n" "Last-Translator: FULL NAME \n" "Language: zh\n" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -#: views/ping/resources.py:26 +#: views/ping/resources.py:25 msgid "Pong!" msgstr "" diff --git a/scripts/i18n/init.sh b/scripts/i18n/init.sh index db350c68..42f55eba 100644 --- a/scripts/i18n/init.sh +++ b/scripts/i18n/init.sh @@ -9,6 +9,9 @@ do IFS=','; for lang in $LANGS; do + if [[ "$lang" == 'en' ]]; then + continue # No separate translation files for default locale + fi if [ -d ./translations/$lang ]; then echo "Skipping initialization of $d/$lang as translations folder already exists." else diff --git a/web/__init__.py b/web/__init__.py index a1f590b4..86286a70 100644 --- a/web/__init__.py +++ b/web/__init__.py @@ -22,7 +22,7 @@ def get_locale(): for d in babel.translation_directories: app.logger.debug(d) - app.logger.debug("WEB=> Returning locale: {0}".format(request.accept_languages.best_match(app.config['LANGUAGES']))) + app.logger.info("WEB=> Returning locale: {0}".format(request.accept_languages.best_match(app.config['LANGUAGES']))) return request.accept_languages.best_match(app.config['LANGUAGES']) @event.listens_for(Engine, "connect") diff --git a/web/actions/chia.py b/web/actions/chia.py index 0564b7e4..fc5da16b 100644 --- a/web/actions/chia.py +++ b/web/actions/chia.py @@ -141,6 +141,7 @@ def load_summaries(): return Summaries(blockchains, farms.farms, farms.wallets, summary_stats) except Exception as ex: app.logger.error("Error loading summary: {0}".format(str(ex))) + traceback.print_exc() return None def load_connections(): diff --git a/web/actions/log_handler.py b/web/actions/log_handler.py index 252bc2b7..7fdd10bf 100644 --- a/web/actions/log_handler.py +++ b/web/actions/log_handler.py @@ -24,7 +24,7 @@ def get_log_lines(lang, worker, log_type, log_id, blockchain): payload['log_id'] = log_id if blockchain != 'undefined': payload['blockchain'] = blockchain - response = utils.send_get(lang, worker, "/logs/{0}".format(log_type), payload, debug=True) + response = utils.send_get(worker, "/logs/{0}".format(log_type), payload, debug=False, lang=lang) return response.content.decode('utf-8') except: app.logger.info(traceback.format_exc()) diff --git a/web/default_settings.py b/web/default_settings.py index 70616e97..b18342f3 100644 --- a/web/default_settings.py +++ b/web/default_settings.py @@ -40,4 +40,4 @@ class DefaultConfig: # Note, babel looks in /machinaris/web/translations with this path. BABEL_TRANSLATION_DIRECTORIES = "translations" - LANGUAGES = ['de', 'fr', 'it', 'zh'] + LANGUAGES = ['en', 'de', 'fr', 'it', 'zh'] diff --git a/web/routes.py b/web/routes.py index a4ef4ee2..bead55cc 100644 --- a/web/routes.py +++ b/web/routes.py @@ -39,7 +39,12 @@ def landing(): gc = globals.load() if not globals.is_setup(): return redirect(url_for('setup')) - msg = random.choice(list(open('web/static/landings.txt'))) + for accept in request.accept_languages.values(): + app.logger.info("ACCEPT IS {0}".format(accept)) + app.logger.info("LANGUAGES IS {0}".format(app.config['LANGUAGES'])) + lang = request.accept_languages.best_match(app.config['LANGUAGES']) + app.logger.info("LANG IS {0}".format(lang)) + msg = random.choice(list(open('web/static/landings/{0}.txt'.format(lang)))) if msg.endswith(".png"): msg = "".format(url_for('static', filename='/landings/' + msg)) return render_template('landing.html', random_message=msg) diff --git a/web/static/landings.txt b/web/static/landings/de.txt similarity index 72% rename from web/static/landings.txt rename to web/static/landings/de.txt index b7bd5057..23fc8543 100644 --- a/web/static/landings.txt +++ b/web/static/landings/de.txt @@ -6,7 +6,6 @@ HODL! Good choice for a new hobby. First rule of forks... you don't talk about forks on /r/chia. Farm the dip! -Departing for El Salvador now... You can fit so many smart contracts in this bad boy. "Expected time to win"? Really? Psst! You got any more of that disk space? @@ -14,30 +13,24 @@ Hi-ho! Hi-ho! A schucking we will go. I'll make my own Chia... with blackjack and hookers! Keep calm and plot on. All your coins are belong to us. -..formatting all hard drives in 3 2 1.. +...formatting all hard drives in 3 2 1... Life is like a box of shitcoins Relax! They say this inflation is only transitory. Altcoins? Gotta Catch 'Em All -Chia pet! The best time to begin plotting was March 17 2021, the second best time is today. Ch Ch Ch Chia What happens on the blockchain stays on the blockchain. Not your grandma's currency. My chia pet was so boring... I'd rather go watch my cryptocurrency grow. Cha-ching! -"I just couldn't stop... no really I can't stop... how do you stop this thing?" - A satisfied user -This statement is false Have you tried restarting it? -Delete machinaris.db and wait 10 minutes patiently... Never trust a chia farm you can't throw out a window. -Fact: Chia coins rarely eat people -Don't push the big red button... it does nothing. The American dollar wants you to stop. Machinaris makes a great Christmas present. "Remember GME" (Game Stop) Life satisfaction and winning Chia coins... are basically the same thing. If in doubt, you could always try a fork. -Raising the demand for hardrives since 2020 +Raising the demand for hardrives since 2021 Now with lootboxes Machinaris was the imposter You know what is really scary... No WiFi @@ -47,12 +40,11 @@ We've never left Beta If and when the FBI calls... please don't tell them you're "plotting something" How's the electric bill these days? Today is someone's birthday! -I remember working once +I remember working once... When are you going to get a "real" job? Working is so overrated There are two types of people in this world, those that farm cryptocurrency and those who do not. It's a great community, join our Discord! -The difference between farming cryptocurrency and working at a job... is that one of them makes you money and the other is your job. Stonks! Have you tried Keybase? My condolences... When Moon? @@ -60,12 +52,12 @@ When Flamethrower? Does Elon know? BITCONNEEEEEEEEEECT! When the dust settles..... (too soon?) -No SSD's were harmed in the making of this movie. +No SSDs were harmed in the making of this movie. (Pro Tip) If you delete System32 you can fit in more plots [A]bort, [R]etry, [F]ail -Please insert Disk 2 and press any key to continue..... +Please insert Disk 2 and press any key to continue... Error in Error reporting, cannot Error @$Error. Starting Log4j in 3... 2... 1... 10 PRINT "WITTY TEXT GOES HERE" -Just Remember...... You could have bought GPU's instead -Congratulations you've won $0.00 please pay the Gas fee to receive you winnings. +Just Remember...... You could have bought GPUs instead +Congratulations you've won $0.00! Please pay the Gas fee to receive your winnings. 1337.png \ No newline at end of file diff --git a/web/static/landings/en.txt b/web/static/landings/en.txt new file mode 100644 index 00000000..23fc8543 --- /dev/null +++ b/web/static/landings/en.txt @@ -0,0 +1,63 @@ +Get in loser, we're going to the moon! +Loading all the doge now... +The IRS has been notified. +I was told... there would be lambos. +HODL! +Good choice for a new hobby. +First rule of forks... you don't talk about forks on /r/chia. +Farm the dip! +You can fit so many smart contracts in this bad boy. +"Expected time to win"? Really? +Psst! You got any more of that disk space? +Hi-ho! Hi-ho! A schucking we will go. +I'll make my own Chia... with blackjack and hookers! +Keep calm and plot on. +All your coins are belong to us. +...formatting all hard drives in 3 2 1... +Life is like a box of shitcoins +Relax! They say this inflation is only transitory. +Altcoins? Gotta Catch 'Em All +The best time to begin plotting was March 17 2021, the second best time is today. +Ch Ch Ch Chia +What happens on the blockchain stays on the blockchain. +Not your grandma's currency. +My chia pet was so boring... I'd rather go watch my cryptocurrency grow. +Cha-ching! +Have you tried restarting it? +Never trust a chia farm you can't throw out a window. +The American dollar wants you to stop. +Machinaris makes a great Christmas present. +"Remember GME" (Game Stop) +Life satisfaction and winning Chia coins... are basically the same thing. +If in doubt, you could always try a fork. +Raising the demand for hardrives since 2021 +Now with lootboxes +Machinaris was the imposter +You know what is really scary... No WiFi +Wow lucky! +I've never met a coin I didn't like +We've never left Beta +If and when the FBI calls... please don't tell them you're "plotting something" +How's the electric bill these days? +Today is someone's birthday! +I remember working once... +When are you going to get a "real" job? +Working is so overrated +There are two types of people in this world, those that farm cryptocurrency and those who do not. +It's a great community, join our Discord! +Stonks! +Have you tried Keybase? My condolences... +When Moon? +When Flamethrower? +Does Elon know? +BITCONNEEEEEEEEEECT! +When the dust settles..... (too soon?) +No SSDs were harmed in the making of this movie. +(Pro Tip) If you delete System32 you can fit in more plots +[A]bort, [R]etry, [F]ail +Please insert Disk 2 and press any key to continue... +Error in Error reporting, cannot Error @$Error. Starting Log4j in 3... 2... 1... +10 PRINT "WITTY TEXT GOES HERE" +Just Remember...... You could have bought GPUs instead +Congratulations you've won $0.00! Please pay the Gas fee to receive your winnings. +1337.png \ No newline at end of file diff --git a/web/static/landings/fr.txt b/web/static/landings/fr.txt new file mode 100644 index 00000000..f8cd5bc0 --- /dev/null +++ b/web/static/landings/fr.txt @@ -0,0 +1,63 @@ +Entrez perdant, nous allons sur la lune! +Chargement de tous les doges maintenant... +L'IRS a été avisé. +On m'a dit... qu'il y aurait des lambos. +HODL! +Bon choix pour un nouveau passe-temps. +Première règle des forks... on ne parle pas de forks sur /r/chia. +Farm le dip! +Vous pouvez intégrer autant de contrats intelligents dans ce bad boy ici. +"Expected time to win"? Sérieusement? +Psst ! Vous avez plus de cet espace disque ? +Hi-ho! Hi-ho! A schucking we will go. +Je ferai ma propre Chia... avec du blackjack et des hookers! +Restez calme et "plot on". +Toutes vos pièces "are belong to us". +...formatage de tous les disques durs en 3 2 1... +La vie est comme une boîte de shitcoins +Relaxer! Ils disent que cette inflation n'est que transitoire. +Altcoins? Gotta Catch 'Em All +Le meilleur moment pour commencer à plot était le 17 mars 2021, le deuxième meilleur moment est aujourd'hui. +Ch Ch Ch Chia +Ce qui se passe sur la blockchain reste sur la blockchain. +Pas la monnaie de ta grand-mère. +Mon animal de compagnie chia était si ennuyeux... Je préfère aller voir ma cryptocurrency grandir. +Cha-ching! +As-tu essayé de le redémarrer ? +Ne faites jamais confiance à une ferme de chia que vous ne pouvez pas jeter par la fenêtre. +The American dollar wants you to stop. +Machinaris fait un excellent cadeau de Noël. +Souvenez-vous de GME (Game Stop) +Satisfaction de vivre et gagner des pièces Chia... c'est fondamentalement la même chose. +En cas de doute, vous pouvez toujours essayer une fourchette. +Augmentation de la demande de disques durs depuis 2021 +Maintenant avec des lootboxes +Machinaris était l'imposteur +Vous savez ce qui est vraiment effrayant... Pas de WiFi +Quelle chance! +Je n'ai jamais rencontré une pièce que je n'aimais pas +Nous n'avons jamais quitté Beta +Si et quand le FBI appelle... s'il vous plait, ne leur dites pas que vous "complotez quelque chose" +Comment est la facture d'électricité ces jours-ci ? +Aujourd'hui c'est l'anniversaire de quelqu'un ! +Je me souviens avoir travaillé une fois... +Quand vas-tu trouver un "vrai" travail? +Travailler est tellement surestimé +Il existe deux types de personnes dans ce monde, celles qui cultivent la cryptocurrency et celles qui ne le font pas. +C'est une grande communauté, rejoignez notre Discord! +Stonks! +Avez-vous essayé Keybase ? Mes condoléances... +A quand la Lune ? +A quand Lance-flammes ? +Est-ce qu'Elon le sait ? +BITCONNEEEEEEEEEECT! +Quand la poussière retombe..... (trop tôt ?) +Aucun SSD n'a été endommagé lors de la réalisation de ce film. +(Pro Tip) Si vous supprimez System32, vous pouvez intégrer plus des plots +[A]bort, [R]etry, [F]ail +Veuillez insérer le disque 2 et appuyer sur n'importe quelle touche pour continuer... +Erreur dans le rapport d'erreur, impossible d'erreur @$Error. Démarrage de Log4j dans 3... 2... 1... +10 PRINT "WITTY TEXTE VA ICI" +N'oubliez pas ...... Vous auriez pu acheter des GPU à la place +Félicitations, vous avez gagné 0,00$ Veuillez payer les frais d'essence pour recevoir vos gains. +1337.png \ No newline at end of file diff --git a/web/static/landings/it.txt b/web/static/landings/it.txt new file mode 100644 index 00000000..23fc8543 --- /dev/null +++ b/web/static/landings/it.txt @@ -0,0 +1,63 @@ +Get in loser, we're going to the moon! +Loading all the doge now... +The IRS has been notified. +I was told... there would be lambos. +HODL! +Good choice for a new hobby. +First rule of forks... you don't talk about forks on /r/chia. +Farm the dip! +You can fit so many smart contracts in this bad boy. +"Expected time to win"? Really? +Psst! You got any more of that disk space? +Hi-ho! Hi-ho! A schucking we will go. +I'll make my own Chia... with blackjack and hookers! +Keep calm and plot on. +All your coins are belong to us. +...formatting all hard drives in 3 2 1... +Life is like a box of shitcoins +Relax! They say this inflation is only transitory. +Altcoins? Gotta Catch 'Em All +The best time to begin plotting was March 17 2021, the second best time is today. +Ch Ch Ch Chia +What happens on the blockchain stays on the blockchain. +Not your grandma's currency. +My chia pet was so boring... I'd rather go watch my cryptocurrency grow. +Cha-ching! +Have you tried restarting it? +Never trust a chia farm you can't throw out a window. +The American dollar wants you to stop. +Machinaris makes a great Christmas present. +"Remember GME" (Game Stop) +Life satisfaction and winning Chia coins... are basically the same thing. +If in doubt, you could always try a fork. +Raising the demand for hardrives since 2021 +Now with lootboxes +Machinaris was the imposter +You know what is really scary... No WiFi +Wow lucky! +I've never met a coin I didn't like +We've never left Beta +If and when the FBI calls... please don't tell them you're "plotting something" +How's the electric bill these days? +Today is someone's birthday! +I remember working once... +When are you going to get a "real" job? +Working is so overrated +There are two types of people in this world, those that farm cryptocurrency and those who do not. +It's a great community, join our Discord! +Stonks! +Have you tried Keybase? My condolences... +When Moon? +When Flamethrower? +Does Elon know? +BITCONNEEEEEEEEEECT! +When the dust settles..... (too soon?) +No SSDs were harmed in the making of this movie. +(Pro Tip) If you delete System32 you can fit in more plots +[A]bort, [R]etry, [F]ail +Please insert Disk 2 and press any key to continue... +Error in Error reporting, cannot Error @$Error. Starting Log4j in 3... 2... 1... +10 PRINT "WITTY TEXT GOES HERE" +Just Remember...... You could have bought GPUs instead +Congratulations you've won $0.00! Please pay the Gas fee to receive your winnings. +1337.png \ No newline at end of file diff --git a/web/static/landings/zh.txt b/web/static/landings/zh.txt new file mode 100644 index 00000000..23fc8543 --- /dev/null +++ b/web/static/landings/zh.txt @@ -0,0 +1,63 @@ +Get in loser, we're going to the moon! +Loading all the doge now... +The IRS has been notified. +I was told... there would be lambos. +HODL! +Good choice for a new hobby. +First rule of forks... you don't talk about forks on /r/chia. +Farm the dip! +You can fit so many smart contracts in this bad boy. +"Expected time to win"? Really? +Psst! You got any more of that disk space? +Hi-ho! Hi-ho! A schucking we will go. +I'll make my own Chia... with blackjack and hookers! +Keep calm and plot on. +All your coins are belong to us. +...formatting all hard drives in 3 2 1... +Life is like a box of shitcoins +Relax! They say this inflation is only transitory. +Altcoins? Gotta Catch 'Em All +The best time to begin plotting was March 17 2021, the second best time is today. +Ch Ch Ch Chia +What happens on the blockchain stays on the blockchain. +Not your grandma's currency. +My chia pet was so boring... I'd rather go watch my cryptocurrency grow. +Cha-ching! +Have you tried restarting it? +Never trust a chia farm you can't throw out a window. +The American dollar wants you to stop. +Machinaris makes a great Christmas present. +"Remember GME" (Game Stop) +Life satisfaction and winning Chia coins... are basically the same thing. +If in doubt, you could always try a fork. +Raising the demand for hardrives since 2021 +Now with lootboxes +Machinaris was the imposter +You know what is really scary... No WiFi +Wow lucky! +I've never met a coin I didn't like +We've never left Beta +If and when the FBI calls... please don't tell them you're "plotting something" +How's the electric bill these days? +Today is someone's birthday! +I remember working once... +When are you going to get a "real" job? +Working is so overrated +There are two types of people in this world, those that farm cryptocurrency and those who do not. +It's a great community, join our Discord! +Stonks! +Have you tried Keybase? My condolences... +When Moon? +When Flamethrower? +Does Elon know? +BITCONNEEEEEEEEEECT! +When the dust settles..... (too soon?) +No SSDs were harmed in the making of this movie. +(Pro Tip) If you delete System32 you can fit in more plots +[A]bort, [R]etry, [F]ail +Please insert Disk 2 and press any key to continue... +Error in Error reporting, cannot Error @$Error. Starting Log4j in 3... 2... 1... +10 PRINT "WITTY TEXT GOES HERE" +Just Remember...... You could have bought GPUs instead +Congratulations you've won $0.00! Please pay the Gas fee to receive your winnings. +1337.png \ No newline at end of file diff --git a/web/templates/base.html b/web/templates/base.html index 0e6e9e9e..e2ddd999 100644 --- a/web/templates/base.html +++ b/web/templates/base.html @@ -7,7 +7,7 @@ - Machinaris + {{_('Machinaris')}} {% if reload_seconds %} {% endif %} @@ -22,104 +22,102 @@
-  Machinaris +  {{_('Machinaris')}}
@@ -159,7 +157,7 @@ {% if global_config.bladebit_version %}
- Bladebit {{ global_config.bladebit_version }} + {{_('Bladebit')}} {{ global_config.bladebit_version }}
{% endif %}
@@ -169,16 +167,16 @@ Chiadog {{ global_config.chiadog_version }}
- Machinaris {{ + {{_('Machinaris')}} {{ global_config.machinaris_version }}
{% if global_config.madmax_version %}
- Madmax {{ global_config.madmax_version }} + {{_('Madmax')}} {{ global_config.madmax_version }}
{% endif %}
- Plotman {{ global_config.plotman_version }} + {{_('Plotman')}} {{ global_config.plotman_version }}
diff --git a/web/translations/de/LC_MESSAGES/messages.po b/web/translations/de/LC_MESSAGES/messages.po index cd64856c..5a79a74a 100644 --- a/web/translations/de/LC_MESSAGES/messages.po +++ b/web/translations/de/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"POT-Creation-Date: 2022-02-16 08:55-0700\n" "PO-Revision-Date: 2022-02-13 13:45-0700\n" "Last-Translator: FULL NAME \n" "Language: de\n" @@ -70,18 +70,103 @@ msgstr "" msgid "Unsupported log type" msgstr "" -#: templates/index.html:30 -msgid "Expected Time to Win" +#: templates/base.html:10 templates/base.html:25 templates/base.html:170 +#, fuzzy +msgid "Machinaris" +msgstr "Willkommen zu" + +#: templates/base.html:31 +msgid "Summary" msgstr "" -#: templates/index.html:41 +#: templates/base.html:37 templates/base.html:108 templates/index.html:41 msgid "Plotting" msgstr "" -#: templates/index.html:50 +#: templates/base.html:43 templates/base.html:102 templates/index.html:50 msgid "Farming" msgstr "" +#: templates/base.html:49 +msgid "Wallets" +msgstr "" + +#: templates/base.html:55 +msgid "Keys" +msgstr "" + +#: templates/base.html:62 +msgid "Blockchains" +msgstr "" + +#: templates/base.html:69 +msgid "Connections" +msgstr "" + +#: templates/base.html:75 templates/base.html:96 +msgid "Alerts" +msgstr "" + +#: templates/base.html:81 templates/base.html:114 +msgid "Pools" +msgstr "" + +#: templates/base.html:85 +msgid "Workers" +msgstr "" + +#: templates/base.html:91 +msgid "Settings" +msgstr "" + +#: templates/base.html:120 +msgid "Tools" +msgstr "" + +#: templates/base.html:131 +msgid "About" +msgstr "" + +#: templates/base.html:134 +msgid "Install" +msgstr "" + +#: templates/base.html:136 +msgid "Project" +msgstr "" + +#: templates/base.html:138 +msgid "Wiki" +msgstr "" + +#: templates/base.html:140 +msgid "Issues" +msgstr "" + +#: templates/base.html:142 +msgid "License" +msgstr "" + +#: templates/base.html:144 +msgid "Credits" +msgstr "" + +#: templates/base.html:160 +msgid "Bladebit" +msgstr "" + +#: templates/base.html:175 +msgid "Madmax" +msgstr "" + +#: templates/base.html:179 +msgid "Plotman" +msgstr "" + +#: templates/index.html:30 +msgid "Expected Time to Win" +msgstr "" + #: templates/index.html:72 msgid "Total Plots" msgstr "" diff --git a/web/translations/fr/LC_MESSAGES/messages.po b/web/translations/fr/LC_MESSAGES/messages.po index 36b6b545..a8654d52 100644 --- a/web/translations/fr/LC_MESSAGES/messages.po +++ b/web/translations/fr/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"POT-Creation-Date: 2022-02-16 08:55-0700\n" "PO-Revision-Date: 2022-02-13 13:45-0700\n" "Last-Translator: FULL NAME \n" "Language: fr\n" @@ -80,25 +80,109 @@ msgstr "" msgid "Unsupported log type" msgstr "Type de journal non pris en charge" -#: templates/index.html:30 -msgid "Expected Time to Win" -msgstr "Temps prévu pour gagner" +#: templates/base.html:10 templates/base.html:25 templates/base.html:170 +msgid "Machinaris" +msgstr "" -#: templates/index.html:41 +#: templates/base.html:31 +msgid "Summary" +msgstr "Sommaire" + +#: templates/base.html:37 templates/base.html:108 templates/index.html:41 msgid "Plotting" -msgstr "Parcelle" +msgstr "Plotting" -#: templates/index.html:50 +#: templates/base.html:43 templates/base.html:102 templates/index.html:50 msgid "Farming" -msgstr "Cultiver" +msgstr "Farming" + +#: templates/base.html:49 +msgid "Wallets" +msgstr "Portefeuilles" + +#: templates/base.html:55 +msgid "Keys" +msgstr "Clés" + +#: templates/base.html:62 +msgid "Blockchains" +msgstr "" + +#: templates/base.html:69 +msgid "Connections" +msgstr "Connexions" + +#: templates/base.html:75 templates/base.html:96 +msgid "Alerts" +msgstr "Alertes" + +#: templates/base.html:81 templates/base.html:114 +msgid "Pools" +msgstr "Pools" + +#: templates/base.html:85 +msgid "Workers" +msgstr "Workers" + +#: templates/base.html:91 +msgid "Settings" +msgstr "Paramètres" + +#: templates/base.html:120 +msgid "Tools" +msgstr "Outils" + +#: templates/base.html:131 +msgid "About" +msgstr "À propos" + +#: templates/base.html:134 +msgid "Install" +msgstr "Installer" + +#: templates/base.html:136 +msgid "Project" +msgstr "Projet" + +#: templates/base.html:138 +msgid "Wiki" +msgstr "Wiki" + +#: templates/base.html:140 +msgid "Issues" +msgstr "Problèmes" + +#: templates/base.html:142 +msgid "License" +msgstr "Licence" + +#: templates/base.html:144 +msgid "Credits" +msgstr "Crédits" + +#: templates/base.html:160 +msgid "Bladebit" +msgstr "Bladebit" + +#: templates/base.html:175 +msgid "Madmax" +msgstr "Madmax" + +#: templates/base.html:179 +msgid "Plotman" +msgstr "Plotman" + +#: templates/index.html:30 +msgid "Expected Time to Win" +msgstr "Temps prévu pour gagner" #: templates/index.html:72 msgid "Total Plots" -msgstr "Parcelles totales" +msgstr "Plots totales" #: templates/index.html:79 msgid "Total Plots Size" -msgstr "Taille totale des parcelles" +msgstr "Taille totale des plots" #: templates/index.html:89 msgid "Balance" @@ -106,7 +190,7 @@ msgstr "Total" #: templates/index.html:96 msgid "Farmed" -msgstr "A Gagné" +msgstr "Farmed" #: templates/index.html:105 msgid "Netspace" diff --git a/web/translations/it/LC_MESSAGES/messages.po b/web/translations/it/LC_MESSAGES/messages.po index fa816b7d..0778d820 100644 --- a/web/translations/it/LC_MESSAGES/messages.po +++ b/web/translations/it/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"POT-Creation-Date: 2022-02-16 08:55-0700\n" "PO-Revision-Date: 2022-02-15 10:14-0700\n" "Last-Translator: FULL NAME \n" "Language: it\n" @@ -70,18 +70,102 @@ msgstr "" msgid "Unsupported log type" msgstr "" -#: templates/index.html:30 -msgid "Expected Time to Win" +#: templates/base.html:10 templates/base.html:25 templates/base.html:170 +msgid "Machinaris" +msgstr "" + +#: templates/base.html:31 +msgid "Summary" msgstr "" -#: templates/index.html:41 +#: templates/base.html:37 templates/base.html:108 templates/index.html:41 msgid "Plotting" msgstr "" -#: templates/index.html:50 +#: templates/base.html:43 templates/base.html:102 templates/index.html:50 msgid "Farming" msgstr "" +#: templates/base.html:49 +msgid "Wallets" +msgstr "" + +#: templates/base.html:55 +msgid "Keys" +msgstr "" + +#: templates/base.html:62 +msgid "Blockchains" +msgstr "" + +#: templates/base.html:69 +msgid "Connections" +msgstr "" + +#: templates/base.html:75 templates/base.html:96 +msgid "Alerts" +msgstr "" + +#: templates/base.html:81 templates/base.html:114 +msgid "Pools" +msgstr "" + +#: templates/base.html:85 +msgid "Workers" +msgstr "" + +#: templates/base.html:91 +msgid "Settings" +msgstr "" + +#: templates/base.html:120 +msgid "Tools" +msgstr "" + +#: templates/base.html:131 +msgid "About" +msgstr "" + +#: templates/base.html:134 +msgid "Install" +msgstr "" + +#: templates/base.html:136 +msgid "Project" +msgstr "" + +#: templates/base.html:138 +msgid "Wiki" +msgstr "" + +#: templates/base.html:140 +msgid "Issues" +msgstr "" + +#: templates/base.html:142 +msgid "License" +msgstr "" + +#: templates/base.html:144 +msgid "Credits" +msgstr "" + +#: templates/base.html:160 +msgid "Bladebit" +msgstr "" + +#: templates/base.html:175 +msgid "Madmax" +msgstr "" + +#: templates/base.html:179 +msgid "Plotman" +msgstr "" + +#: templates/index.html:30 +msgid "Expected Time to Win" +msgstr "" + #: templates/index.html:72 msgid "Total Plots" msgstr "" diff --git a/web/translations/zh/LC_MESSAGES/messages.po b/web/translations/zh/LC_MESSAGES/messages.po index 0d4f653c..a9fa0e01 100644 --- a/web/translations/zh/LC_MESSAGES/messages.po +++ b/web/translations/zh/LC_MESSAGES/messages.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-15 14:38-0700\n" +"POT-Creation-Date: 2022-02-16 08:55-0700\n" "PO-Revision-Date: 2022-02-15 10:14-0700\n" "Last-Translator: FULL NAME \n" "Language: zh\n" @@ -70,18 +70,102 @@ msgstr "" msgid "Unsupported log type" msgstr "" -#: templates/index.html:30 -msgid "Expected Time to Win" +#: templates/base.html:10 templates/base.html:25 templates/base.html:170 +msgid "Machinaris" +msgstr "" + +#: templates/base.html:31 +msgid "Summary" msgstr "" -#: templates/index.html:41 +#: templates/base.html:37 templates/base.html:108 templates/index.html:41 msgid "Plotting" msgstr "" -#: templates/index.html:50 +#: templates/base.html:43 templates/base.html:102 templates/index.html:50 msgid "Farming" msgstr "" +#: templates/base.html:49 +msgid "Wallets" +msgstr "" + +#: templates/base.html:55 +msgid "Keys" +msgstr "" + +#: templates/base.html:62 +msgid "Blockchains" +msgstr "" + +#: templates/base.html:69 +msgid "Connections" +msgstr "" + +#: templates/base.html:75 templates/base.html:96 +msgid "Alerts" +msgstr "" + +#: templates/base.html:81 templates/base.html:114 +msgid "Pools" +msgstr "" + +#: templates/base.html:85 +msgid "Workers" +msgstr "" + +#: templates/base.html:91 +msgid "Settings" +msgstr "" + +#: templates/base.html:120 +msgid "Tools" +msgstr "" + +#: templates/base.html:131 +msgid "About" +msgstr "" + +#: templates/base.html:134 +msgid "Install" +msgstr "" + +#: templates/base.html:136 +msgid "Project" +msgstr "" + +#: templates/base.html:138 +msgid "Wiki" +msgstr "" + +#: templates/base.html:140 +msgid "Issues" +msgstr "" + +#: templates/base.html:142 +msgid "License" +msgstr "" + +#: templates/base.html:144 +msgid "Credits" +msgstr "" + +#: templates/base.html:160 +msgid "Bladebit" +msgstr "" + +#: templates/base.html:175 +msgid "Madmax" +msgstr "" + +#: templates/base.html:179 +msgid "Plotman" +msgstr "" + +#: templates/index.html:30 +msgid "Expected Time to Win" +msgstr "" + #: templates/index.html:72 msgid "Total Plots" msgstr "" diff --git a/web/utils.py b/web/utils.py index 9caf81f3..17cadd7b 100644 --- a/web/utils.py +++ b/web/utils.py @@ -13,7 +13,7 @@ def send_get(worker, path, query_params={}, timeout=30, debug=False, lang=None): if debug: http.client.HTTPConnection.debuglevel = 1 - headers = [] + headers = {} if lang: headers['Accept-Language'] = lang response = requests.get(worker.url + path, headers = headers, params = query_params, timeout=timeout) From 3db0f9be7b45241e3867e56bb00b39f8d210252d Mon Sep 17 00:00:00 2001 From: Guy Davis Date: Wed, 16 Feb 2022 18:51:21 -0700 Subject: [PATCH 25/85] i18n for data tables --- api/translations/de/LC_MESSAGES/messages.po | 17 +- api/translations/fr/LC_MESSAGES/messages.po | 18 +- api/translations/it/LC_MESSAGES/messages.po | 18 +- api/translations/zh/LC_MESSAGES/messages.po | 18 +- api/views/logs/resources.py | 1 - scripts/pull_3rd_party_libs.sh | 17 ++ web/actions/worker.py | 1 + web/routes.py | 22 +- web/templates/alerts.html | 5 + web/templates/blockchains.html | 5 + web/templates/connections.html | 5 + web/templates/farming/plots.html | 23 +- web/templates/farming/workers.html | 23 +- web/templates/plotting/jobs.html | 80 +++--- web/templates/summary.html | 5 + web/templates/wallet.html | 5 + web/templates/worker.html | 5 + web/templates/workers.html | 5 + web/translations/de/LC_MESSAGES/messages.po | 283 ++++++++++++++++++-- web/translations/fr/LC_MESSAGES/messages.po | 234 ++++++++++++++-- web/translations/it/LC_MESSAGES/messages.po | 283 ++++++++++++++++++-- web/translations/zh/LC_MESSAGES/messages.po | 283 ++++++++++++++++++-- 22 files changed, 1155 insertions(+), 201 deletions(-) diff --git a/api/translations/de/LC_MESSAGES/messages.po b/api/translations/de/LC_MESSAGES/messages.po index ecc9c424..6d22dd4e 100644 --- a/api/translations/de/LC_MESSAGES/messages.po +++ b/api/translations/de/LC_MESSAGES/messages.po @@ -1,15 +1,14 @@ -# German translations for PROJECT. -# Copyright (C) 2022 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR , 2022. +# German translations for Machinaris. +# Copyright (C) 2022 Guy Davis +# This file is distributed under the same license as the Machinaris project. # msgid "" msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-16 08:55-0700\n" +"Project-Id-Version: Machinaris VERSION\n" +"Report-Msgid-Bugs-To: https://github.com/guydavis/machinaris/issues/353\n" +"POT-Creation-Date: 2022-02-16 17:48-0700\n" "PO-Revision-Date: 2022-02-15 14:29-0700\n" -"Last-Translator: FULL NAME \n" +"Last-Translator: FULL NAME\n" "Language: de\n" "Language-Team: de \n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" @@ -18,7 +17,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -#: views/ping/resources.py:25 +#: views/ping/resources.py:25 views/ping/resources.py:28 msgid "Pong!" msgstr "" diff --git a/api/translations/fr/LC_MESSAGES/messages.po b/api/translations/fr/LC_MESSAGES/messages.po index 1c4bc1a2..7ad89784 100644 --- a/api/translations/fr/LC_MESSAGES/messages.po +++ b/api/translations/fr/LC_MESSAGES/messages.po @@ -1,15 +1,15 @@ -# French translations for PROJECT. -# Copyright (C) 2022 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR , 2022. +# French translations for Machinaris. +# Copyright (C) 2022 Guy Davis +# This file is distributed under the same license as the Machinaris project. # msgid "" msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-16 08:55-0700\n" +"Project-Id-Version: Machinaris VERSION\n" +"Report-Msgid-Bugs-To: https://github.com/guydavis/machinaris/issuesPOT-" +"Creation-Date: 2022-02-16 15:00-0700\n" +"POT-Creation-Date: 2022-02-16 17:48-0700\n" "PO-Revision-Date: 2022-02-15 14:29-0700\n" -"Last-Translator: FULL NAME \n" +"Last-Translator: Guy Davis\n" "Language: fr\n" "Language-Team: fr \n" "Plural-Forms: nplurals=2; plural=(n > 1)\n" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -#: views/ping/resources.py:25 +#: views/ping/resources.py:25 views/ping/resources.py:28 msgid "Pong!" msgstr "Le pong!" diff --git a/api/translations/it/LC_MESSAGES/messages.po b/api/translations/it/LC_MESSAGES/messages.po index 24cc721c..1ff56244 100644 --- a/api/translations/it/LC_MESSAGES/messages.po +++ b/api/translations/it/LC_MESSAGES/messages.po @@ -1,15 +1,15 @@ -# Italian translations for PROJECT. -# Copyright (C) 2022 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR , 2022. +# Italian translations for Machinaris. +# Copyright (C) 2022 Guy Davis +# This file is distributed under the same license as the Machinaris project. # msgid "" msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-16 08:55-0700\n" +"Project-Id-Version: Machinaris VERSION\n" +"Report-Msgid-Bugs-To: https://github.com/guydavis/machinaris/issuesPOT-" +"Creation-Date: 2022-02-16 15:00-0700\n" +"POT-Creation-Date: 2022-02-16 17:48-0700\n" "PO-Revision-Date: 2022-02-15 14:29-0700\n" -"Last-Translator: FULL NAME \n" +"Last-Translator: FULL NAME\n" "Language: it\n" "Language-Team: it \n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -#: views/ping/resources.py:25 +#: views/ping/resources.py:25 views/ping/resources.py:28 msgid "Pong!" msgstr "" diff --git a/api/translations/zh/LC_MESSAGES/messages.po b/api/translations/zh/LC_MESSAGES/messages.po index 9bf174a0..609dfb10 100644 --- a/api/translations/zh/LC_MESSAGES/messages.po +++ b/api/translations/zh/LC_MESSAGES/messages.po @@ -1,15 +1,15 @@ -# Chinese translations for PROJECT. -# Copyright (C) 2022 ORGANIZATION -# This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR , 2022. +# Chinese translations for Machinaris. +# Copyright (C) 2022 Guy Davis +# This file is distributed under the same license as the Machinaris project. # msgid "" msgstr "" -"Project-Id-Version: PROJECT VERSION\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2022-02-16 08:55-0700\n" +"Project-Id-Version: Machinaris VERSION\n" +"Report-Msgid-Bugs-To: https://github.com/guydavis/machinaris/issuesPOT-" +"Creation-Date: 2022-02-16 15:00-0700\n" +"POT-Creation-Date: 2022-02-16 17:48-0700\n" "PO-Revision-Date: 2022-02-15 14:29-0700\n" -"Last-Translator: FULL NAME \n" +"Last-Translator: FULL NAME\n" "Language: zh\n" "Language-Team: zh \n" "Plural-Forms: nplurals=1; plural=0\n" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.9.1\n" -#: views/ping/resources.py:25 +#: views/ping/resources.py:25 views/ping/resources.py:28 msgid "Pong!" msgstr "" diff --git a/api/views/logs/resources.py b/api/views/logs/resources.py index fc276562..f6fee774 100644 --- a/api/views/logs/resources.py +++ b/api/views/logs/resources.py @@ -31,7 +31,6 @@ def get(self): class LogByType(MethodView): def get(self, type): - app.logger.info(request.headers) log = log_parser.get_log_lines(type, log_id=request.args.get('log_id'), blockchain=request.args.get('blockchain')) response = make_response(log, 200) response.mimetype = "plain/text" diff --git a/scripts/pull_3rd_party_libs.sh b/scripts/pull_3rd_party_libs.sh index 31fe21dc..bd95d82c 100755 --- a/scripts/pull_3rd_party_libs.sh +++ b/scripts/pull_3rd_party_libs.sh @@ -33,3 +33,20 @@ rm -f ${BASEPATH}/bsi-icons.zip wget -O ${BASEPATH}/bs.zip -nv "https://github.com/twbs/bootstrap/releases/download/v${BOOTSTRAP_VERSION}/bootstrap-${BOOTSTRAP_VERSION}-dist.zip" && \ unzip -o -j ${BASEPATH}/bs.zip -d $BASEPATH/ bootstrap-${BOOTSTRAP_VERSION}*/css/bootstrap.min.css* bootstrap-${BOOTSTRAP_VERSION}*/js/bootstrap.bundle.min.js* && \ rm -f ${BASEPATH}/bs.zip + +# Pull localization files for DataTables.js +mkdir -p $BASEPATH/i18n/ +LANGS=$(grep -oP "LANGUAGES = \[\K(.*)\]" $BASEPATH/../../default_settings.py | cut -d ']' -f 1 | tr -d \'\" | tr -d ' ') +IFS=','; +for lang in $LANGS; +do + if [[ "$lang" == 'en' ]]; then + continue # No separate translation files for default locale + fi + # First try $lang.json + wget -nv -O ${BASEPATH}/i18n/datatables.${lang}.json https://raw.githubusercontent.com/DataTables/Plugins/master/i18n/${lang}.json + if [ $? != 0 ]; then # Then try $lang_$lang.json (Example French) + echo "Going for ${lang}_${lang}.json" + wget -nv -O ${BASEPATH}/i18n/datatables.${lang}.json https://raw.githubusercontent.com/DataTables/Plugins/master/i18n/${lang}_${lang}.json + fi +done diff --git a/web/actions/worker.py b/web/actions/worker.py index 5a525077..0ea116fb 100644 --- a/web/actions/worker.py +++ b/web/actions/worker.py @@ -125,4 +125,5 @@ def generate_warnings(worker): # TODO - Warning if any blockchain challenges are missing in last hour (some percentage like that chart) # TODO - Warning if worker's time drifts more than 3 minutes off fullnode's WHEN responding with ping seconds ago # TODO - Warning if farmer sync status falls behind while running (at 5 mins, before a later restart is attempted) + # TODO - Warning if fullnode/harvester is not reporting disk stats return warnings \ No newline at end of file diff --git a/web/routes.py b/web/routes.py index bead55cc..082a539e 100644 --- a/web/routes.py +++ b/web/routes.py @@ -71,7 +71,8 @@ def index(): def summary(): gc = globals.load() summaries = chia.load_summaries() - return render_template('summary.html', reload_seconds=120, summaries=summaries, global_config=gc) + return render_template('summary.html', reload_seconds=120, summaries=summaries, global_config=gc, + lang=request.accept_languages.best_match(app.config['LANGUAGES'])) @app.route('/setup', methods=['GET', 'POST']) def setup(): @@ -124,7 +125,7 @@ def plotting_jobs(): plotting = plotman.load_plotting_summary() job_stats = stats.load_plotting_stats() return render_template('plotting/jobs.html', reload_seconds=120, plotting=plotting, - plotters=plotters, job_stats=job_stats, global_config=gc) + plotters=plotters, job_stats=job_stats, global_config=gc, lang=request.accept_languages.best_match(app.config['LANGUAGES'])) @app.route('/plotting/workers', methods=['GET', 'POST']) def plotting_workers(): @@ -158,7 +159,8 @@ def farming_plots(): gc = globals.load() farmers = chia.load_farmers() plots = chia.load_plots_farming() - return render_template('farming/plots.html', farmers=farmers, plots=plots, global_config=gc) + return render_template('farming/plots.html', farmers=farmers, plots=plots, global_config=gc, + lang=request.accept_languages.best_match(app.config['LANGUAGES'])) @app.route('/farming/data') def farming_data(): @@ -198,7 +200,7 @@ def alerts(): farmers = chiadog.load_farmers() notifications = chiadog.get_notifications() return render_template('alerts.html', reload_seconds=120, farmers=farmers, - notifications=notifications, global_config=gc) + notifications=notifications, global_config=gc, lang=request.accept_languages.best_match(app.config['LANGUAGES'])) @app.route('/wallet', methods=['GET', 'POST']) def wallet(): @@ -208,7 +210,8 @@ def wallet(): selected_blockchain = request.form.get('blockchain') chia.save_cold_wallet_addresses(request.form.get('blockchain'), request.form.get('cold_wallet_address')) wallets = chia.load_wallets() - return render_template('wallet.html', wallets=wallets, global_config=gc, selected_blockchain = selected_blockchain, reload_seconds=120) + return render_template('wallet.html', wallets=wallets, global_config=gc, selected_blockchain = selected_blockchain, + reload_seconds=120, lang=request.accept_languages.best_match(app.config['LANGUAGES'])) @app.route('/keys') def keys(): @@ -227,7 +230,7 @@ def workers(): worker.prune_workers_status(request.form.getlist('worker')) wkrs = worker.load_worker_summary() return render_template('workers.html', reload_seconds=120, - workers=wkrs, global_config=gc) + workers=wkrs, global_config=gc, lang=request.accept_languages.best_match(app.config['LANGUAGES'])) @app.route('/worker', methods=['GET']) def worker_route(): @@ -241,7 +244,8 @@ def worker_route(): warnings = worker.generate_warnings(wkr) return render_template('worker.html', worker=wkr, plotting=plotting, plots_disk_usage=plots_disk_usage, - plotting_disk_usage=plotting_disk_usage, warnings=warnings, global_config=gc) + plotting_disk_usage=plotting_disk_usage, warnings=warnings, global_config=gc, + lang=request.accept_languages.best_match(app.config['LANGUAGES'])) @app.route('/blockchains') def blockchains(): @@ -249,7 +253,7 @@ def blockchains(): selected_blockchain = worker.default_blockchain() blockchains = chia.load_blockchains() return render_template('blockchains.html', reload_seconds=120, selected_blockchain = selected_blockchain, - blockchains=blockchains, global_config=gc) + blockchains=blockchains, global_config=gc, lang=request.accept_languages.best_match(app.config['LANGUAGES'])) @app.route('/connections', methods=['GET', 'POST']) def connections(): @@ -265,7 +269,7 @@ def connections(): app.logger.info(_("Unknown form action") + ": {0}".format(request.form)) connections = chia.load_connections() return render_template('connections.html', reload_seconds=120, selected_blockchain = selected_blockchain, - connections=connections, global_config=gc) + connections=connections, global_config=gc, lang=request.accept_languages.best_match(app.config['LANGUAGES'])) @app.route('/settings/plotting', methods=['GET', 'POST']) def settings_plotting(): diff --git a/web/templates/alerts.html b/web/templates/alerts.html index 2b108f46..6c8c3ff3 100644 --- a/web/templates/alerts.html +++ b/web/templates/alerts.html @@ -131,6 +131,11 @@
Expect at least a summary notification once daily as long as running above.< } $(document).ready(function () { $('#data').DataTable({ + {% if lang != 'en' %} + "language": { + "url": "{{ url_for('static', filename='3rd_party/i18n/datatables.'+lang+'.json') }}" + }, + {% endif %} "pageLength": 10, "lengthMenu": [ [10, 25, 50, 100, 200, -1], [10, 25, 50, 100, 200, "All"] ], "columnDefs": [{ "orderable": false, targets: [0] }], diff --git a/web/templates/blockchains.html b/web/templates/blockchains.html index 1348aaea..afc1876e 100644 --- a/web/templates/blockchains.html +++ b/web/templates/blockchains.html @@ -95,6 +95,11 @@
Try running 'chia show --state' on your farmers to verify.
- Machinaris + {{_('Machinaris')}} @@ -20,10 +20,10 @@

- Machinaris Worker + {{_('Machinaris Worker')}}


-

This Machinaris worker is controlled at: {{ controller_url}}

+

{{_('This Machinaris worker is controlled at:')}} {{ controller_url}}

diff --git a/web/templates/keys.html b/web/templates/keys.html index 7ad6ddc5..1a9980fc 100644 --- a/web/templates/keys.html +++ b/web/templates/keys.html @@ -40,8 +40,8 @@
{{ key.details}}



-

NOTE: Machinaris will never display your private key here.

-

However, you may view it yourself by executing this from within the Docker container.

+

{{_('NOTE: Machinaris will never display your private key here.')}}

+

{{_('However, you may view it yourself by executing this from within the Docker container.')}}

{% if key.blockchain == 'mmx' %} mmx wallet get seed @@ -51,15 +51,10 @@

{% if key.blockchain != 'mmx' %} -

Best Practices

+

{{_('Best Practices')}}

    - -
  • Machinaris uses an online wallet for farming. It is strongly recommended that you use a cold wallet - for your payout instructions. Tutorial on the wiki. - Please add "Setup a Cold Wallet" to your To-Do list! +
  • {{_('Machinaris uses an online wallet for farming. It is strongly recommended that you use a cold wallet for your payout instructions. Tutorial on the %(wiki_link_open)swiki%(wiki_link_close). Please add "Setup a Cold Wallet" to your To-Do list!', + wiki_link_open='' wiki_link_close='')}}
{% endif %} @@ -70,8 +65,8 @@

Best Practices

{% else %}
-
No keys found from any farmers. Not added?
-
Try running 'chia keys show' on your farmers to verify.
+
{{_('No keys found from any farmers. Not added?')}}
+
{{_('Try running 'chia keys show' on your farmers to verify.')}}
{% endif %} diff --git a/web/templates/logs.html b/web/templates/logs.html index 6034e4ac..27a77793 100644 --- a/web/templates/logs.html +++ b/web/templates/logs.html @@ -8,7 +8,7 @@ - Machinaris Logs + {{_('Machinaris Logs')}} + +