List JM wallets and add download button
This commit is contained in:
parent
095bb1ef01
commit
00bd292e4a
|
@ -121,7 +121,7 @@ def bitcoind_status_page():
|
||||||
}
|
}
|
||||||
return render_template('bitcoin.html', **templateData)
|
return render_template('bitcoin.html', **templateData)
|
||||||
|
|
||||||
@mynode_bitcoin.route("/download_wallet", methods=["GET"])
|
@mynode_bitcoin.route("/bitcoin/download_wallet", methods=["GET"])
|
||||||
def bitcoin_download_wallet():
|
def bitcoin_download_wallet():
|
||||||
check_logged_in()
|
check_logged_in()
|
||||||
wallet_name = request.args.get('wallet')
|
wallet_name = request.args.get('wallet')
|
||||||
|
|
|
@ -1,12 +1,28 @@
|
||||||
from flask import Blueprint, render_template, redirect
|
from flask import Blueprint, render_template, redirect, request, flash, send_from_directory
|
||||||
from user_management import check_logged_in
|
from user_management import check_logged_in
|
||||||
from device_info import read_ui_settings
|
from device_info import read_ui_settings
|
||||||
from systemctl_info import *
|
from systemctl_info import *
|
||||||
|
import os
|
||||||
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
import os
|
import os
|
||||||
|
|
||||||
mynode_joininbox = Blueprint('mynode_joininbox',__name__)
|
mynode_joininbox = Blueprint('mynode_joininbox',__name__)
|
||||||
|
|
||||||
|
def get_jm_wallets():
|
||||||
|
wallets = []
|
||||||
|
wallet_folder = "/mnt/hdd/mynode/joinmarket/wallets/"
|
||||||
|
try:
|
||||||
|
if os.path.isdir(wallet_folder):
|
||||||
|
for f in os.listdir(wallet_folder):
|
||||||
|
wallet_path = wallet_folder + f
|
||||||
|
if os.path.isfile( wallet_path ):
|
||||||
|
wallet = {}
|
||||||
|
wallet["name"] = f
|
||||||
|
wallets.append(wallet)
|
||||||
|
except Exception as e:
|
||||||
|
wallets.append({"name": str(e)})
|
||||||
|
return wallets
|
||||||
|
|
||||||
### Page functions
|
### Page functions
|
||||||
@mynode_joininbox.route("/joininbox")
|
@mynode_joininbox.route("/joininbox")
|
||||||
|
@ -16,6 +32,25 @@ def joininbox_page():
|
||||||
# Load page
|
# Load page
|
||||||
templateData = {
|
templateData = {
|
||||||
"title": "myNode JoininBox / JoinMarket",
|
"title": "myNode JoininBox / JoinMarket",
|
||||||
|
"wallets": get_jm_wallets(),
|
||||||
"ui_settings": read_ui_settings(),
|
"ui_settings": read_ui_settings(),
|
||||||
}
|
}
|
||||||
return render_template('joininbox.html', **templateData)
|
return render_template('joininbox.html', **templateData)
|
||||||
|
|
||||||
|
|
||||||
|
@mynode_joininbox.route("/joininbox/download_wallet", methods=["GET"])
|
||||||
|
def joininbox_download_wallet():
|
||||||
|
check_logged_in()
|
||||||
|
wallet_folder = "/mnt/hdd/mynode/joinmarket/wallets/"
|
||||||
|
wallet_name = request.args.get('wallet')
|
||||||
|
if wallet_name is None:
|
||||||
|
flash("Error finding wallet name!", category="error")
|
||||||
|
return redirect("/joininbox")
|
||||||
|
|
||||||
|
full_file_path = wallet_folder + wallet_name
|
||||||
|
if not os.path.isfile( full_file_path ):
|
||||||
|
time.sleep(3)
|
||||||
|
flash("Error finding wallet to download!", category="error")
|
||||||
|
return redirect("/joininbox")
|
||||||
|
|
||||||
|
return send_from_directory(directory=wallet_folder, filename=wallet_name, as_attachment=True)
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
<a class="ui-button ui-widget ui-corner-all mynode_back" href="/"><span class="ui-icon ui-icon-home"></span>home </a>
|
<a class="ui-button ui-widget ui-corner-all mynode_back" href="/"><span class="ui-icon ui-icon-home"></span>home </a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% include 'includes/message_display.html' %}
|
||||||
|
|
||||||
<div class="main_header">JoininBox / JoinMarket</div>
|
<div class="main_header">JoininBox / JoinMarket</div>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
@ -20,6 +22,34 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{% if wallets is not none and wallets|length > 0 %}
|
||||||
|
<br/>
|
||||||
|
<div class="main_header">Wallets</div>
|
||||||
|
<table class="bitcoind_table">
|
||||||
|
<thead class="bitcoind_table_header">
|
||||||
|
<td>Wallet</td>
|
||||||
|
<td>Actions</td>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for wallet in wallets %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ wallet.name }}</td>
|
||||||
|
<td>
|
||||||
|
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 100px;" href="/joininbox/download_wallet?wallet={{wallet.name|urlencode}}">download</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p style="font-size: 12px; color: gray; text-align: center;">
|
||||||
|
*These wallets are not your main lightning wallet. These have been created manually or via other applications.<br/>
|
||||||
|
**Wallet files may contain private keys and sensitive data. Be very cautious when downloading copies.<br/>
|
||||||
|
***Wallet files may be encrypted and require a password to use.
|
||||||
|
</p>
|
||||||
|
<br/>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<div class="instructions">
|
<div class="instructions">
|
||||||
<div class="instructions-header">Instructions to setup JoininBox / JoinMarket</div>
|
<div class="instructions-header">Instructions to setup JoininBox / JoinMarket</div>
|
||||||
<ol class="instructions-steps">
|
<ol class="instructions-steps">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user