Add pyblock app
This commit is contained in:
parent
09d4f24411
commit
8245224d55
6
rootfs/standard/usr/bin/mynode-pyblock
Executable file
6
rootfs/standard/usr/bin/mynode-pyblock
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
# mynode-pyblock
|
||||
# This script needs to be run with sudo so it can run as the bitcoin user
|
||||
|
||||
sudo -u bitcoin bash -c "cd /opt/mynode/pyblock/; source env/bin/activate; python3 PyBlock.py"
|
|
@ -824,6 +824,61 @@ if should_install_app "ckbunker" ; then
|
|||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Upgrade Sphinx Relay
|
||||
if should_install_app "sphinxrelay" ; then
|
||||
SPHINXRELAY_UPGRADE_URL=https://github.com/stakwork/sphinx-relay/archive/$SPHINXRELAY_VERSION.tar.gz
|
||||
CURRENT=""
|
||||
if [ -f $SPHINXRELAY_VERSION_FILE ]; then
|
||||
CURRENT=$(cat $SPHINXRELAY_VERSION_FILE)
|
||||
fi
|
||||
if [ "$CURRENT" != "$SPHINXRELAY_VERSION" ]; then
|
||||
cd /opt/mynode
|
||||
rm -rf sphinxrelay
|
||||
|
||||
sudo -u bitcoin wget $SPHINXRELAY_UPGRADE_URL -O sphinx-relay.tar.gz
|
||||
sudo -u bitcoin tar -xvf sphinx-relay.tar.gz
|
||||
sudo -u bitcoin rm sphinx-relay.tar.gz
|
||||
sudo -u bitcoin mv sphinx-relay-* sphinxrelay
|
||||
cd sphinxrelay
|
||||
|
||||
sudo -u bitcoin npm install
|
||||
|
||||
echo $SPHINXRELAY_VERSION > $SPHINXRELAY_VERSION_FILE
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Upgrade pyblock
|
||||
if should_install_app "pyblock" ; then
|
||||
PYBLOCK_UPGRADE_URL=https://github.com/curly60e/pyblock/archive/refs/tags/$PYBLOCK_VERSION.tar.gz
|
||||
CURRENT=""
|
||||
if [ -f $PYBLOCK_VERSION_FILE ]; then
|
||||
CURRENT=$(cat $PYBLOCK_VERSION_FILE)
|
||||
fi
|
||||
if [ "$CURRENT" != "$PYBLOCK_VERSION" ]; then
|
||||
cd /opt/mynode
|
||||
rm -rf pyblock
|
||||
|
||||
sudo -u bitcoin wget $PYBLOCK_UPGRADE_URL -O pyblock.tar.gz
|
||||
sudo -u bitcoin tar -xvf pyblock.tar.gz
|
||||
sudo -u bitcoin rm pyblock.tar.gz
|
||||
sudo -u bitcoin mv pyblock-* pyblock
|
||||
cd pyblock
|
||||
|
||||
# Make venv
|
||||
if [ ! -d env ]; then
|
||||
sudo -u bitcoin python3 -m venv env
|
||||
fi
|
||||
source env/bin/activate
|
||||
pip3 install -r requirements.txt
|
||||
deactivate
|
||||
|
||||
echo $PYBLOCK_VERSION > $PYBLOCK_VERSION_FILE
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Upgrade WARden
|
||||
if should_install_app "warden" ; then
|
||||
WARDEN_UPGRADE_URL=https://github.com/pxsocs/warden/archive/refs/tags/$WARDEN_VERSION.tar.gz
|
||||
|
@ -854,28 +909,7 @@ if should_install_app "warden" ; then
|
|||
fi
|
||||
|
||||
|
||||
# Upgrade Sphinx Relay
|
||||
if should_install_app "sphinxrelay" ; then
|
||||
SPHINXRELAY_UPGRADE_URL=https://github.com/stakwork/sphinx-relay/archive/$SPHINXRELAY_VERSION.tar.gz
|
||||
CURRENT=""
|
||||
if [ -f $SPHINXRELAY_VERSION_FILE ]; then
|
||||
CURRENT=$(cat $SPHINXRELAY_VERSION_FILE)
|
||||
fi
|
||||
if [ "$CURRENT" != "$SPHINXRELAY_VERSION" ]; then
|
||||
cd /opt/mynode
|
||||
rm -rf sphinxrelay
|
||||
|
||||
sudo -u bitcoin wget $SPHINXRELAY_UPGRADE_URL -O sphinx-relay.tar.gz
|
||||
sudo -u bitcoin tar -xvf sphinx-relay.tar.gz
|
||||
sudo -u bitcoin rm sphinx-relay.tar.gz
|
||||
sudo -u bitcoin mv sphinx-relay-* sphinxrelay
|
||||
cd sphinxrelay
|
||||
|
||||
sudo -u bitcoin npm install
|
||||
|
||||
echo $SPHINXRELAY_VERSION > $SPHINXRELAY_VERSION_FILE
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Upgrade Tor
|
||||
|
|
|
@ -793,6 +793,7 @@ echo $LNDCONNECT_VERSION > $LNDCONNECT_LATEST_VERSION_FILE
|
|||
echo $CKBUNKER_VERSION > $CKBUNKER_LATEST_VERSION_FILE
|
||||
echo $SPHINXRELAY_VERSION > $SPHINXRELAY_LATEST_VERSION_FILE
|
||||
echo $WEBSSH2_VERSION > $WEBSSH2_LATEST_VERSION_FILE
|
||||
echo $PYBLOCK_VERSION > $PYBLOCK_LATEST_VERSION_FILE
|
||||
echo $WARDEN_VERSION > $WARDEN_LATEST_VERSION_FILE
|
||||
|
||||
# Weird hacks
|
||||
|
|
|
@ -105,6 +105,10 @@ SPHINXRELAY_VERSION="v2.0.13"
|
|||
SPHINXRELAY_VERSION_FILE=/home/bitcoin/.mynode/sphinxrelay_version
|
||||
SPHINXRELAY_LATEST_VERSION_FILE=/home/bitcoin/.mynode/sphinxrelay_version_latest
|
||||
|
||||
PYBLOCK_VERSION="v0.9.7.3"
|
||||
PYBLOCK_VERSION_FILE=/home/bitcoin/.mynode/pyblock_version
|
||||
PYBLOCK_LATEST_VERSION_FILE=/home/bitcoin/.mynode/pyblock_version_latest
|
||||
|
||||
WARDEN_VERSION="0.91"
|
||||
WARDEN_VERSION_FILE=/home/bitcoin/.mynode/warden_version
|
||||
WARDEN_LATEST_VERSION_FILE=/home/bitcoin/.mynode/warden_version_latest
|
||||
|
|
|
@ -388,6 +388,19 @@ def initialize_applications():
|
|||
homepage_order=41,
|
||||
is_premium=False
|
||||
))
|
||||
apps.append(create_application(
|
||||
name="PyBlock",
|
||||
short_name="pyblock",
|
||||
requires_lightning=True,
|
||||
app_tile_default_status_text="Blockchain Info",
|
||||
app_tile_button_text="Info",
|
||||
app_tile_button_href="/pyblock",
|
||||
can_uninstall=True,
|
||||
can_enable_disable=False,
|
||||
show_on_homepage=True,
|
||||
homepage_order=42,
|
||||
is_premium=False
|
||||
))
|
||||
apps.append(create_application(
|
||||
name="Web SSH",
|
||||
short_name="webssh2",
|
||||
|
@ -558,6 +571,8 @@ def get_application_status_color_special(short_name):
|
|||
return get_lnd_status_color()
|
||||
elif short_name == "joininbox":
|
||||
return "clear"
|
||||
elif short_name == "pyblock":
|
||||
return "clear"
|
||||
elif short_name == "whirlpool":
|
||||
if not os.path.isfile("/mnt/hdd/mynode/whirlpool/whirlpool-cli-config.properties"):
|
||||
return "yellow"
|
||||
|
|
|
@ -9,6 +9,7 @@ from dojo import mynode_dojo
|
|||
from joininbox import mynode_joininbox
|
||||
from caravan import mynode_caravan
|
||||
from sphinxrelay import mynode_sphinxrelay
|
||||
from pyblock import mynode_pyblock
|
||||
from manage_apps import mynode_manage_apps
|
||||
from tor import mynode_tor
|
||||
from vpn import mynode_vpn
|
||||
|
@ -84,6 +85,7 @@ app.register_blueprint(mynode_dojo)
|
|||
app.register_blueprint(mynode_joininbox)
|
||||
app.register_blueprint(mynode_caravan)
|
||||
app.register_blueprint(mynode_sphinxrelay)
|
||||
app.register_blueprint(mynode_pyblock)
|
||||
app.register_blueprint(mynode_manage_apps)
|
||||
app.register_blueprint(mynode_tor)
|
||||
app.register_blueprint(mynode_electrum_server)
|
||||
|
|
23
rootfs/standard/var/www/mynode/pyblock.py
Normal file
23
rootfs/standard/var/www/mynode/pyblock.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from flask import Blueprint, render_template, redirect, request, flash, send_from_directory
|
||||
from user_management import check_logged_in
|
||||
from device_info import read_ui_settings
|
||||
from systemctl_info import *
|
||||
import os
|
||||
import time
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
mynode_pyblock = Blueprint('mynode_pyblock',__name__)
|
||||
|
||||
### Page functions
|
||||
@mynode_pyblock.route("/pyblock")
|
||||
def pyblock_page():
|
||||
check_logged_in()
|
||||
|
||||
# Load page
|
||||
templateData = {
|
||||
"title": "myNode PyBlock",
|
||||
"ui_settings": read_ui_settings(),
|
||||
}
|
||||
return render_template('pyblock.html', **templateData)
|
||||
|
BIN
rootfs/standard/var/www/mynode/static/images/pyblock.png
Normal file
BIN
rootfs/standard/var/www/mynode/static/images/pyblock.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
55
rootfs/standard/var/www/mynode/templates/pyblock.html
Normal file
55
rootfs/standard/var/www/mynode/templates/pyblock.html
Normal file
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE html lang="en">
|
||||
<head>
|
||||
<title>{{ title }}</title>
|
||||
{% include 'includes/head.html' %}
|
||||
</head>
|
||||
<body>
|
||||
{% include 'includes/logo_header.html' %}
|
||||
<div class="mynode_back_div">
|
||||
<a class="ui-button ui-widget ui-corner-all mynode_back" href="/"><span class="ui-icon ui-icon-home"></span>home </a>
|
||||
</div>
|
||||
|
||||
{% include 'includes/message_display.html' %}
|
||||
|
||||
<div class="main_header">PyBlock</div>
|
||||
<br/>
|
||||
|
||||
<div class="app_tile_row">
|
||||
<div class="info_tile">
|
||||
<div class="info_tile_header">Status</div>
|
||||
<div class="info_tile_contents">Ready</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="instructions">
|
||||
<div class="instructions-header">Instructions to setup PyBlock</div>
|
||||
<ol class="instructions-steps">
|
||||
<li>PyBlock is a tool for viewing and interacting with your node.</li>
|
||||
<li>To get started, you need access to the Linux terminal of your myNode device.</li>
|
||||
<ul>
|
||||
<li>A guide to access the Linux terminal is available on mynodebtc.com - <a href="https://mynodebtc.com/guide/debug_access_linux_terminal" target="_blank">guide</a></li>
|
||||
</ul>
|
||||
<li>Once you have terminal access, run the following command:</li>
|
||||
<ul>
|
||||
<li><pre>sudo mynode-pyblock</pre></li>
|
||||
</ul>
|
||||
<li>Enter your myNode password when prompted.</li>
|
||||
<li>The first time running PyBlock, you will be prompted for various node information.</li>
|
||||
<ul>
|
||||
<li>For more information on filling it out, see the PyBlock <a href="https://github.com/curly60e/pyblock" target="_blank">GitHub page</a>.</li>
|
||||
</ul>
|
||||
<li>Enjoy PyBlock!</li>
|
||||
</ol>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<!--
|
||||
<div class="instructions-header">Tips and Notes</div>
|
||||
<ul style="font-size: 12px;">
|
||||
<li>Add tips and notes</li>
|
||||
</ul>
|
||||
-->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -868,6 +868,10 @@ if [ "$CURRENT" != "$SPHINXRELAY_VERSION" ]; then
|
|||
fi
|
||||
|
||||
|
||||
# SKIPPING PYBLOCK - OPTIONAL APP
|
||||
# SKIPPING WARDEN - OPTIONAL APP
|
||||
|
||||
|
||||
# Make sure we are using legacy iptables
|
||||
update-alternatives --set iptables /usr/sbin/iptables-legacy || true
|
||||
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy || true
|
||||
|
|
Loading…
Reference in New Issue
Block a user