Fixed the weird issues with set username showing anonymous: before the name when it shouldn't. Added annonymous configuration code.

This commit is contained in:
Storm Dragon 2023-12-15 21:21:47 -05:00
parent 270fe50aa2
commit 109a08225b

12
tojam
View File

@ -116,12 +116,21 @@ configure_ninjam() {
exit 0 exit 0
fi fi
case "${setting}" in case "${setting}" in
"anonymous")
anonymous="$(dialog --yesno "Login anonymously? (You still have a username but password is not required.)" -1 -1 --stdout)"
anonymous=$?
[[ ${anonymous} -eq 255 ]] && continue
anonymous="${anonymous/0/true}"
anonymous="${anonymous/1/false}"
sed -i "s/^anonymous=.*/anonymous=\"${anonymous}\"/" "${config}/config" &&
dialog --msgbox "Anonymous login set to ${anonymous}." -1 -1
;;
"sound driver") "sound driver")
soundDriver="$(dialog --yes-label "alsa" \ soundDriver="$(dialog --yes-label "alsa" \
--no-label "jack" \ --no-label "jack" \
--yesno "Select a sound driver" -1 -1 --stdout)" --yesno "Select a sound driver" -1 -1 --stdout)"
soundDriver=$? soundDriver=$?
[[ $? -eq 255 ]] && continue [[ ${soundDriver} -eq 255 ]] && continue
soundDriver="${soundDriver/0/alsa}" soundDriver="${soundDriver/0/alsa}"
soundDriver="${soundDriver/1/jack}" soundDriver="${soundDriver/1/jack}"
if [[ "${soundDriver}" == "jack" ]]; then if [[ "${soundDriver}" == "jack" ]]; then
@ -135,7 +144,6 @@ configure_ninjam() {
--inputbox "Enter User Name (letters, numbers, dash, and underscore accepted):" -1 -1 "${userName#*anonymous:}" --stdout)" --inputbox "Enter User Name (letters, numbers, dash, and underscore accepted):" -1 -1 "${userName#*anonymous:}" --stdout)"
menuCode=$? menuCode=$?
[[ ${menuCode} -ne 0 ]] && continue [[ ${menuCode} -ne 0 ]] && continue
[[ "${anonymous}" == "true" ]] && userName="anonymous:${userName}"
sed -i "s/^userName=.*/userName='${userName}'/" "${config}/config" && sed -i "s/^userName=.*/userName='${userName}'/" "${config}/config" &&
dialog --msgbox "Username set to \"${userName#*anonymous:}\"." -1 -1 dialog --msgbox "Username set to \"${userName#*anonymous:}\"." -1 -1
;; ;;