Add toggle for watchtower client
This commit is contained in:
parent
a44b226c6e
commit
16f8485b0d
|
@ -13,11 +13,16 @@ else
|
|||
# Generate a default config
|
||||
cp -f /usr/share/mynode/lnd.conf /mnt/hdd/mynode/lnd/lnd.conf
|
||||
|
||||
# Append Watchtower Section
|
||||
# Append Watchtower Server Section
|
||||
if [ -f /mnt/hdd/mynode/settings/watchtower_enabled ]; then
|
||||
cat /usr/share/mynode/lnd_watchtower.conf >> /mnt/hdd/mynode/lnd/lnd.conf
|
||||
fi
|
||||
|
||||
# Append Watchtower Client Section
|
||||
if [ -f /mnt/hdd/mynode/settings/watchtower_client_enabled ]; then
|
||||
cat /usr/share/mynode/lnd_watchtower_client.conf >> /mnt/hdd/mynode/lnd/lnd.conf
|
||||
fi
|
||||
|
||||
# Append Tor/IP section (check new file or old file, should be migrated to new)
|
||||
if [ -f /mnt/hdd/mynode/settings/btc_lnd_tor_enabled ] || [ -f /mnt/hdd/mynode/settings/.btc_lnd_tor_enabled ]; then
|
||||
cat /usr/share/mynode/lnd_tor.conf >> /mnt/hdd/mynode/lnd/lnd.conf
|
||||
|
|
|
@ -52,5 +52,3 @@ db.bolt.auto-compact=true
|
|||
[routing]
|
||||
routing.strictgraphpruning=true
|
||||
|
||||
[Wtclient]
|
||||
wtclient.active=1
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
[Wtclient]
|
||||
wtclient.active=1
|
||||
|
|
@ -109,7 +109,7 @@ def update_lightning_info():
|
|||
lightning_channel_balance = lnd_get("/balance/channels")
|
||||
lightning_wallet_balance = lnd_get("/balance/blockchain")
|
||||
log_message("update_lightning_info - GET WATCHTOWER")
|
||||
if is_watchtower_enabled():
|
||||
if is_watchtower_server_enabled():
|
||||
lightning_watchtower_server_info = lnd_get_v2("/watchtower/server")
|
||||
towers = lnd_get_v2("/watchtower/client?include_sessions=1")
|
||||
log_message("update_lightning_info - TOWER DETAILS")
|
||||
|
@ -682,15 +682,25 @@ def get_lnd_alias_file_data():
|
|||
return "ERROR"
|
||||
return "ERROR"
|
||||
|
||||
def is_watchtower_enabled():
|
||||
def is_watchtower_server_enabled():
|
||||
return settings_file_exists("watchtower_enabled")
|
||||
|
||||
def enable_watchtower():
|
||||
def enable_watchtower_server():
|
||||
create_settings_file("watchtower_enabled")
|
||||
|
||||
def disable_watchtower():
|
||||
def disable_watchtower_server():
|
||||
delete_settings_file("watchtower_enabled")
|
||||
|
||||
|
||||
def is_watchtower_client_enabled():
|
||||
return settings_file_exists("watchtower_client_enabled")
|
||||
|
||||
def enable_watchtower_client():
|
||||
create_settings_file("watchtower_client_enabled")
|
||||
|
||||
def disable_watchtower_client():
|
||||
delete_settings_file("watchtower_client_enabled")
|
||||
|
||||
# Only call from www process which has data
|
||||
def update_lightning_json_cache():
|
||||
global LIGHTNING_CACHE_FILE
|
||||
|
|
|
@ -78,7 +78,6 @@ def page_lnd():
|
|||
"wallet_logged_in": wallet_logged_in,
|
||||
"lnd_has_error": lnd_has_error,
|
||||
"using_lnd_custom_config": using_lnd_custom_config(),
|
||||
"watchtower_enabled": is_watchtower_enabled(),
|
||||
"version": get_lnd_version(),
|
||||
"loop_version": get_loop_version(),
|
||||
"pool_version": get_pool_version(),
|
||||
|
@ -93,7 +92,6 @@ def page_lnd():
|
|||
"wallet_exists": wallet_exists,
|
||||
"wallet_logged_in": wallet_logged_in,
|
||||
"lnd_has_error": lnd_has_error,
|
||||
"watchtower_enabled": is_watchtower_enabled(),
|
||||
"alias": alias,
|
||||
"status": get_lnd_status(),
|
||||
"version": get_lnd_version(),
|
||||
|
@ -114,7 +112,6 @@ def page_lnd():
|
|||
"wallet_exists": wallet_exists,
|
||||
"wallet_logged_in": False,
|
||||
"lnd_has_error": lnd_has_error,
|
||||
"watchtower_enabled": is_watchtower_enabled(),
|
||||
"alias": alias,
|
||||
"status": "Waiting on LND data...",
|
||||
"version": get_lnd_version(),
|
||||
|
@ -201,7 +198,6 @@ def page_lnd():
|
|||
"uri": uri,
|
||||
"ip": ip,
|
||||
"channel_db_size": lnd_get_channel_db_size(),
|
||||
"watchtower_enabled": is_watchtower_enabled(),
|
||||
"lit_password": get_lnd_lit_password(),
|
||||
"lnd_deposit_address": lnd_deposit_address,
|
||||
"channel_balance": format_sat_amount(balance_info["channel_balance"]),
|
||||
|
@ -519,14 +515,28 @@ def lnd_config_page():
|
|||
}
|
||||
return render_template('lnd_config.html', **templateData)
|
||||
|
||||
@mynode_lnd.route("/lnd/watchtower/set_watchtower_enabled")
|
||||
def lnd_set_watchtower_enabled_page():
|
||||
@mynode_lnd.route("/lnd/watchtower/set_watchtower_server_enabled")
|
||||
def lnd_set_watchtower_server_enabled_page():
|
||||
check_logged_in()
|
||||
|
||||
if request.args.get("enabled") and request.args.get("enabled") == "1":
|
||||
enable_watchtower()
|
||||
enable_watchtower_server()
|
||||
else:
|
||||
disable_watchtower()
|
||||
disable_watchtower_server()
|
||||
|
||||
restart_lnd()
|
||||
|
||||
flash("Watchtower settings updated!", category="message")
|
||||
return redirect(url_for(".page_lnd_watchtower"))
|
||||
|
||||
@mynode_lnd.route("/lnd/watchtower/set_watchtower_client_enabled")
|
||||
def lnd_set_watchtower_client_enabled_page():
|
||||
check_logged_in()
|
||||
|
||||
if request.args.get("enabled") and request.args.get("enabled") == "1":
|
||||
enable_watchtower_client()
|
||||
else:
|
||||
disable_watchtower_client()
|
||||
|
||||
restart_lnd()
|
||||
|
||||
|
@ -544,8 +554,9 @@ def page_lnd_watchtower():
|
|||
|
||||
templateData = {
|
||||
"title": "myNode Lightning Watchtower",
|
||||
"watchtower_server_enabled": is_watchtower_enabled(),
|
||||
"watchtower_server_enabled": is_watchtower_server_enabled(),
|
||||
"watchtower_server_uri": Markup(watchtower_server_info["watchtower_server_uri"]),
|
||||
"watchtower_client_enabled": is_watchtower_client_enabled(),
|
||||
"watchtower_client_towers": watchtower_client_towers,
|
||||
"watchtower_client_stats": watchtower_client_stats,
|
||||
"watchtower_client_policy": watchtower_client_policy,
|
||||
|
|
|
@ -23,11 +23,26 @@
|
|||
enabled=$('#watchtower_server_enabled_checkbox').is(":checked")
|
||||
if (enabled)
|
||||
{
|
||||
window.location.href='/lnd/watchtower/set_watchtower_enabled?enabled=1'
|
||||
window.location.href='/lnd/watchtower/set_watchtower_server_enabled?enabled=1'
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href='/lnd/watchtower/set_watchtower_enabled?enabled=0'
|
||||
window.location.href='/lnd/watchtower/set_watchtower_server_enabled?enabled=0'
|
||||
}
|
||||
});
|
||||
|
||||
$('#watchtower_client_enabled_checkbox').change(function () {
|
||||
$("#watchtower_client_enabled_save").show();
|
||||
});
|
||||
$("#watchtower_client_enabled_save").on("click", function() {
|
||||
enabled=$('#watchtower_client_enabled_checkbox').is(":checked")
|
||||
if (enabled)
|
||||
{
|
||||
window.location.href='/lnd/watchtower/set_watchtower_client_enabled?enabled=1'
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href='/lnd/watchtower/set_watchtower_client_enabled?enabled=0'
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -88,11 +103,24 @@
|
|||
<div class="info_tile">
|
||||
<div class="info_tile_header">Status</div>
|
||||
<div class="info_tile_contents">
|
||||
Enabled
|
||||
<table class="info_table">
|
||||
<tr>
|
||||
<th>Enabled</th>
|
||||
<td>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="watchtower_client_enabled_checkbox" {% if watchtower_client_enabled %}checked{% endif %}>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<br/>
|
||||
<button id="watchtower_client_enabled_save" style="display: none; margin-top: 5px;" class="ui-button ui-widget ui-corner-all settings_button_small">Save</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if watchtower_client_enabled %}
|
||||
<div class="app_tile_row">
|
||||
<div class="info_tile">
|
||||
<div class="info_tile_header">Active Towers</div>
|
||||
|
@ -203,6 +231,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% include 'includes/footer.html' %}
|
||||
</body>
|
||||
|
|
Loading…
Reference in New Issue
Block a user