Add lnbits setting options (thanks to tlindi)
This commit is contained in:
parent
af51e8532e
commit
75a2a38f60
|
@ -15,15 +15,15 @@ ExecStartPre=/usr/bin/service_scripts/pre_lnbits.sh
|
|||
WorkingDirectory=/opt/mynode/lnbits
|
||||
|
||||
ExecStart=/usr/bin/docker run --rm \
|
||||
--name lnbits-legend \
|
||||
--name lnbits \
|
||||
-p 5000:5000 \
|
||||
--volume /mnt/hdd/mynode/lnbits/.env:/app/.env \
|
||||
--volume /mnt/hdd/mynode/lnbits/:/app/data \
|
||||
--volume /mnt/hdd/mynode/lnd/tls.cert:/app/tls.cert \
|
||||
--volume /mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/admin.macaroon:/app/admin.macaroon \
|
||||
--add-host=host.docker.internal:host-gateway \
|
||||
lnbits-legend
|
||||
ExecStop=/usr/bin/docker stop -t 2 lnbits-legend
|
||||
lnbits
|
||||
ExecStop=/usr/bin/docker stop -t 2 lnbits
|
||||
|
||||
User=bitcoin
|
||||
Group=bitcoin
|
||||
|
|
|
@ -217,7 +217,7 @@ while true; do
|
|||
# Handled in pre_lnbits.sh
|
||||
|
||||
# Build lnbits docker container
|
||||
docker build --no-cache -t lnbits-legend .
|
||||
docker build --no-cache -t lnbits .
|
||||
|
||||
echo $LNBITS_VERSION > $LNBITS_VERSION_FILE
|
||||
fi
|
||||
|
|
|
@ -1228,6 +1228,19 @@ def clear_mempool_cache():
|
|||
os.system("sync")
|
||||
os.system("systemctl restart mempool")
|
||||
|
||||
#==================================
|
||||
# LNbits Functions
|
||||
#==================================
|
||||
def delete_lnbits_settings():
|
||||
os.system("rm -rf /mnt/hdd/mynode/lnbits/.super_user")
|
||||
os.system("/usr/bin/docker run --rm \
|
||||
--name lnbits-delete-settings \
|
||||
--volume /mnt/hdd/mynode/lnbits/.env:/app/.env \
|
||||
--volume /mnt/hdd/mynode/lnbits/:/app/data \
|
||||
lnbits poetry run lnbits-cli delete-settings")
|
||||
if is_service_enabled("lnbits"):
|
||||
restart_service("lnbits")
|
||||
|
||||
#==================================
|
||||
# Specter Functions
|
||||
#==================================
|
||||
|
|
|
@ -313,4 +313,22 @@ def api_get_usb_info():
|
|||
data["status"] = "success"
|
||||
except Exception as e:
|
||||
data["data"] = str(e)
|
||||
return generate_api_json_response(data)
|
||||
|
||||
@mynode_api.route("/api/get_lnbits_superuser")
|
||||
def api_get_lnbits_superuser():
|
||||
check_logged_in()
|
||||
|
||||
data = {}
|
||||
data["status"] = "error"
|
||||
data["data"] = "UNKNOWN"
|
||||
try:
|
||||
info = ""
|
||||
|
||||
info += to_string(subprocess.check_output("cat /mnt/hdd/mynode/lnbits/.super_user", shell=True))
|
||||
info += "\n"
|
||||
data["data"] = info
|
||||
data["status"] = "success"
|
||||
except Exception as e:
|
||||
data["data"] = str(e)
|
||||
return generate_api_json_response(data)
|
|
@ -591,6 +591,16 @@ def reset_thunderhub_config_page():
|
|||
flash("Thunderhub Configuration Reset", category="message")
|
||||
return redirect("/settings")
|
||||
|
||||
@mynode_settings.route("/settings/delete-lnbits-settings")
|
||||
def delete_lnbits_settings_page():
|
||||
check_logged_in()
|
||||
|
||||
t = Timer(1.0, delete_lnbits_settings)
|
||||
t.start()
|
||||
|
||||
flash("LNbits Settings Deleted", category="message")
|
||||
return redirect("/settings")
|
||||
|
||||
@mynode_settings.route("/settings/reset-specter-config")
|
||||
def reset_specter_config_page():
|
||||
check_logged_in()
|
||||
|
|
|
@ -710,6 +710,17 @@
|
|||
$('#loading_spinner_overlay').fadeIn();
|
||||
window.location.href='/settings/toggle_setting?name=torify_apt_get&enable='+val
|
||||
});
|
||||
|
||||
$("#run-lnbits-cli-superuser").on("click", function() {
|
||||
$("#run-lnbits-cli-superuser").prop("disabled",true);
|
||||
$("#run-lnbits-cli-superuser-result").html("Loading...");
|
||||
$.get("/api/get_lnbits_superuser")
|
||||
.done(function( data ) {
|
||||
$("#run-lnbits-cli-superuser").prop("disabled",false);
|
||||
$("#run-lnbits-cli-superuser-result").html( data["data"] );
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
function hideAllUpgradeLogs() {
|
||||
|
@ -1215,6 +1226,25 @@
|
|||
</div>
|
||||
|
||||
|
||||
<div class="settings_block">
|
||||
<a id="lnbits"></a>
|
||||
<div class="settings_block_header">LNbits</div>
|
||||
|
||||
<div class="settings_block_subheader">Reset LNbits Settings</div>
|
||||
This will delete your LNbits settings from the database. This should not impact users, wallets and installed extension data. After deletion, LNbits will re-read its default settings from the environment file and save it in the new settings database. This will also reset super user username and password.
|
||||
<br/>
|
||||
<a href="/settings/delete-lnbits-settings" class="ui-button ui-widget ui-corner-all settings_button">Delete Settings</a>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Show LNbits superuser ID</div>
|
||||
Show the superuser ID for LNbits. It is needed to access the admin UI.
|
||||
<br/>
|
||||
<button id="run-lnbits-cli-superuser" class="ui-button ui-widget ui-corner-all settings_button">Show Superuser ID</button>
|
||||
<pre id="run-lnbits-cli-superuser-result"></pre>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="settings_block">
|
||||
<a id="specter"></a>
|
||||
<div class="settings_block_header">Specter</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user