4876 lnbits (#4877)

* #4878 respect old LNBITS_ADMIN_UI setting
* #4876 lnbits option to switch ADMINUI
* #4876 add no new accounts option
* #4876 remove accounts option again
This commit is contained in:
/rootzoll 2024-12-18 11:37:54 +01:00 committed by rootzoll
parent 7989b4c54d
commit 96ac514a9a

View File

@ -226,6 +226,14 @@ Consider adding a IP2TOR Bridge under OPTIONS."
OPTIONS+=(MIGRATE-DB "Migrate SQLite to PostgreSQL database")
fi
# Admin UI
activatedAdminUI=$(sudo grep -c "LNBITS_ADMIN_UI=true" $lnbitsConfig)
if [ ${activatedAdminUI} -eq 0 ]; then
OPTIONS+=(ADMINUI "Activate 'Admin UI'")
else
OPTIONS+=(ADMINUI "Deactivate 'Admin UI'")
fi
WIDTH=66
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
HEIGHT=$((CHOICE_HEIGHT + 7))
@ -286,6 +294,24 @@ Consider adding a IP2TOR Bridge under OPTIONS."
read key
exit 0
;;
ADMINUI)
clear
echo
if [ ${activatedAdminUI} -eq 0 ]; then
echo "Activate Admin UI"
sudo sed -i "/^LNBITS_ADMIN_UI=/d" $lnbitsConfig
sudo bash -c "echo 'LNBITS_ADMIN_UI=true' >> ${lnbitsConfig}"
else
echo "Deactivate Admin UI"
sudo sed -i "/^LNBITS_ADMIN_UI=/d" $lnbitsConfig
sudo bash -c "echo 'LNBITS_ADMIN_UI=false' >> ${lnbitsConfig}"
fi
echo "Restarting LNbits ..."
sudo systemctl restart lnbits
echo "PRESS ENTER to continue"
read key
exit 0
;;
RESTORE)
clear
# check if backup exist
@ -780,16 +806,17 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
echo "# preparing env file"
# delete old .env file or old symbolic link
sudo rm /home/lnbits/lnbits/.env 2>/dev/null
# make sure .env file exists at data drive
sudo -u lnbits touch $lnbitsConfig
if [ ! -f $lnbitsConfig ]; then
sudo -u lnbits touch $lnbitsConfig
sudo bash -c "echo 'LNBITS_ADMIN_UI=true' >> ${lnbitsConfig}"
fi
sudo chown lnbits:lnbits $lnbitsConfig
# crete symbolic link
sudo -u lnbits ln -s $lnbitsConfig /home/lnbits/lnbits/.env
# activate admin user
sudo sed -i "/^LNBITS_ADMIN_UI=/d" $lnbitsConfig
sudo bash -c "echo 'LNBITS_ADMIN_UI=true' >> ${lnbitsConfig}"
if [ ! -e /mnt/hdd/app-data/LNBits/database.sqlite3 ]; then
echo "# install database: PostgreSQL"