diff --git a/rootfs/standard/var/www/mynode/device_info.py b/rootfs/standard/var/www/mynode/device_info.py index 49b64ba5..b17df391 100644 --- a/rootfs/standard/var/www/mynode/device_info.py +++ b/rootfs/standard/var/www/mynode/device_info.py @@ -2,6 +2,9 @@ from config import * import os import subprocess +# Globals +local_ip = "unknown" + # Functions def get_current_version(): current_version = "0.0" @@ -105,4 +108,16 @@ def save_product_key(product_key): def delete_product_key_error(): os.system("rm -rf /home/bitcoin/.mynode/.product_key_error") os.system("rm -rf /mnt/hdd/mynode/settings/.product_key_error") - \ No newline at end of file + + +def get_local_ip(): + global local_ip + if local_ip == "unknown" or local_ip == "error": + try: + result = subprocess.check_output('hostname -I', shell=True) + ips = result.split() + local_ip = ips[0] + except Exception as e: + local_ip = "error" + + return local_ip \ No newline at end of file diff --git a/rootfs/standard/var/www/mynode/electrum_server.py b/rootfs/standard/var/www/mynode/electrum_server.py index db205acf..f751f684 100644 --- a/rootfs/standard/var/www/mynode/electrum_server.py +++ b/rootfs/standard/var/www/mynode/electrum_server.py @@ -3,6 +3,7 @@ from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException from pprint import pprint, pformat from prometheus_client.parser import text_string_to_metric_families from bitcoin_info import * +from device_info import get_local_ip import requests import json import time @@ -86,11 +87,14 @@ def electrum_server_page(): current_block = "Unknown" status = get_electrs_status() + server_url = get_local_ip() + ":50002:s" + # Load page templateData = { "title": "myNode Electrum Server", "port": 50002, "status": status, - "current_block": current_block + "current_block": current_block, + "server_url": server_url } return render_template('electrum_server.html', **templateData) diff --git a/rootfs/standard/var/www/mynode/templates/electrum_server.html b/rootfs/standard/var/www/mynode/templates/electrum_server.html index ff52a26f..5f8f4194 100644 --- a/rootfs/standard/var/www/mynode/templates/electrum_server.html +++ b/rootfs/standard/var/www/mynode/templates/electrum_server.html @@ -26,13 +26,20 @@