Add lndmanage tile, make optional app

This commit is contained in:
Taylor Helsper 2021-11-19 14:47:04 -06:00
parent 0e212b9b18
commit 1f74ae67c7
9 changed files with 107 additions and 12 deletions

View File

@ -216,9 +216,10 @@ if ! skip_base_upgrades ; then
fi
# Install LNDManage
pip3 install lndmanage==$LNDMANAGE_VERSION --no-cache-dir
echo $LNDMANAGE_VERSION > $LNDMANAGE_VERSION_FILE
if should_install_app "lndmanage" ; then
pip3 install lndmanage==$LNDMANAGE_VERSION --no-cache-dir
echo $LNDMANAGE_VERSION > $LNDMANAGE_VERSION_FILE
fi
# Upgrade BTC
echo "Upgrading BTC..."

View File

@ -62,6 +62,8 @@ elif [ "$APP" = "dojo" ]; then
cd ~
rm -rf /opt/download/dojo
rm -rf /mnt/hdd/mynode/dojo
elif [ "$APP" = "lndmanage" ]; then
pip3 uninstall -y lndmanage
else
echo "No custom re-install steps"
fi

View File

@ -47,6 +47,8 @@ elif [ "$APP" = "joininbox" ]; then
rm -rf /home/joinmarket/.cache
elif [ "$APP" = "lndhub" ]; then
rm -rf /opt/mynode/LndHub
elif [ "$APP" = "lndmanage" ]; then
pip3 uninstall -y lndmanage
elif [ "$APP" = "rtl" ]; then
rm -rf /opt/mynode/RTL
else

View File

@ -89,7 +89,16 @@
},
{
"name": "LNDManage",
"short_name": "lndmanage"
"short_name": "lndmanage",
"requires_lightning": true,
"hide_status_icon": true,
"app_tile_default_status_text": "Lightning Utility",
"app_tile_button_href": "/lndmanage",
"app_tile_button_text": "Info",
"can_uninstall": true,
"can_enable_disable": false,
"show_on_homepage": true,
"homepage_order": 44
},
{
"name": "BTC RPC Explorer",
@ -131,6 +140,7 @@
{
"name": "JoininBox",
"short_name": "joininbox",
"hide_status_icon": true,
"app_tile_button_text": "Info",
"app_tile_button_href": "/joininbox",
"app_tile_default_status_text": "JoinMarket Mixing",
@ -230,6 +240,7 @@
"name": "PyBlock",
"short_name": "pyblock",
"requires_lightning": true,
"hide_status_icon": true,
"app_tile_default_status_text": "Blockchain Info",
"app_tile_button_href": "/pyblock",
"app_tile_button_text": "Info",
@ -242,6 +253,7 @@
"name": "Balance of Satoshis",
"short_name": "bos",
"requires_lightning": true,
"hide_status_icon": true,
"app_tile_default_status_text": "Lightning Utility",
"app_tile_button_href": "/bos",
"app_tile_button_text": "Info",

View File

@ -121,6 +121,7 @@ def initialize_application_defaults(app):
if not "is_enabled" in app: app["is_enabled"] = is_service_enabled( app["short_name"] )
#app["status"] = status # Should status be optional to include? Takes lots of time.
#app["status_color"] = get_service_status_color(short_name)
if not "hide_status_icon" in app: app["hide_status_icon"] = False
if not "log_file" in app: app["log_file"] = get_application_log_file( app["short_name"] )
if not "journalctl_log_name" in app: app["journalctl_log_name"] = None
if not "homepage_order" in app: app["homepage_order"] = 9999
@ -299,12 +300,6 @@ def get_application_status(short_name):
def get_application_status_color_special(short_name):
if short_name == "lnd":
return get_lnd_status_color()
elif short_name == "bos":
return "clear"
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"
@ -325,6 +320,10 @@ def get_application_status_color(short_name):
# Get application
app = get_application(short_name)
# Check hidden icon
if app["hide_status_icon"]:
return "clear"
# Check Disabled, Testnet, Lightning, Electrum requirements...
if is_testnet_enabled() and not app["supports_testnet"]:
return "gray"

View 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_lndmanage = Blueprint('mynode_lndmanage',__name__)
### Page functions
@mynode_lndmanage.route("/lndmanage")
def bos_page():
check_logged_in()
# Load page
templateData = {
"title": "myNode lndmanage",
"ui_settings": read_ui_settings(),
}
return render_template('lndmanage.html', **templateData)

View File

@ -11,6 +11,7 @@ from caravan import mynode_caravan
from sphinxrelay import mynode_sphinxrelay
from pyblock import mynode_pyblock
from bos import mynode_bos
from lndmanage import mynode_lndmanage
from manage_apps import mynode_manage_apps
from tor import mynode_tor
from vpn import mynode_vpn
@ -88,6 +89,7 @@ app.register_blueprint(mynode_caravan)
app.register_blueprint(mynode_sphinxrelay)
app.register_blueprint(mynode_pyblock)
app.register_blueprint(mynode_bos)
app.register_blueprint(mynode_lndmanage)
app.register_blueprint(mynode_manage_apps)
app.register_blueprint(mynode_tor)
app.register_blueprint(mynode_electrum_server)

View 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&nbsp;</a>
</div>
{% include 'includes/message_display.html' %}
<div class="main_header">LNDManage</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 run lndmanage</div>
<ol class="instructions-steps">
<li>lndmanage is an advanced channel management tool for lnd.</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 here - <a href="https://mynodebtc.github.io/advanced/linux-terminal.html" target="_blank">guide</a></li>
</ul>
<li>Once you have terminal access, run commands starting with 'lndmanage'. For example:</li>
<ul>
<li><pre>lndmanage status</pre></li>
<li><pre>lndmanage listchannels</pre></li>
<li><pre>lndmanage rebalance ...</pre></li>
<li><pre>lndmanage circle ...</pre></li>
</ul>
<li>Enjoy lndmanage!</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>
{% include 'includes/footer.html' %}
</body>
</html>

View File

@ -282,8 +282,7 @@ rm -rf /etc/motd
rm -rf /etc/update-motd.d/*
# Install LNDManage
pip3 install lndmanage==$LNDMANAGE_VERSION
echo $LNDMANAGE_VERSION > $LNDMANAGE_VERSION_FILE
# - skip, not default app
#########################################################