Add option to reset macaroons

This commit is contained in:
Taylor Helsper 2023-06-10 22:43:55 -05:00
parent dcbe995061
commit c1541f49ec
3 changed files with 34 additions and 0 deletions

View File

@ -1115,6 +1115,10 @@ def delete_lnd_watchtower_server_data():
os.system("rm -rf /mnt/hdd/mynode/lnd/data/watchtower")
return True
def delete_lnd_macaroons():
os.system("find /mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/ -name '*.macaroon' -delete")
os.system("find /mnt/hdd/mynode/lnd/data/chain/bitcoin/testnet/ -name '*.macaroon' -delete")
return True
#==================================
# Mainnet / Testnet Functions

View File

@ -730,6 +730,18 @@ def page_lnd_delete_wallet():
return redirect("/rebooting")
@mynode_settings.route("/settings/reset-macaroons")
def page_lnd_reset_macaroons():
check_logged_in()
delete_lnd_macaroons()
# Trigger reboot
t = Timer(1.0, reboot_device)
t.start()
return redirect("/rebooting")
@mynode_settings.route("/settings/reset-lnd-watchtower")
def page_lnd_reset_lnd_watchtower():
check_logged_in()

View File

@ -58,6 +58,17 @@
delete_lnd_wallet_dialog.dialog( "open" );
});
$("#reset_macaroons").on("click", function() {
var okFunction = function() {
window.location.href="/settings/reset-macaroons"
}
openConfirmDialog("confirm-dialog",
"Reset Lightning Macaroons",
"Resetting your LND Macaroons will delete them and reboot your device. You will need to re-pair any connected wallets. "+
"Would you still like to reset your macaroons?",
okFunction)
});
$("#reset_lnd_watchtower_client").on("click", function() {
var okFunction = function() {
window.location.href="/settings/reset-lnd-watchtower?type=client"
@ -1060,6 +1071,13 @@
<div class="divider"></div>
<div class="settings_block_subheader">Reset Macaroons</div>
Advanced: This will delete your LND macaroons and any paired wallets will no longer work. It will delete both mainnet and testnet macaroons if you have them.
<br/>
<button id="reset_macaroons" class="ui-button ui-widget ui-corner-all settings_button">Reset Macaroons</button>
<div class="divider"></div>
<div class="settings_block_subheader">Delete Lightning Wallet</div>
{{lnd_delete_message}}
Advanced: This will delete your Lightning Wallet. It will delete both mainnet and testnet wallets if you have them.