Show electrum server URL

This commit is contained in:
Taylor Helsper 2019-08-26 20:36:15 -05:00
parent 4b841ddd69
commit 812ebe256c
3 changed files with 30 additions and 4 deletions

View File

@ -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")
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

View File

@ -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)

View File

@ -26,13 +26,20 @@
<div class="info_tile_header">Status</div>
<div class="info_tile_contents">{{status}}</div>
</div>
<div class="info_tile">
<div class="info_tile_header">Current Block</div>
<div class="info_tile_contents">{{current_block}}</div>
</div>
<div class="info_tile">
<div class="info_tile_header">Server Port</div>
<div class="info_tile_contents">{{port}}</div>
</div>
</div>
<div class="app_tile_row">
<div class="info_tile">
<div class="info_tile_header">Current Block</div>
<div class="info_tile_contents">{{current_block}}</div>
<div class="info_tile_header">Electrum Server IP</div>
<div class="info_tile_contents">{{server_url}}</div>
</div>
</div>