Add basic outline for page to manage apps
This commit is contained in:
parent
1331c638ad
commit
a2d7fba47f
|
@ -131,22 +131,6 @@ def mark_upgrade_started():
|
|||
def is_upgrade_running():
|
||||
return os.path.isfile("/tmp/upgrade_started")
|
||||
|
||||
def reinstall_app(app):
|
||||
if not is_upgrade_running():
|
||||
mark_upgrade_started()
|
||||
|
||||
# Upgrade
|
||||
os.system("mkdir -p /home/admin/upgrade_logs")
|
||||
cmd = "/usr/bin/mynode_reinstall_app.sh {} > /home/admin/upgrade_logs/reinstall_{}.txt 2>&1".format(app,app)
|
||||
subprocess.call(cmd, shell=True)
|
||||
|
||||
# Sync
|
||||
os.system("sync")
|
||||
time.sleep(1)
|
||||
|
||||
# Reboot
|
||||
reboot_device()
|
||||
|
||||
def upgrade_device():
|
||||
if not is_upgrade_running():
|
||||
mark_upgrade_started()
|
||||
|
@ -200,6 +184,35 @@ def get_recent_upgrade_logs():
|
|||
def has_checkin_error():
|
||||
return os.path.isfile("/tmp/check_in_error")
|
||||
|
||||
|
||||
#==================================
|
||||
# Manage Apps
|
||||
#==================================
|
||||
def get_app_current_version(app):
|
||||
version = "unknown"
|
||||
filename = "/home/bitcoin/.mynode/"+app+"_version"
|
||||
if os.path.isfile(filename):
|
||||
version = get_file_contents(filename)
|
||||
return version
|
||||
|
||||
|
||||
# This is going to be the "old" way to install apps
|
||||
def reinstall_app(app):
|
||||
if not is_upgrade_running():
|
||||
mark_upgrade_started()
|
||||
|
||||
# Upgrade
|
||||
os.system("mkdir -p /home/admin/upgrade_logs")
|
||||
cmd = "/usr/bin/mynode_reinstall_app.sh {} > /home/admin/upgrade_logs/reinstall_{}.txt 2>&1".format(app,app)
|
||||
subprocess.call(cmd, shell=True)
|
||||
|
||||
# Sync
|
||||
os.system("sync")
|
||||
time.sleep(1)
|
||||
|
||||
# Reboot
|
||||
reboot_device()
|
||||
|
||||
#==================================
|
||||
# Reseller Info
|
||||
#==================================
|
||||
|
|
38
rootfs/standard/var/www/mynode/manage_apps.py
Normal file
38
rootfs/standard/var/www/mynode/manage_apps.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
|
||||
from flask import Blueprint, render_template, redirect
|
||||
from user_management import check_logged_in
|
||||
from device_info import *
|
||||
import subprocess
|
||||
import re
|
||||
import os
|
||||
|
||||
mynode_manage_apps = Blueprint('mynode_manage_apps',__name__)
|
||||
|
||||
|
||||
### Page functions
|
||||
@mynode_manage_apps.route("/apps")
|
||||
def caravan_page():
|
||||
check_logged_in()
|
||||
|
||||
apps = []
|
||||
apps.append({"name":"Bitcoin", "short_name": "bitcoin"})
|
||||
apps.append({"name":"LND", "short_name": "lnd"})
|
||||
apps.append({"name":"Loop", "short_name": "loop"})
|
||||
#apps.append({"name":"Electrum Server", "short_name": "electrs"})
|
||||
#apps.append({"name":"LND Hub", "short_name": "lndhub"})
|
||||
#apps.append({"name":"BTC RPC Explorer", "short_name": "btc_rpc_explorer"})
|
||||
apps.append({"name":"Ride the Lightning", "short_name": "rtl"})
|
||||
apps.append({"name":"Thunderhub", "short_name": "thunderhub"})
|
||||
#apps.append({"name":"LNbits", "short_name": "lnbits"})
|
||||
apps.append({"name":"Specter", "short_name": "specter"})
|
||||
|
||||
for app in apps:
|
||||
app["current_version"] = get_app_current_version(app["short_name"])
|
||||
|
||||
# Load page
|
||||
templateData = {
|
||||
"title": "myNode Manage Apps",
|
||||
"ui_settings": read_ui_settings(),
|
||||
"apps": apps
|
||||
}
|
||||
return render_template('manage_apps.html', **templateData)
|
|
@ -6,6 +6,7 @@ from bitcoind import mynode_bitcoind
|
|||
from whirlpool import mynode_whirlpool, get_whirlpool_status
|
||||
from dojo import mynode_dojo, get_dojo_status
|
||||
from caravan import mynode_caravan
|
||||
from manage_apps import mynode_manage_apps
|
||||
from tor import mynode_tor
|
||||
from vpn import mynode_vpn
|
||||
from electrum_server import *
|
||||
|
@ -71,6 +72,7 @@ app.register_blueprint(mynode_lnd)
|
|||
app.register_blueprint(mynode_whirlpool)
|
||||
app.register_blueprint(mynode_dojo)
|
||||
app.register_blueprint(mynode_caravan)
|
||||
app.register_blueprint(mynode_manage_apps)
|
||||
app.register_blueprint(mynode_tor)
|
||||
app.register_blueprint(mynode_electrum_server)
|
||||
app.register_blueprint(mynode_vpn)
|
||||
|
|
37
rootfs/standard/var/www/mynode/templates/manage_apps.html
Normal file
37
rootfs/standard/var/www/mynode/templates/manage_apps.html
Normal file
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html lang="en">
|
||||
<head>
|
||||
<title>{{ title }}</title>
|
||||
{% include 'includes/head.html' %}
|
||||
</head>
|
||||
<body>
|
||||
{% include 'includes/logo_header.html' %}
|
||||
<div class="mynode_back_div">
|
||||
<a class="ui-button ui-widget ui-corner-all mynode_back" href="/"><span class="ui-icon ui-icon-home"></span>home </a>
|
||||
</div>
|
||||
|
||||
<div class="main_header">Manage Applications</div>
|
||||
</br>
|
||||
|
||||
<br/><br/>
|
||||
<table class="bitcoind_table">
|
||||
<thead class="bitcoind_table_header">
|
||||
<td>Application</td>
|
||||
<td>Current Version</td>
|
||||
<td>Actions</td>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for app in apps %}
|
||||
<tr>
|
||||
<td>{{ app.name }}</td>
|
||||
<td>{{ app.current_version }}</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
{% include 'includes/footer.html' %}
|
||||
</body>
|
||||
</html>
|
|
@ -576,6 +576,17 @@
|
|||
<a href="/status" class="ui-button ui-widget ui-corner-all settings_button">Status</a>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">Applications</div>
|
||||
|
||||
<div class="settings_block_subheader">Manage Applications</div>
|
||||
You can view application information and manage applications.
|
||||
<br/>
|
||||
<a href="/apps" class="ui-button ui-widget ui-corner-all settings_button">Manage Apps</a>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="settings_block">
|
||||
<div class="settings_block_header">User Interface</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user