LNbits Admin Page to allow install extensions (#4054)

* add user id to status
* activate Admin page on install
This commit is contained in:
/rootzoll 2023-08-01 22:38:32 +02:00 committed by GitHub
parent 1355a2b4a2
commit 742da1b9d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -145,7 +145,7 @@ if [ "$1" = "menu" ]; then
fundinginfo="on CLN "
fi
text="Local Web Browser: https://${localIP}:${httpsPort}"
text="https://${localIP}:${httpsPort}${authMethod}"
if [ ${#publicDomain} -gt 0 ]; then
text="${text}
@ -180,7 +180,7 @@ To enable easy reachability with normal browser from the outside
Consider adding a IP2TOR Bridge under OPTIONS."
fi
whiptail --title " LNbits ${fundinginfo}" --yes-button "OK" --no-button "OPTIONS" --yesno "${text}" 18 69
whiptail --title " LNbits ${fundinginfo}" --yes-button "OK" --no-button "OPTIONS" --yesno "${text}" 18 78
result=$?
sudo /home/admin/config.scripts/blitz.display.sh hide
echo "option (${result}) - please wait ..."
@ -377,9 +377,12 @@ if [ "$1" = "status" ]; then
echo "httpsPort='5001'"
echo "httpsForced='1'"
echo "httpsSelfsigned='1'" # TODO: change later if IP2Tor+LetsEncrypt is active
echo "authMethod='none'"
echo "publicIP='${publicIP}'"
# auth method is to call with a certain useer id
admin_userid=$(sudo cat /home/lnbits/lnbits/.super_user)
echo "authMethod='/wallet?usr=${admin_userid}'"
# check funding source
if [ "${LNBitsFunding}" == "" ]; then
LNBitsFunding="lnd"
@ -528,6 +531,9 @@ if [ "$1" = "prestart" ]; then
exit 1
fi
# protect the admin user id if exists
chmod 640 /home/lnbits/lnbits/.super_user 2>/dev/null
echo "# OK: prestart finished"
exit 0 # exit with clean code
fi
@ -752,6 +758,10 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
sudo rm /home/lnbits/lnbits/.env 2>/dev/null
sudo -u lnbits touch /home/lnbits/lnbits/.env
# activate admin user
sudo sed -i "/^LNBITS_ADMIN_UI=/d" /home/lnbits/lnbits/.env
sudo bash -c "echo 'LNBITS_ADMIN_UI=true' >> /home/lnbits/lnbits/.env"
if [ ! -e /mnt/hdd/app-data/LNBits/database.sqlite3 ]; then
echo "# install database: PostgreSQL"
# POSTGRES