Add Specter; Add beta apps section

This commit is contained in:
Taylor Helsper 2020-07-07 22:13:01 -05:00
parent 5ed0f49100
commit 8fa9eb2816
16 changed files with 211 additions and 2 deletions

View File

@ -1,5 +1,5 @@
# RTL service
# /etc/systemd/system/rtl.service
# LNBits service
# /etc/systemd/system/lnbits.service
[Unit]
Description=LNBits
@ -9,6 +9,7 @@ After=bitcoind.service lnd.service
[Service]
ExecStartPre=/usr/bin/is_not_shutting_down.sh
ExecStartPre=/usr/bin/wait_on_lnd.sh
ExecStartPre=/usr/bin/mynode_pre_lnbits.sh
ExecStartPre=/bin/sh -c 'cd /opt/mynode/lnbits && /usr/local/bin/pipenv run flask migrate'
Environment=FLASK_ENV=development
WorkingDirectory=/opt/mynode/lnbits

View File

@ -0,0 +1,32 @@
# Specter service
# /etc/systemd/system/specter.service
[Unit]
Description=Specter
Wants=bitcoind.service lnd.service
After=bitcoind.service lnd.service
[Service]
ExecStartPre=/usr/bin/is_not_shutting_down.sh
ExecStartPre=/usr/bin/wait_on_lnd.sh
ExecStartPre=/usr/bin/mynode_gen_cert.sh specter 825
#ExecStartPre=/usr/bin/mynode_pre_specter.sh
WorkingDirectory=/opt/mynode/specter
ExecStart=/opt/mynode/specter/env/bin/python3 -m cryptoadvance.specter server --host 0.0.0.0 --cert=/mnt/hdd/mynode/settings/specter/myNode.local.crt --key=/mnt/hdd/mynode/settings/specter/myNode.local.key
Environment=PATH=/opt/mynode/specter/env/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin:/bin
User=bitcoin
Group=bitcoin
Type=simple
TimeoutSec=120
Restart=always
RestartSec=30
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=specter
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
# HW.1 / Nano
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="1b7c|2b7c|3b7c|4b7c", TAG+="uaccess", TAG+="udev-acl"
# Blue
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0000|0000|0001|0002|0003|0004|0005|0006|0007|0008|0009|000a|000b|000c|000d|000e|000f|0010|0011|0012|0013|0014|0015|0016|0017|0018|0019|001a|001b|001c|001d|001e|001f", TAG+="uaccess", TAG+="udev-acl"
# Nano S
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0001|1000|1001|1002|1003|1004|1005|1006|1007|1008|1009|100a|100b|100c|100d|100e|100f|1010|1011|1012|1013|1014|1015|1016|1017|1018|1019|101a|101b|101c|101d|101e|101f", TAG+="uaccess", TAG+="udev-acl"
# Aramis
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0002|2000|2001|2002|2003|2004|2005|2006|2007|2008|2009|200a|200b|200c|200d|200e|200f|2010|2011|2012|2013|2014|2015|2016|2017|2018|2019|201a|201b|201c|201d|201e|201f", TAG+="uaccess", TAG+="udev-acl"
# HW2
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0003|3000|3001|3002|3003|3004|3005|3006|3007|3008|3009|300a|300b|300c|300d|300e|300f|3010|3011|3012|3013|3014|3015|3016|3017|3018|3019|301a|301b|301c|301d|301e|301f", TAG+="uaccess", TAG+="udev-acl"
# Nano X
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", ATTRS{idProduct}=="0004|4000|4001|4002|4003|4004|4005|4006|4007|4008|4009|400a|400b|400c|400d|400e|400f|4010|4011|4012|4013|4014|4015|4016|4017|4018|4019|401a|401b|401c|401d|401e|401f", TAG+="uaccess", TAG+="udev-acl"

View File

@ -0,0 +1,15 @@
# Linux udev support file.
#
# This is a example udev file for HIDAPI devices which changes the permissions
# to 0666 (world readable/writable) for a specific device on Linux systems.
#
# - Copy this file into /etc/udev/rules.d and unplug and re-plug your Coldcard.
# - Udev does not have to be restarted.
#
# probably not needed:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="d13e", ATTRS{idProduct}=="cc10", GROUP="plugdev", MODE="0666"
# required:
# from <https://github.com/signal11/hidapi/blob/master/udev/99-hid.rules>
KERNEL=="hidraw*", ATTRS{idVendor}=="d13e", ATTRS{idProduct}=="cc10", GROUP="plugdev", MODE="0666"

View File

@ -0,0 +1,17 @@
# Trezor: The Original Hardware Wallet
# https://trezor.io/
#
# Put this file into /etc/udev/rules.d
#
# If you are creating a distribution package,
# put this into /usr/lib/udev/rules.d or /lib/udev/rules.d
# depending on your distribution
# Trezor
SUBSYSTEM=="usb", ATTR{idVendor}=="534c", ATTR{idProduct}=="0001", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="trezor%n"
KERNEL=="hidraw*", ATTRS{idVendor}=="534c", ATTRS{idProduct}=="0001", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"
# Trezor v2
SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="53c0", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="trezor%n"
SUBSYSTEM=="usb", ATTR{idVendor}=="1209", ATTR{idProduct}=="53c1", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="trezor%n"
KERNEL=="hidraw*", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="53c1", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"

View File

@ -0,0 +1,11 @@
# KeepKey: Your Private Bitcoin Vault
# http://www.keepkey.com/
# Put this file into /usr/lib/udev/rules.d or /etc/udev/rules.d
# KeepKey HID Firmware/Bootloader
SUBSYSTEM=="usb", ATTR{idVendor}=="2b24", ATTR{idProduct}=="0001", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="keepkey%n"
KERNEL=="hidraw*", ATTRS{idVendor}=="2b24", ATTRS{idProduct}=="0001", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"
# KeepKey WebUSB Firmware/Bootloader
SUBSYSTEM=="usb", ATTR{idVendor}=="2b24", ATTR{idProduct}=="0002", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl", SYMLINK+="keepkey%n"
KERNEL=="hidraw*", ATTRS{idVendor}=="2b24", ATTRS{idProduct}=="0002", MODE="0666", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl"

View File

@ -45,6 +45,7 @@ ufw allow 56881 comment 'allow myNode QuickSync'
ufw allow 51413 comment 'allow myNode QuickSync'
ufw allow 6771 comment 'allow myNode QuickSync (LPD)'
ufw allow 19999 comment 'allow Netdata'
ufw allow 25441 comment 'allow Specter Desktop'
ufw allow 49392 comment 'allow BTCPay Server-direct'
ufw allow 51194 comment 'allow VPN'
ufw allow 61208 comment 'allow Glances'

View File

@ -488,6 +488,31 @@ if [ "$CURRENT" != "$LNBITS_UPGRADE_URL" ]; then
fi
# Upgrade Specter Desktop
SPECTER_UPGRADE_VERSION=0.5.2
SPECTER_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.spectre_url
CURRENT=""
if [ -f $SPECTER_UPGRADE_URL_FILE ]; then
CURRENT=$(cat $SPECTER_UPGRADE_URL_FILE)
fi
if [ "$CURRENT" != "$SPECTER_UPGRADE_VERSION" ]; then
cd /opt/mynode
mkdir -p specter
cd specter
# Make venv
if [ ! -d env ]; then
sudo -u bitcoin python3 -m venv env
fi
source env/bin/activate
pip3 install ecdsa===0.14.1
pip3 install cryptoadvance.specter===$SPECTER_UPGRADE_VERSION --upgrade
deactivate
echo $SPECTER_UPGRADE_VERSION > $SPECTER_UPGRADE_URL_FILE
fi
# Install LND Connect
LNDCONNECTARCH="lndconnect-linux-armv7"
if [ $IS_X86 = 1 ]; then

View File

@ -0,0 +1,15 @@
#!/bin/bash
source /usr/share/mynode/mynode_config.sh
set -x
# Generate hex macaroons
macaroonAdminHex=$(xxd -ps -u -c 1000 /mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/admin.macaroon)
macaroonInvoiceHex=$(xxd -ps -u -c 1000 /mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/invoice.macaroon)
macaroonReadHex=$(xxd -ps -u -c 1000 /mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/readonly.macaroon)
# Update env file
sed -i "s/^LND_REST_ADMIN_MACAROON=.*/LND_REST_ADMIN_MACAROON=${macaroonAdminHex}/g" /opt/mynode/lnbits/.env
sed -i "s/^LND_REST_INVOICE_MACAROON=.*/LND_REST_INVOICE_MACAROON=${macaroonInvoiceHex}/g" /opt/mynode/lnbits/.env
sed -i "s/^LND_REST_READ_MACAROON=.*/LND_REST_READ_MACAROON=${macaroonReadHex}/g" /opt/mynode/lnbits/.env

View File

@ -257,6 +257,12 @@ if [ -d /opt/mynode/lnbits ]; then
chown bitcoin:bitcoin /opt/mynode/lnbits/.env
fi
# Setup udev
chown root:root /etc/udev/rules.d/* || true
udevadm trigger
udevadm control --reload-rules
groupadd plugdev || true
sudo usermod -aG plugdev bitcoin
# Update files that need RPC password (needed if upgrades overwrite files)
PW=$(cat /mnt/hdd/mynode/settings/.btcrpcpw)

View File

@ -123,6 +123,18 @@ def disable_caravan():
os.system("systemctl disable caravan --no-pager")
def is_specter_enabled():
return is_service_enabled("specter")
def enable_specter():
os.system("systemctl enable specter --no-pager")
os.system("systemctl start specter --no-pager")
def disable_specter():
os.system("systemctl stop specter --no-pager")
os.system("systemctl disable specter --no-pager")
def is_vpn_enabled():
if os.path.isfile(VPN_ENABLED_FILE):
return True

View File

@ -473,6 +473,13 @@ def index():
caravan_ready = True
caravan_status = "Running"
# Find caravan status
specter_status = ""
specter_status_color = "gray"
if is_specter_enabled():
specter_status_color = get_service_status_color("specter")
specter_status = "Running"
# Check for new version of software
upgrade_available = False
current = get_current_version()
@ -516,6 +523,9 @@ def index():
"caravan_status_color": caravan_status_color,
"caravan_status": caravan_status,
"caravan_enabled": is_caravan_enabled(),
"specter_status_color": specter_status_color,
"specter_status": specter_status,
"specter_enabled": is_specter_enabled(),
"mempoolspace_status_color": mempoolspace_status_color,
"mempoolspace_status": mempoolspace_status,
"mempoolspace_enabled": is_mempoolspace_enabled(),
@ -669,6 +679,15 @@ def page_toggle_caravan():
enable_caravan()
return redirect("/")
@app.route("/toggle-specter")
def page_toggle_specter():
check_logged_in()
if is_specter_enabled():
disable_specter()
else:
enable_specter()
return redirect("/")
@app.route("/toggle-vpn")
def page_toggle_vpn():
check_logged_in()

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="136px" height="183px" viewBox="0 0 136 183" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 52.6 (67491) - http://www.bohemiancoding.com/sketch -->
<title>Group 2</title>
<desc>Created with Sketch.</desc>
<g id="Page-2" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group-2" transform="translate(56.301537, 101.210101) rotate(70.000000) translate(-56.301537, -101.210101) translate(-37.698463, 21.710101)">
<path d="M119.379895,40.6029336 C114.608986,25.846267 101.692623,15.2696003 86.5071681,15.2696003 C67.2489863,15.2696003 51.5980772,32.306267 51.5980772,53.2696003 C51.5980772,74.2329336 67.2489863,91.2696003 86.5071681,91.2696003 C101.692623,91.2696003 114.608986,80.6929336 119.379895,65.936267 L144.688986,65.936267 L144.688986,91.2696003 L167.961714,91.2696003 L167.961714,65.936267 L179.598077,65.936267 L179.598077,40.6029336 L119.379895,40.6029336 Z M86.5071681,65.936267 C80.1071681,65.936267 74.8708045,60.236267 74.8708045,53.2696003 C74.8708045,46.3029336 80.1071681,40.6029336 86.5071681,40.6029336 C92.9071681,40.6029336 98.1435318,46.3029336 98.1435318,53.2696003 C98.1435318,60.236267 92.9071681,65.936267 86.5071681,65.936267 Z" id="Shape" fill-opacity="0.53" fill="#FFFFFF" fill-rule="nonzero" transform="translate(115.598077, 53.269600) rotate(-15.000000) translate(-115.598077, -53.269600) "></path>
<path d="M109.318138,82.5452222 C104.547229,67.7885555 91.6308655,57.2118888 76.445411,57.2118888 C57.1872292,57.2118888 41.5363201,74.2485555 41.5363201,95.2118888 C41.5363201,116.175222 57.1872292,133.211889 76.445411,133.211889 C91.6308655,133.211889 104.547229,122.635222 109.318138,107.878555 L134.627229,107.878555 L134.627229,133.211889 L157.899956,133.211889 L157.899956,107.878555 L169.53632,107.878555 L169.53632,82.5452222 L109.318138,82.5452222 Z M76.445411,107.878555 C70.045411,107.878555 64.8090473,102.178555 64.8090473,95.2118888 C64.8090473,88.2452222 70.045411,82.5452222 76.445411,82.5452222 C82.845411,82.5452222 88.0817746,88.2452222 88.0817746,95.2118888 C88.0817746,102.178555 82.845411,107.878555 76.445411,107.878555 Z" id="Shape" fill="#FFFFFF" fill-rule="nonzero" transform="translate(105.536320, 95.211889) rotate(28.000000) translate(-105.536320, -95.211889) "></path>
<circle id="Oval" stroke="#FFFFFF" stroke-width="10" cx="42" cy="64" r="42"></circle>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -142,6 +142,7 @@
</div>
</div>
<div class="main_header">Beta Apps</div>
<div class="app_tile_row">
<div class="app_tile">
<div class="app_status_icon {{ caravan_status_color }}"></div>
@ -163,6 +164,26 @@
{% endif %}
</div>
</div>
<div class="app_tile">
<div class="app_status_icon {{ specter_status_color }}"></div>
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/specter.png")}}"/></div>
<div class="app_title">Specter</div>
<div class="app_status">{{ specter_status }}</div>
<div class="app_contents">
{% if product_key_skipped %}
Premium Feature
{% else %}
{% if specter_enabled %}
{% if btcrpcexplorer_ready %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="specter">Specter</a>
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="toggle-specter">Disable</a>
{% endif %}
{% else %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="toggle-specter">Enable</a>
{% endif %}
{% endif %}
</div>
</div>
<div class="app_tile">
<div class="app_status_icon {{ lnbits_status_color }}"></div>
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/lnbits.png")}}"/></div>

View File

@ -38,6 +38,11 @@
window.open(url,'_blank');
})
$("#specter").on("click", function() {
url = 'https://'+location.hostname+':25441'
window.open(url,'_blank');
})
$("#mempoolspace").on("click", function() {
url = 'http://'+location.hostname+':4080'
window.open(url,'_blank');
@ -108,6 +113,10 @@
window.location.href="/toggle-caravan"
});
$("#toggle-specter").on("click", function() {
window.location.href="/toggle-specter"
});
$("#toggle-lnbits").on("click", function() {
window.location.href="/toggle-lnbits"
});