mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 19:14:27 +05:00
fix: code cleanup
This commit is contained in:
@@ -466,32 +466,6 @@ moonraker_conf_creation(){
|
||||
#********************************************************************************************#
|
||||
##############################################################################################
|
||||
|
||||
# add_trusted_clients_dialog(){
|
||||
# #ask user for more trusted clients
|
||||
# while true; do
|
||||
# echo
|
||||
# top_border
|
||||
# echo -e "| Apart from devices of your local network, you can add |"
|
||||
# echo -e "| additional trusted clients to the moonraker.conf file |"
|
||||
# bottom_border
|
||||
# read -p "${cyan}###### Add additional trusted clients? (y/N):${default} " yn
|
||||
# case "$yn" in
|
||||
# Y|y|Yes|yes)
|
||||
# echo -e "###### > Yes"
|
||||
# ADD_TRUSTED_CLIENT="true"
|
||||
# custom_trusted_clients
|
||||
# break;;
|
||||
# N|n|No|no|"")
|
||||
# echo -e "###### > No"
|
||||
# ADD_TRUSTED_CLIENT="false"
|
||||
# break;;
|
||||
# *)
|
||||
# print_unkown_cmd
|
||||
# print_msg && clear_msg;;
|
||||
# esac
|
||||
# done
|
||||
# }
|
||||
|
||||
process_octoprint_dialog(){
|
||||
#ask user to disable octoprint when its service was found
|
||||
if [ "$OCTOPRINT_ENABLED" = "true" ]; then
|
||||
@@ -621,104 +595,4 @@ process_haproxy_lighttpd_dialog(){
|
||||
esac
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
#############################################################
|
||||
#############################################################
|
||||
|
||||
# setup_moonraker_conf(){
|
||||
# if [ "$MOONRAKER_CONF_FOUND" = "false" ]; then
|
||||
# status_msg "Creating moonraker.conf ..."
|
||||
# cp ${HOME}/kiauh/resources/moonraker.conf ${HOME}
|
||||
# ok_msg "moonraker.conf created!"
|
||||
# status_msg "Writing trusted clients to config ..."
|
||||
# write_default_trusted_clients
|
||||
# ok_msg "Trusted clients written!"
|
||||
# fi
|
||||
# #check for at least one trusted client in an already existing moonraker.conf
|
||||
# #if no entry is found, write default trusted client
|
||||
# if [ "$MOONRAKER_CONF_FOUND" = "true" ]; then
|
||||
# if grep "trusted_clients:" ${HOME}/moonraker.conf -q; then
|
||||
# TC_LINE=$(grep -n "trusted_clients:" ${HOME}/moonraker.conf | cut -d ":" -f1)
|
||||
# FIRST_IP_LINE=$(expr $TC_LINE + 1)
|
||||
# FIRST_IP=$(sed -n "$FIRST_IP_LINE"p ${HOME}/moonraker.conf | cut -d" " -f5)
|
||||
# #if [[ ! $FIRST_IP =~ ([0-9].[0-9].[0-9].[0-9]) ]]; then
|
||||
# if [ "$FIRST_IP" = "" ]; then
|
||||
# status_msg "Writing trusted clients to config ..."
|
||||
# backup_moonraker_conf && write_default_trusted_clients
|
||||
# ok_msg "Trusted clients written!"
|
||||
# fi
|
||||
# fi
|
||||
# fi
|
||||
# }
|
||||
|
||||
# #############################################################
|
||||
# #############################################################
|
||||
|
||||
# custom_trusted_clients(){
|
||||
# if [ "$ADD_TRUSTED_CLIENT" = "true" ]; then
|
||||
# unset trusted_arr
|
||||
# echo
|
||||
# top_border
|
||||
# echo -e "| You can now add additional trusted clients to your |"
|
||||
# echo -e "| moonraker.conf file. Be warned, that there is no |"
|
||||
# echo -e "| spellcheck to check for valid input. |"
|
||||
# echo -e "| Make sure to type the IP correct! |"
|
||||
# echo -e "| |"
|
||||
# echo -e "| If you want to add IP ranges, you can type in e.g.: |"
|
||||
# echo -e "| 192.168.1.0/24 |"
|
||||
# echo -e "| This will add the IPs 192.168.1.1 to 192.168.1.254 |"
|
||||
# echo -e "|-------------------------------------------------------|"
|
||||
# echo -e "| You can add as many IPs / IP ranges as you want. |"
|
||||
# echo -e "| When you are done type '${cyan}done${default}' to exit this dialoge. |"
|
||||
# bottom_border
|
||||
# while true; do
|
||||
# read -p "${cyan}###### Enter IP and press ENTER:${default} " TRUSTED_IP
|
||||
# case "$TRUSTED_IP" in
|
||||
# done)
|
||||
# echo
|
||||
# echo -e "List of IPs to add:"
|
||||
# for ip in ${trusted_arr[@]}
|
||||
# do
|
||||
# echo -e "${cyan}● $ip ${default}"
|
||||
# done
|
||||
# while true; do
|
||||
# echo
|
||||
# echo -e "Select 'Yes' to confirm, 'No' to start again"
|
||||
# echo -e "or 'Q' to abort and skip."
|
||||
# read -p "${cyan}###### Confirm writing (Y/n/q):${default} " yn
|
||||
# case "$yn" in
|
||||
# Y|y|Yes|yes|"")
|
||||
# echo -e "###### > Yes"
|
||||
# TUSTED_CLIENT_CONFIRM="true"
|
||||
# break;;
|
||||
# N|n|No|no)
|
||||
# echo -e "###### > No"
|
||||
# custom_trusted_clients
|
||||
# break;;
|
||||
# Q|q)
|
||||
# unset trusted_arr
|
||||
# echo -e "###### > Abort"
|
||||
# echo -e "${red}Aborting ...${default}"
|
||||
# break;;
|
||||
# esac
|
||||
# done
|
||||
# break;;
|
||||
# *)
|
||||
# trusted_arr+=($TRUSTED_IP);;
|
||||
# esac
|
||||
# done
|
||||
# fi
|
||||
# }
|
||||
|
||||
# write_custom_trusted_clients(){
|
||||
# if [ "$TUSTED_CLIENT_CONFIRM" = "true" ]; then
|
||||
# if [ "${#trusted_arr[@]}" != "0" ]; then
|
||||
# for ip in ${trusted_arr[@]}
|
||||
# do
|
||||
# sed -i "/trusted_clients\:/a \ \ \ \ $ip" ${HOME}/moonraker.conf
|
||||
# done
|
||||
# ok_msg "Custom IPs written to moonraker.conf!"
|
||||
# fi
|
||||
# fi
|
||||
# }
|
||||
}
|
||||
Reference in New Issue
Block a user