Add electrs data size to electrum server page

This commit is contained in:
Taylor Helsper 2021-09-24 21:16:00 -05:00
parent 38425ed226
commit 5f4375d617
3 changed files with 17 additions and 1 deletions

View File

@ -81,6 +81,16 @@ def get_electrs_status():
return "Running"
return ""
def get_electrs_db_size(is_testnet=False):
size = "Unknown"
try:
folder = "/mnt/hdd/mynode/electrs/mainnet"
if is_testnet:
folder = "/mnt/hdd/mynode/electrs/testnet"
size = subprocess.check_output("du -h "+folder+" | head -n1 | awk '{print $1;}'", shell=True)
except Exception as e:
size = "Error"
return size
def get_from_electrum(method, params=[]):
params = [params] if type(params) is not list else params

View File

@ -2,7 +2,7 @@ from flask import Blueprint, render_template, session, abort, Markup, request, r
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from pprint import pprint, pformat
from bitcoin_info import *
from device_info import get_local_ip, skipped_product_key, get_onion_url_electrs, read_ui_settings, restart_electrs
from device_info import get_local_ip, skipped_product_key, get_onion_url_electrs, read_ui_settings, restart_electrs, is_testnet_enabled
from user_management import check_logged_in
from electrum_info import *
import json
@ -24,6 +24,7 @@ def electrum_server_page():
if current_block == None:
current_block = "Unknown"
status = get_electrs_status()
db_size = get_electrs_db_size( is_testnet_enabled() )
#server_url = get_local_ip() + ":50002:s"
server_ip = get_local_ip()
@ -43,6 +44,7 @@ def electrum_server_page():
"title": "myNode Electrum Server",
"port": 50002,
"status": status,
"db_size": db_size,
"product_key_skipped": skipped_product_key(),
"current_block": current_block,
#"server_url": server_url,

View File

@ -29,6 +29,10 @@
<th>Current Block</th>
<td>{{current_block}}</td>
</tr>
<tr>
<th>Size</th>
<td>{{db_size}}</td>
</tr>
<tr>
<th>Actions</th>
<td><a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 100px;" href="/restart-electrs">Restart</a></td>