Add whitepaper download button (via blockchain copy)

This commit is contained in:
Taylor Helsper 2021-02-23 22:46:33 -06:00
parent 8ecc88ca92
commit f7d41729ca
3 changed files with 43 additions and 11 deletions

View File

@ -21,6 +21,16 @@ while true; do
fi
fi
# Download bitcoin whitepaper
if [ -f "/mnt/hdd/mynode/.mynode_bitcoind_synced" ]; then
if [ ! -f /mnt/hdd/mynode/bitcoin/bitcoin_whitepaper.pdf ]; then
sudo -u bitcoin bitcoin-cli getrawtransaction 54e48e5f5c656b26c3bca14a8c95aa583d07ebe84dde3b7dd4a78f4e4186e713 true | \
jq -r '.vout[].scriptPubKey.asm' | cut -c3- | \
xxd -p -r | tail +9c | head -c 184292 > /mnt/hdd/mynode/bitcoin/bitcoin_whitepaper.pdf || \
rm -f /mnt/hdd/mynode/bitcoin/bitcoin_whitepaper.pdf || true
fi
fi
# Increment counter and sleep 1 min
COUNTER=$((COUNTER+1))

View File

@ -39,6 +39,11 @@ def bitcoind_status_page():
version = get_bitcoin_version()
rpc_password = get_bitcoin_rpc_password()
# Whitepaper
bitcoin_whitepaper_exists = False
if os.path.isfile("/mnt/hdd/mynode/bitcoin/bitcoin_whitepaper.pdf"):
bitcoin_whitepaper_exists = True
# Mempool info
mempool = get_bitcoin_mempool_info()
@ -117,16 +122,22 @@ def bitcoind_status_page():
"mempool_size": "{:.3} MB".format(float(mempool["bytes"]) / 1000 / 1000),
"confirmed_balance": walletinfo["balance"],
"unconfirmed_balance": walletinfo["unconfirmed_balance"],
"bitcoin_whitepaper_exists": bitcoin_whitepaper_exists,
"version": version,
"ui_settings": read_ui_settings()
}
return render_template('bitcoind_status.html', **templateData)
@mynode_bitcoind.route("/bitcoind/wallet.dat")
def lnd_tls_cert():
def bitcoin_wallet_dat():
check_logged_in()
return send_from_directory(directory="/mnt/hdd/mynode/bitcoin/", filename="wallet.dat")
@mynode_bitcoind.route("/bitcoind/bitcoin_whitepaper.pdf")
def bitcoin_whitepaper_pdf():
check_logged_in()
return send_from_directory(directory="/mnt/hdd/mynode/bitcoin/", filename="bitcoin_whitepaper.pdf")
@mynode_bitcoind.route("/bitcoind/reset_config")
def bitcoin_reset_config_page():
check_logged_in()

View File

@ -38,10 +38,6 @@
<div class="info_tile_header">Difficulty</div>
<div class="info_tile_contents">{{difficulty}}</div>
</div>
<div class="info_tile">
<div class="info_tile_header">Disk Usage</div>
<div class="info_tile_contents">{{disk_size}} GB</div>
</div>
<div class="info_tile">
<div class="info_tile_header">Version</div>
<div class="info_tile_contents">{{version}}</div>
@ -57,14 +53,10 @@
<div class="info_tile_header">Mempool Size</div>
<div class="info_tile_contents">{{mempool_size}}</div>
</div>
{% if confirmed_balance > 0.0 or unconfirmed_balance > 0.0 %}
<div class="info_tile">
<div class="info_tile_header">Wallet Backup</div>
<div class="info_tile_contents">
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 70%;" href="/bitcoind/wallet.dat">download</a>
</div>
<div class="info_tile_header">Disk Usage</div>
<div class="info_tile_contents">{{disk_size}} GB</div>
</div>
{% endif %}
<div class="info_tile">
<div class="info_tile_header">RPC Username</div>
<div class="info_tile_contents">mynode</div>
@ -76,6 +68,17 @@
<a id="show_rpc_password" class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 70%;">show</a>
</div>
</div>
</div>
<div class="app_tile_row">
{% if confirmed_balance > 0.0 or unconfirmed_balance > 0.0 %}
<div class="info_tile">
<div class="info_tile_header">Wallet Backup</div>
<div class="info_tile_contents">
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 70%;" href="/bitcoind/wallet.dat">download</a>
</div>
</div>
{% endif %}
<div class="info_tile">
<div class="info_tile_header">Bitcoin Config</div>
<div class="info_tile_contents">
@ -88,6 +91,14 @@
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 70%;" href="/bitcoind/cli">CLI</a>
</div>
</div>
{% if bitcoin_whitepaper_exists %}
<div class="info_tile">
<div class="info_tile_header">Bitcoin Whitepaper</div>
<div class="info_tile_contents">
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 70%;" href="/bitcoind/bitcoin_whitepaper.pdf">download</a>
</div>
</div>
{% endif %}
</div>
<div class="app_tile_row">