diff --git a/rootfs/standard/var/www/mynode/lightning_info.py b/rootfs/standard/var/www/mynode/lightning_info.py
index c52d4f46..6587df3e 100644
--- a/rootfs/standard/var/www/mynode/lightning_info.py
+++ b/rootfs/standard/var/www/mynode/lightning_info.py
@@ -69,12 +69,12 @@ def update_lightning_info():
return True
-def get_deposit_address():
+def get_lnd_deposit_address():
if os.path.isfile("/tmp/lnd_deposit_address"):
return get_file_contents("/tmp/lnd_deposit_address")
- return get_new_deposit_address()
+ return get_new_lnd_deposit_address()
-def get_new_deposit_address():
+def get_new_lnd_deposit_address():
address = "NEW_ADDR"
try:
addressdata = lnd_get("/newaddress")
@@ -91,7 +91,31 @@ def get_lightning_info():
def get_lightning_peers():
global lightning_peers
- return copy.deepcopy(lightning_peers)
+ peerdata = copy.deepcopy(lightning_peers)
+ peers = []
+ if peerdata != None and "peers" in peerdata:
+ for p in peerdata["peers"]:
+ peer = p
+ if "bytes_recv" in p:
+ peer["bytes_recv"] = "{:.2f}".format(float(p["bytes_recv"]) / 1000 / 1000)
+ else:
+ peer["bytes_recv"] = "N/A"
+ if "bytes_sent" in p:
+ peer["bytes_sent"] = "{:.2f}".format(float(p["bytes_sent"]) / 1000 / 1000)
+ else:
+ peer["bytes_sent"] = "N/A"
+ if "sat_sent" in p:
+ peer["sat_sent"] = format_sat_amount(peer["sat_sent"])
+ if "sat_recv" in p:
+ peer["sat_recv"] = format_sat_amount(peer["sat_recv"])
+ if "ping_time" not in p:
+ peer["ping_time"] = "N/A"
+ if "pub_key" in p:
+ peer["alias"] = get_lightning_peer_alias( p["pub_key"] )
+ else:
+ peer["alias"] = "Unknown"
+ peers.append(peer)
+ return peers
def get_lightning_node_info(pubkey):
nodeinfo = lnd_get("/graph/node/{}".format(pubkey), timeout=2)
@@ -118,13 +142,40 @@ def get_lightning_peer_count():
def get_lightning_channels():
global lightning_channels
- return copy.deepcopy(lightning_channels)
+ channeldata = copy.deepcopy(lightning_channels)
+ channels = []
+ if channeldata != None and "channels" in channeldata:
+ for c in channeldata["channels"]:
+ channel = c
+
+ if "capacity" in channel:
+ channel["capacity"] = format_sat_amount(channel["capacity"])
+ else:
+ channel["capacity"] = "N/A"
+ if "local_balance" in channel and "remote_balance" in channel:
+ l = float(channel["local_balance"])
+ r = float(channel["remote_balance"])
+ channel["chan_percent"] = (l / (l+r)) * 100
+ else:
+ channel["chan_percent"] = "0"
+ if "local_balance" in channel:
+ channel["local_balance"] = format_sat_amount(channel["local_balance"])
+ else:
+ channel["local_balance"] = "0"
+ if "remote_balance" in channel:
+ channel["remote_balance"] = format_sat_amount(channel["remote_balance"])
+ else:
+ channel["remote_balance"] = "0"
+ if "remote_pubkey" in channel:
+ channel["remote_alias"] = get_lightning_peer_alias( channel["remote_pubkey"] )
+ else:
+ channel["remote_alias"] = "Unknown"
+ channels.append(channel)
+ return channels
def get_lightning_channel_count():
- channeldata = get_lightning_channels()
- if channeldata != None and "channels" in channeldata:
- return len(channeldata["channels"])
- return 0
+ channels = get_lightning_channels()
+ return len(channels)
def get_lightning_channel_balance():
global lightning_channel_balance
diff --git a/rootfs/standard/var/www/mynode/lnd.py b/rootfs/standard/var/www/mynode/lnd.py
index 44ed1c18..ad032240 100644
--- a/rootfs/standard/var/www/mynode/lnd.py
+++ b/rootfs/standard/var/www/mynode/lnd.py
@@ -53,7 +53,7 @@ def page_lnd():
uri = ""
ip = ""
status = "Starting..."
- lnd_deposit_address = get_deposit_address()
+ lnd_deposit_address = get_lnd_deposit_address()
channel_balance = "N/A"
channel_pending = "0"
wallet_balance = "N/A"
@@ -110,52 +110,8 @@ def page_lnd():
uri = "..."
ip = "..."
- peerdata = get_lightning_peers()
- peers = []
- if peerdata != None and "peers" in peerdata:
- for p in peerdata["peers"]:
- peer = p
- if "bytes_recv" in p:
- peer["bytes_recv"] = "{:.2f}".format(float(p["bytes_recv"]) / 1000 / 1000)
- else:
- peer["bytes_recv"] = "N/A"
- if "bytes_sent" in p:
- peer["bytes_sent"] = "{:.2f}".format(float(p["bytes_sent"]) / 1000 / 1000)
- else:
- peer["bytes_sent"] = "N/A"
- if "sat_sent" in p:
- peer["sat_sent"] = format_sat_amount(peer["sat_sent"])
- if "sat_recv" in p:
- peer["sat_recv"] = format_sat_amount(peer["sat_recv"])
- if "ping_time" not in p:
- peer["ping_time"] = "N/A"
- if "pub_key" in p:
- peer["alias"] = get_lightning_peer_alias( p["pub_key"] )
- else:
- peer["alias"] = "Unknown"
- peers.append(peer)
-
- channeldata = get_lightning_channels()
- channels = []
- if channeldata != None and "channels" in channeldata:
- for c in channeldata["channels"]:
- channel = c
- if "capacity" in channel:
- channel["capacity"] = format_sat_amount(channel["capacity"])
- if "local_balance" not in channel:
- channel["local_balance"] = "0"
- else:
- channel["local_balance"] = format_sat_amount(channel["local_balance"])
- if "remote_balance" not in channel:
- channel["remote_balance"] = "0"
- else:
- channel["remote_balance"] = format_sat_amount(channel["remote_balance"])
- if "remote_pubkey" in channel:
- channel["remote_alias"] = get_lightning_peer_alias( channel["remote_pubkey"] )
- else:
- channel["remote_alias"] = "Unknown"
- channels.append(channel)
-
+ peers = get_lightning_peers()
+ channels = get_lightning_channels()
balance_info = get_lightning_balance_info()
channel_balance_data = get_lightning_channel_balance()
@@ -488,9 +444,9 @@ def lnd_config_page():
##############################################
## LND API Calls
##############################################
-@mynode_lnd.route("/lnd/api/get_new_deposit_address", methods=['GET'])
-def lnd_api_get_new_deposit_address_page():
+@mynode_lnd.route("/lnd/api/get_new_lnd_deposit_address", methods=['GET'])
+def lnd_api_get_new_lnd_deposit_address_page():
check_logged_in()
- address = get_new_deposit_address()
+ address = get_new_lnd_deposit_address()
return address
\ No newline at end of file
diff --git a/rootfs/standard/var/www/mynode/mynode.py b/rootfs/standard/var/www/mynode/mynode.py
index a903a1a9..470788f3 100644
--- a/rootfs/standard/var/www/mynode/mynode.py
+++ b/rootfs/standard/var/www/mynode/mynode.py
@@ -556,6 +556,8 @@ def index():
"lnd_balance_info": get_lightning_balance_info(),
"lnd_wallet_exists": lnd_wallet_exists(),
"lnd_version": get_lnd_version(),
+ "lnd_deposit_address": get_lnd_deposit_address(),
+ "lnd_channels": get_lightning_channels(),
"is_testnet_enabled": is_testnet_enabled(),
"tor_status_color": tor_status_color,
"tor_status": tor_status,
diff --git a/rootfs/standard/var/www/mynode/static/css/mynode.css b/rootfs/standard/var/www/mynode/static/css/mynode.css
index eb76ae8b..f135606c 100644
--- a/rootfs/standard/var/www/mynode/static/css/mynode.css
+++ b/rootfs/standard/var/www/mynode/static/css/mynode.css
@@ -290,6 +290,28 @@ td, th {
width: 100%;
}
+.lightning_channel {
+ display: inline-block;
+ width: 100%;
+ margin-bottom: 20px;
+}
+.lightning_channel_bar {
+ margin: auto;
+}
+.lightning_channel_bar_label_left {
+ font-size: 12px;
+ float: left;
+}
+.lightning_channel_bar_label_right {
+ font-size: 12px;
+ float: right;}
+.lightning_channel_bar.ui-progressbar {
+ background: orange;
+}
+.lightning_channel_bar .ui-progressbar-value {
+ background: green;
+}
+
.green { background-color: green; }
.yellow { background-color: yellow; }
diff --git a/rootfs/standard/var/www/mynode/templates/includes/services.html b/rootfs/standard/var/www/mynode/templates/includes/services.html
index a6ab0623..2bced6d2 100644
--- a/rootfs/standard/var/www/mynode/templates/includes/services.html
+++ b/rootfs/standard/var/www/mynode/templates/includes/services.html
@@ -86,9 +86,10 @@
-
+ {% endif %}
@@ -160,17 +161,35 @@