mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-12-26 14:34:00 +00:00
Vastly improved settings / status page
This commit is contained in:
parent
1450f12fb2
commit
a1d59bb9cb
|
@ -5,11 +5,24 @@ set -x
|
|||
|
||||
source /usr/share/mynode/mynode_config.sh
|
||||
|
||||
BACKGROUND_UL_RATE=1000
|
||||
BACKGROUND_DL_RATE=2500
|
||||
if [ $IS_RASPI3 -eq 1 ]; then
|
||||
BACKGROUND_DL_RATE=500
|
||||
BACKGROUND_UL_RATE=0
|
||||
if [ ! -f $QUICKSYNC_UPLOAD_RATE_FILE ]; then
|
||||
UPLOAD_RATE=1000
|
||||
if [ $IS_RASPI3 -eq 1 ]; then
|
||||
UPLOAD_RATE=0
|
||||
fi
|
||||
echo "$UPLOAD_RATE" > $QUICKSYNC_UPLOAD_RATE_FILE
|
||||
else
|
||||
UPLOAD_RATE=$(cat $QUICKSYNC_UPLOAD_RATE_FILE)
|
||||
fi
|
||||
|
||||
if [ ! -f $QUICKSYNC_BACKGROUND_DOWNLOAD_RATE_FILE ]; then
|
||||
DOWNLOAD_RATE=2500
|
||||
if [ $IS_RASPI3 -eq 1 ]; then
|
||||
DOWNLOAD_RATE=500
|
||||
fi
|
||||
echo "$DOWNLOAD_RATE" > $QUICKSYNC_BACKGROUND_DOWNLOAD_RATE_FILE
|
||||
else
|
||||
DOWNLOAD_RATE=$(cat $QUICKSYNC_BACKGROUND_DOWNLOAD_RATE_FILE)
|
||||
fi
|
||||
|
||||
# Let transmission startup
|
||||
|
@ -33,7 +46,7 @@ while true; do
|
|||
transmission-remote -D
|
||||
elif [ ! -f "/mnt/hdd/mynode/quicksync/.quicksync_complete" ]; then
|
||||
echo "QuickSync not complete, limited upload, unlimited download"
|
||||
transmission-remote -u $BACKGROUND_UL_RATE
|
||||
transmission-remote -u $UPLOAD_RATE
|
||||
transmission-remote -D
|
||||
elif [ ! -f "/mnt/hdd/mynode/.mynode_bitcoind_synced" ]; then
|
||||
echo "Bitcoin not synced, stopping upload, stopping download"
|
||||
|
@ -41,13 +54,8 @@ while true; do
|
|||
transmission-remote -d 0
|
||||
elif [[ "$PERCENT" != *"100"* ]]; then
|
||||
echo "QuickSync is downloading (but has completed once), limited upload, limited download"
|
||||
transmission-remote -u $BACKGROUND_UL_RATE
|
||||
transmission-remote -d $BACKGROUND_DL_RATE
|
||||
elif [ -f $QUICKSYNC_BANDWIDTH_FILE ]; then
|
||||
RATE=$(cat $QUICKSYNC_BANDWIDTH_FILE)
|
||||
echo "Setting upload rate to $RATE kbps"
|
||||
transmission-remote -u $RATE
|
||||
transmission-remote -d $BACKGROUND_DL_RATE
|
||||
transmission-remote -u $UPLOAD_RATE
|
||||
transmission-remote -d $DOWNLOAD_RATE
|
||||
else
|
||||
echo "Setting upload rate to unlimited"
|
||||
transmission-remote -U
|
||||
|
|
|
@ -39,7 +39,8 @@ QUICKSYNC_DIR=/mnt/hdd/mynode/quicksync
|
|||
QUICKSYNC_CONFIG_DIR=/mnt/hdd/mynode/.config/transmission
|
||||
QUICKSYNC_TORRENT_URL="https://mynodebtc.com/device/blockchain.tar.gz.torrent"
|
||||
QUICKSYNC_TORRENT_BETA_URL="https://mynodebtc.com/device/blockchain_beta.tar.gz.torrent"
|
||||
QUICKSYNC_BANDWIDTH_FILE="/mnt/hdd/mynode/settings/bandwidth"
|
||||
QUICKSYNC_UPLOAD_RATE_FILE="/mnt/hdd/mynode/settings/quicksync_upload_rate"
|
||||
QUICKSYNC_BACKGROUND_DOWNLOAD_RATE_FILE="/mnt/hdd/mynode/settings/quicksync_background_download_rate"
|
||||
LATEST_VERSION_URL="http://www.mynodebtc.com/device/latest_version"
|
||||
UPLOADER_FILE="/mnt/hdd/mynode/settings/uploader"
|
||||
LND_BACKUP_FOLDER="/home/bitcoin/lnd_backup/"
|
||||
|
|
|
@ -155,6 +155,31 @@ def page_settings():
|
|||
except:
|
||||
bitcoin_status = "ERROR"
|
||||
|
||||
# Get LND Status
|
||||
lnd_status = ""
|
||||
try:
|
||||
lnd_status = subprocess.check_output("journalctl --unit=lnd --no-pager | tail -n 100", shell=True)
|
||||
except:
|
||||
lnd_status = "ERROR"
|
||||
|
||||
# Get Electrs Status
|
||||
electrs_status = ""
|
||||
try:
|
||||
electrs_status = subprocess.check_output("journalctl --unit=electrs --no-pager | tail -n 100", shell=True)
|
||||
except:
|
||||
electrs_status = "ERROR"
|
||||
|
||||
# Get QuickSync Rates
|
||||
upload_rate = 100
|
||||
download_rate = 100
|
||||
try:
|
||||
upload_rate = subprocess.check_output(["cat","/mnt/hdd/mynode/settings/quicksync_upload_rate"])
|
||||
download_rate = subprocess.check_output(["cat","/mnt/hdd/mynode/settings/quicksync_background_download_rate"])
|
||||
except:
|
||||
upload_rate = 100
|
||||
download_rate = 100
|
||||
|
||||
|
||||
templateData = {
|
||||
"title": "myNode Settings",
|
||||
"password_message": "",
|
||||
|
@ -168,8 +193,12 @@ def page_settings():
|
|||
"changelog": changelog,
|
||||
"quicksync_status": quicksync_status,
|
||||
"bitcoin_status": bitcoin_status,
|
||||
"lnd_status": lnd_status,
|
||||
"electrs_status": electrs_status,
|
||||
"is_quicksync_disabled": not is_quicksync_enabled(),
|
||||
"is_uploader_device": is_uploader(),
|
||||
"download_rate": download_rate,
|
||||
"upload_rate": upload_rate,
|
||||
"uptime": uptime,
|
||||
"public_ip": public_ip,
|
||||
"local_ip": local_ip
|
||||
|
@ -323,6 +352,24 @@ def change_password_page():
|
|||
return redirect(url_for(".page_settings"))
|
||||
|
||||
|
||||
@mynode_settings.route("/settings/quicksync_rates", methods=['POST'])
|
||||
def change_quicksync_rates_page():
|
||||
check_logged_in()
|
||||
if not request:
|
||||
return redirect("/settings")
|
||||
|
||||
downloadRate = request.form.get('download-rate')
|
||||
uploadRate = request.form.get('upload-rate')
|
||||
|
||||
os.system("echo {} > /mnt/hdd/mynode/settings/quicksync_upload_rate".format(uploadRate))
|
||||
os.system("echo {} > /mnt/hdd/mynode/settings/quicksync_background_download_rate".format(downloadRate))
|
||||
os.system("sync")
|
||||
os.system("systemctl restart bandwidth")
|
||||
|
||||
flash("QuickSync Rates Updated!", category="message")
|
||||
return redirect(url_for(".page_settings"))
|
||||
|
||||
|
||||
@mynode_settings.route("/settings/delete-lnd-wallet", methods=['POST'])
|
||||
def page_lnd_delete_wallet():
|
||||
check_logged_in()
|
||||
|
|
|
@ -433,4 +433,21 @@ a:active {
|
|||
.login_submit {
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
#download-handle {
|
||||
width: 6em;
|
||||
height: 1.6em;
|
||||
top: 50%;
|
||||
margin-top: -.8em;
|
||||
text-align: center;
|
||||
line-height: 1.6em;
|
||||
}
|
||||
#upload-handle {
|
||||
width: 6em;
|
||||
height: 1.6em;
|
||||
top: 50%;
|
||||
margin-top: -.8em;
|
||||
text-align: center;
|
||||
line-height: 1.6em;
|
||||
}
|
|
@ -191,6 +191,16 @@
|
|||
$("#bitcoin_status").show();
|
||||
});
|
||||
|
||||
$("#show_lnd_status").on("click", function() {
|
||||
$("#show_lnd_status").hide(0);
|
||||
$("#lnd_status").show();
|
||||
});
|
||||
|
||||
$("#show_electrs_status").on("click", function() {
|
||||
$("#show_electrs_status").hide(0);
|
||||
$("#electrs_status").show();
|
||||
});
|
||||
|
||||
$("#show_mynode_changelog").on("click", function() {
|
||||
if (showChangelog)
|
||||
{
|
||||
|
@ -224,6 +234,47 @@
|
|||
);
|
||||
});
|
||||
|
||||
$( function() {
|
||||
var downloadHandle = $( "#download-handle" );
|
||||
var uploadHandle = $( "#upload-handle" );
|
||||
$( "#download-slider" ).slider({
|
||||
value: {{download_rate}} / 100,
|
||||
orientation: "horizontal",
|
||||
range: "min",
|
||||
animate: true,
|
||||
create: function() {
|
||||
rate = parseInt($( this ).slider( "value" ) * 100)
|
||||
text = rate + " kbps"
|
||||
downloadHandle.text(text);
|
||||
$('#download-rate').val(rate);
|
||||
},
|
||||
slide: function( event, ui ) {
|
||||
rate = parseInt(ui.value * 100)
|
||||
text = rate + " kbps"
|
||||
downloadHandle.text( text );
|
||||
$('#download-rate').val(rate);
|
||||
}
|
||||
});
|
||||
$( "#upload-slider" ).slider({
|
||||
value: {{upload_rate}} / 100,
|
||||
orientation: "horizontal",
|
||||
range: "min",
|
||||
animate: true,
|
||||
create: function() {
|
||||
rate = parseInt($( this ).slider( "value" ) * 100)
|
||||
text = rate + " kbps"
|
||||
uploadHandle.text(text);
|
||||
$('#upload-rate').val(rate);
|
||||
},
|
||||
slide: function( event, ui ) {
|
||||
rate = parseInt(ui.value * 100)
|
||||
text = rate + " kbps"
|
||||
uploadHandle.text( text );
|
||||
$('#upload-rate').val(rate);
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
{% if product_key_skipped %}
|
||||
$( "#upgrade" ).button({
|
||||
disabled: true
|
||||
|
@ -331,7 +382,9 @@
|
|||
</table>
|
||||
<input type="submit" id="password_submit" value="Change Password" class="ui-button ui-widget ui-corner-all settings_button"/>
|
||||
</form>
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">Status</div>
|
||||
|
||||
<div class="settings_block_subheader">QuickSync Status</div>
|
||||
<button id="show_quicksync_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
|
@ -341,62 +394,21 @@
|
|||
<div class="settings_block_subheader">Bitcoin Status</div>
|
||||
<button id="show_bitcoin_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<div id="bitcoin_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{bitcoin_status}}</pre></div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">Bitcoin</div>
|
||||
|
||||
<div class="settings_block_subheader">Toggle QuickSync</div>
|
||||
Disabling QuickSync will remove the QuickSync files and stop the process. This may take a long time if Bitcoin is not already synced, but you can re-enable QuickSync later.
|
||||
<br/>
|
||||
{% if is_quicksync_disabled %}
|
||||
<a href="/settings/toggle-quicksync" class="ui-button ui-widget ui-corner-all settings_button">Re-enable QuickSync</a>
|
||||
{% else %}
|
||||
<a href="/settings/toggle-quicksync" class="ui-button ui-widget ui-corner-all settings_button">Disable QuickSync</a>
|
||||
{% endif %}
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Reset Blockchain</div>
|
||||
If bitcoind is having issues, you can reset the blockchain data. If QuickSync is enabled, it will use QuickSync data as the starting point. Otherwise, Bitcoin will
|
||||
sync from scratch. This may take a long time.
|
||||
<br/>
|
||||
<button id="reset-blockchain" class="ui-button ui-widget ui-corner-all settings_button">Reset Blockchain</button>
|
||||
|
||||
<div class="settings_block_subheader">LND Status</div>
|
||||
<button id="show_lnd_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<div id="lnd_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{lnd_status}}</pre></div>
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Restart QuickSync</div>
|
||||
This will reset bitcoind and re-download the blockchain via QuickSync.
|
||||
<br/>
|
||||
<button id="restart-quicksync" class="ui-button ui-widget ui-corner-all settings_button">Restart QuickSync</button>
|
||||
|
||||
|
||||
<div class="settings_block_subheader">Electrum Server Status</div>
|
||||
<button id="show_electrs_status" class="ui-button ui-widget ui-corner-all settings_button">Show</button>
|
||||
<div id="electrs_status" style='text-align: left; font-size: 12px; width: 800px; display: none;'><pre>{{electrs_status}}</pre></div>
|
||||
</div>
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">Lightning</div>
|
||||
|
||||
<div class="settings_block_subheader">Delete Lightning Wallet</div>
|
||||
{{lnd_delete_message}}
|
||||
Advanced: This will delete your Lightning Wallet.
|
||||
<br/>
|
||||
<button id="delete_lnd_wallet" class="ui-button ui-widget ui-corner-all settings_button">Delete Wallet</button>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">Tor</div>
|
||||
|
||||
<div class="settings_block_subheader">Reset Tor</div>
|
||||
This will reset all of your Tor service settings and re-generate your Onion URLs.
|
||||
<br/>
|
||||
<button id="reset_tor" class="ui-button ui-widget ui-corner-all settings_button">Reset Tor</button>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">Advanced</div>
|
||||
<div class="settings_block_header">Device</div>
|
||||
|
||||
<div class="settings_block_subheader">Reboot Device</div>
|
||||
This will reboot your myNode.
|
||||
|
@ -409,22 +421,70 @@
|
|||
This will shutdown your myNode. You will need to power cycle the device to turn it back on.
|
||||
<br/>
|
||||
<button id="shutdown-device" class="ui-button ui-widget ui-corner-all settings_button">Shutdown Device</button>
|
||||
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Download Logs</div>
|
||||
<div class="settings_block_subheader">Download Debug Logs</div>
|
||||
This will download all recent logs from your mynode. This can be helpful for debugging issues.
|
||||
<br/>
|
||||
It may take ~60 seconds to gather and download the logs.
|
||||
<br/>
|
||||
<a href="/settings/mynode_logs.tar.gz" class="ui-button ui-widget ui-corner-all settings_button">Download Logs</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">QuickSync</div>
|
||||
|
||||
<div class="settings_block_subheader">Toggle QuickSync</div>
|
||||
Disabling QuickSync will remove the QuickSync files and stop the process. This may take a long time if Bitcoin is not already synced, but you can re-enable QuickSync later.
|
||||
<br/>
|
||||
{% if is_quicksync_disabled %}
|
||||
<a href="/settings/toggle-quicksync" class="ui-button ui-widget ui-corner-all settings_button">Re-enable QuickSync</a>
|
||||
{% else %}
|
||||
<a href="/settings/toggle-quicksync" class="ui-button ui-widget ui-corner-all settings_button">Disable QuickSync</a>
|
||||
{% endif %}
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Reset HTTP Certificates</div>
|
||||
This will regenerate your HTTPS certificates.
|
||||
<div class="settings_block_subheader">Restart QuickSync</div>
|
||||
This will reset bitcoind and re-download the blockchain via QuickSync.
|
||||
<br/>
|
||||
<a href="/settings/regen-https-certs" class="ui-button ui-widget ui-corner-all settings_button">Regenerate</a>
|
||||
<button id="restart-quicksync" class="ui-button ui-widget ui-corner-all settings_button">Restart QuickSync</button>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">QuickSync Rates</div>
|
||||
You can control the background upload and download rates for QuickSync. This helps the myNode network.
|
||||
<br/>
|
||||
|
||||
<form action="/settings/quicksync_rates" method="POST">
|
||||
<p><b>Download Rate</b></p>
|
||||
<div id="download-slider">
|
||||
<div id="download-handle" class="quicksync-handle ui-slider-handle "></div>
|
||||
</div>
|
||||
<input type="hidden" id="download-rate" name="download-rate"/>
|
||||
|
||||
<p><b>Upload Rate</b></p>
|
||||
<div id="upload-slider">
|
||||
<div id="upload-handle" class="quicksync-handle ui-slider-handle"></div>
|
||||
</div>
|
||||
<input type="hidden" id="upload-rate" name="upload-rate"/>
|
||||
|
||||
<br/>
|
||||
<input type="submit" id="quicksync_rates_submit" value="Save" class="ui-button ui-widget ui-corner-all settings_button"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">Bitcoin</div>
|
||||
|
||||
<div class="settings_block_subheader">Reset Blockchain</div>
|
||||
If bitcoind is having issues, you can reset the blockchain data. If QuickSync is enabled, it will use QuickSync data as the starting point. Otherwise, Bitcoin will
|
||||
sync from scratch. This may take a long time.
|
||||
<br/>
|
||||
<button id="reset-blockchain" class="ui-button ui-widget ui-corner-all settings_button">Reset Blockchain</button>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
|
@ -439,6 +499,37 @@
|
|||
Advanced: If you are having issues parsing the Bitcoin blockchain or blocks cannot be found, please try re-indexing. This will take a long time.
|
||||
<br/>
|
||||
<button id="reindex-blockchain" class="ui-button ui-widget ui-corner-all settings_button">Re-index Blockchain</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">Lightning</div>
|
||||
|
||||
<div class="settings_block_subheader">Delete Lightning Wallet</div>
|
||||
{{lnd_delete_message}}
|
||||
Advanced: This will delete your Lightning Wallet.
|
||||
<br/>
|
||||
<button id="delete_lnd_wallet" class="ui-button ui-widget ui-corner-all settings_button">Delete Wallet</button>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">Tor</div>
|
||||
|
||||
<div class="settings_block_subheader">Reset Tor</div>
|
||||
This will reset all of your Tor service settings and re-generate your Onion URLs.
|
||||
<br/>
|
||||
<button id="reset_tor" class="ui-button ui-widget ui-corner-all settings_button">Reset Tor</button>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">Advanced</div>
|
||||
|
||||
<div class="settings_block_subheader">Reset HTTP Certificates</div>
|
||||
This will regenerate your HTTPS certificates.
|
||||
<br/>
|
||||
<a href="/settings/regen-https-certs" class="ui-button ui-widget ui-corner-all settings_button">Regenerate</a>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
|
@ -453,9 +544,9 @@
|
|||
This will factory reset your mynode and all storage will be completely reset. Make sure you have backed up all your keys and wallets!
|
||||
<br/>
|
||||
<button id="factory-reset" class="ui-button ui-widget ui-corner-all settings_button">Factory Reset</button>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">Developer</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user