Basics for app verion customization

This commit is contained in:
Taylor Helsper 2021-06-21 00:06:27 -05:00
parent dc0d79767c
commit 57fc6aff15
7 changed files with 88 additions and 52 deletions

View File

@ -757,35 +757,7 @@ systemctl restart nginx || true
# Update latest version files
echo $BTC_VERSION > $BTC_LATEST_VERSION_FILE
echo $LND_VERSION > $LND_LATEST_VERSION_FILE
echo $LOOP_VERSION > $LOOP_LATEST_VERSION_FILE
echo $POOL_VERSION > $POOL_LATEST_VERSION_FILE
echo $LIT_VERSION > $LIT_LATEST_VERSION_FILE
echo $ELECTRS_VERSION > $ELECTRS_LATEST_VERSION_FILE
echo $LNDHUB_VERSION > $LNDHUB_LATEST_VERSION_FILE
echo $MEMPOOL_VERSION > $MEMPOOL_LATEST_VERSION_FILE
echo $CARAVAN_VERSION > $CARAVAN_LATEST_VERSION_FILE
echo $CORSPROXY_VERSION > $CORSPROXY_LATEST_VERSION_FILE
echo $JOINMARKET_VERSION > $JOINMARKET_LATEST_VERSION_FILE
echo $JOININBOX_VERSION > $JOININBOX_LATEST_VERSION_FILE
echo $WHIRLPOOL_VERSION > $WHIRLPOOL_LATEST_VERSION_FILE
echo $DOJO_VERSION > $DOJO_LATEST_VERSION_FILE
echo $RTL_VERSION > $RTL_LATEST_VERSION_FILE
echo $BTCRPCEXPLORER_VERSION > $BTCRPCEXPLORER_LATEST_VERSION_FILE
echo $BTCPAYSERVER_VERSION > $BTCPAYSERVER_LATEST_VERSION_FILE
echo $LNBITS_VERSION > $LNBITS_LATEST_VERSION_FILE
echo $SPECTER_VERSION > $SPECTER_LATEST_VERSION_FILE
echo $THUNDERHUB_VERSION > $THUNDERHUB_LATEST_VERSION_FILE
echo $LNDMANAGE_VERSION > $LNDMANAGE_LATEST_VERSION_FILE
echo $LNDCONNECT_VERSION > $LNDCONNECT_LATEST_VERSION_FILE
echo $CKBUNKER_VERSION > $CKBUNKER_LATEST_VERSION_FILE
echo $BOS_VERSION > $BOS_LATEST_VERSION_FILE
echo $SPHINXRELAY_VERSION > $SPHINXRELAY_LATEST_VERSION_FILE
echo $WEBSSH2_VERSION > $WEBSSH2_LATEST_VERSION_FILE
echo $PYBLOCK_VERSION > $PYBLOCK_LATEST_VERSION_FILE
echo $WARDEN_VERSION > $WARDEN_LATEST_VERSION_FILE
/usr/bin/mynode_update_latest_version_files.sh
touch /tmp/need_application_refresh
# Weird hacks

View File

@ -0,0 +1,32 @@
#!/bin/bash
source /usr/share/mynode/mynode_app_versions.sh
echo $BTC_VERSION > $BTC_LATEST_VERSION_FILE
echo $LND_VERSION > $LND_LATEST_VERSION_FILE
echo $LOOP_VERSION > $LOOP_LATEST_VERSION_FILE
echo $POOL_VERSION > $POOL_LATEST_VERSION_FILE
echo $LIT_VERSION > $LIT_LATEST_VERSION_FILE
echo $ELECTRS_VERSION > $ELECTRS_LATEST_VERSION_FILE
echo $LNDHUB_VERSION > $LNDHUB_LATEST_VERSION_FILE
echo $MEMPOOL_VERSION > $MEMPOOL_LATEST_VERSION_FILE
echo $CARAVAN_VERSION > $CARAVAN_LATEST_VERSION_FILE
echo $CORSPROXY_VERSION > $CORSPROXY_LATEST_VERSION_FILE
echo $JOINMARKET_VERSION > $JOINMARKET_LATEST_VERSION_FILE
echo $JOININBOX_VERSION > $JOININBOX_LATEST_VERSION_FILE
echo $WHIRLPOOL_VERSION > $WHIRLPOOL_LATEST_VERSION_FILE
echo $DOJO_VERSION > $DOJO_LATEST_VERSION_FILE
echo $RTL_VERSION > $RTL_LATEST_VERSION_FILE
echo $BTCRPCEXPLORER_VERSION > $BTCRPCEXPLORER_LATEST_VERSION_FILE
echo $BTCPAYSERVER_VERSION > $BTCPAYSERVER_LATEST_VERSION_FILE
echo $LNBITS_VERSION > $LNBITS_LATEST_VERSION_FILE
echo $SPECTER_VERSION > $SPECTER_LATEST_VERSION_FILE
echo $THUNDERHUB_VERSION > $THUNDERHUB_LATEST_VERSION_FILE
echo $LNDMANAGE_VERSION > $LNDMANAGE_LATEST_VERSION_FILE
echo $LNDCONNECT_VERSION > $LNDCONNECT_LATEST_VERSION_FILE
echo $CKBUNKER_VERSION > $CKBUNKER_LATEST_VERSION_FILE
echo $BOS_VERSION > $BOS_LATEST_VERSION_FILE
echo $SPHINXRELAY_VERSION > $SPHINXRELAY_LATEST_VERSION_FILE
echo $WEBSSH2_VERSION > $WEBSSH2_LATEST_VERSION_FILE
echo $PYBLOCK_VERSION > $PYBLOCK_LATEST_VERSION_FILE
echo $WARDEN_VERSION > $WARDEN_LATEST_VERSION_FILE

View File

@ -173,6 +173,10 @@ def initialize_applications():
global mynode_applications
apps = []
# Update latest version files
os.system("/usr/bin/mynode_update_latest_version_files.sh")
# Update app data
apps.append(create_application(
name="Bitcoin",
short_name="bitcoin",
@ -479,6 +483,10 @@ def clear_application_cache():
global mynode_applications
mynode_applications = None
def trigger_application_refresh():
os.system("touch /tmp/need_application_refresh")
os.system("sync")
def need_application_refresh():
global mynode_applications
if mynode_applications == None:
@ -663,4 +671,11 @@ def restart_application(short_name):
subprocess.check_output('systemctl restart {}'.format(short_name), shell=True)
return True
except Exception as e:
return False
return False
def has_customized_app_versions():
if os.path.isfile("/usr/share/mynode/mynode_app_versions_custom.sh"):
return True
if os.path.isfile("/mnt/hdd/mynode/settings/mynode_app_versions_custom.sh"):
return True
return False

View File

@ -24,7 +24,8 @@ def manage_apps_page():
"ui_settings": read_ui_settings(),
"load_time": t2-t1,
"product_key_skipped": skipped_product_key(),
"apps": apps
"apps": apps,
"has_customized_app_versions": has_customized_app_versions(),
}
return render_template('manage_apps.html', **templateData)
@ -48,4 +49,8 @@ def restart_app_page():
return redirect("/apps")
flash("Application restarting!", category="message")
return redirect("/apps")
return redirect("/apps")
@mynode_manage_apps.route("/apps/customize-app-versions")
def customize_app_versions_page():
return "TODO"

View File

@ -542,6 +542,15 @@ def reset_firewall_page():
flash("Firewall Reset", category="message")
return redirect("/settings")
@mynode_settings.route("/settings/refresh-app-database")
def refresh_app_database_page():
check_logged_in()
trigger_application_refresh()
flash("Application Database Refreshed", category="message")
return redirect("/settings")
@mynode_settings.route("/settings/remount-external-drive")
def remount_external_drive_page():
os.system("mount -o remount,rw /mnt/hdd")

View File

@ -85,7 +85,17 @@
{% include 'includes/message_display.html' %}
</br>
<!-- {{ load_time }} ms -->
{% if has_customized_app_versions %}
<div class="main_page_warning_block" style="text-align: center;">
Your application versions have been customized.
<br/><br/>
<a href="/apps/customize-app-versions" class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 80px;">Configure</a>
</div>
{% endif %}
<!-- <br/>{{ load_time }} ms -->
<br/><br/>
<table class="bitcoin_table">
<thead class="bitcoin_table_header">

View File

@ -535,9 +535,13 @@
<div class="settings_block_header">Applications</div>
<div class="settings_block_subheader">Manage Applications</div>
You can view application information and manage app upgrades.
You can view application information and manage app upgrades on the Manage page. You can also customize and override the
application versions supported by myNode.
<br/>
<a href="/apps" class="ui-button ui-widget ui-corner-all settings_button">Manage Apps</a>
<a href="/apps" class="ui-button ui-widget ui-corner-all settings_button">Manage</a>
<a href="/apps/customize-app-versions" class="ui-button ui-widget ui-corner-all settings_button">Customize Application Versions</a>
<a href="/settings/refresh-app-database" class="ui-button ui-widget ui-corner-all settings_button">Refresh Application Database</a>
</div>
@ -612,17 +616,11 @@
<div class="settings_block_header">Device</div>
<div class="settings_block_subheader">Reboot Device</div>
This will reboot your myNode.
This will reboot or shutdown your device. After a shutown, you will need to power cycle the device to turn it back on.
<br/>
<button id="reboot-device" class="ui-button ui-widget ui-corner-all settings_button">Reboot Device</button>
<div class="divider"></div>
<div class="settings_block_subheader">Shutdown Device</div>
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 Debug Logs</div>
@ -736,18 +734,13 @@
<div class="divider"></div>
<div class="settings_block_subheader">Rescan Blockchain</div>
Advanced: If you are having issues seeing transactions in your wallets, try re-scanning the blockchain.
Advanced: If you are having issues seeing transactions in your wallets, try re-scanning the blockchain. If you
are having issues parsing the Bitcoin blockchain or blocks cannot be found, please try reindexing. This will
take a long time.
<br/>
<button id="rescan-blockchain" class="ui-button ui-widget ui-corner-all settings_button">Rescan Blockchain</button>
<div class="divider"></div>
<div class="settings_block_subheader">Reindex Blockchain</div>
Advanced: If you are having issues parsing the Bitcoin blockchain or blocks cannot be found, please try reindexing.
<br/>
This will take a long time.
<br/>
<button id="reindex-blockchain" class="ui-button ui-widget ui-corner-all settings_button">Reindex Blockchain</button>
</div>