diff --git a/scripts/ui/upload_yesno.sh b/scripts/ui/upload_yesno.sh new file mode 100644 index 0000000..eeffade --- /dev/null +++ b/scripts/ui/upload_yesno.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +upload_yesno(){ + whiptail --title "Upload Agreement" \ + --yesno \ + "The following function will help to quickly upload logs for debugging purposes. With confirming this dialog, you agree that during that process your logs will be uploaded to: http://paste.c-net.org/ + +PLEASE NOTE: + +Be aware that logs can contain network information, private data like usernames, filenames, or other information you may not want to make public. + +Do ${red}NOT${default} use this function if you don't agree! + +Do you accept?" \ + "$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" + + local out=$? + if [ $out -eq 0 ]; then + sed -i "/logupload_accepted=/s/false/true/" $INI_FILE + clear && print_header && upload_selection + else + return + fi +} \ No newline at end of file diff --git a/scripts/upload_log.sh b/scripts/upload_log.sh index 02d6e81..b7e7230 100755 --- a/scripts/upload_log.sh +++ b/scripts/upload_log.sh @@ -1,46 +1,8 @@ #!/bin/bash -accept_upload_conditions(){ - while true; do - top_border - echo -e "| ${red}~~~~~~~~~~~ [ Upload Agreement ] ~~~~~~~~~~~~${default} |" - hr - echo -e "| The following function will help to quickly upload |" - echo -e "| logs for debugging purposes. With confirming this |" - echo -e "| dialog, you agree that during that process your logs |" - echo -e "| will be uploaded to: ${yellow}http://paste.c-net.org/${default} |" - hr - echo -e "| ${red}PLEASE NOTE:${default} |" - echo -e "| Be aware that logs can contain network information, |" - echo -e "| private data like usernames, filenames, or other |" - echo -e "| information you may not want to make public. |" - blank_line - echo -e "| Do ${red}NOT${default} use this function if you don't agree! |" - bottom_border - read -p "${cyan}Do you accept? (Y/n):${default} " yn - case "$yn" in - Y|y|Yes|yes|"") - sed -i "/logupload_accepted=/s/false/true/" $INI_FILE - clear && print_header && upload_selection - ;; - N|n|No|no) - clear - main_menu #TODO this is the issue causing main menu to not exit - break - ;; - *) - clear - print_header - print_unkown_cmd - print_msg && clear_msg - accept_upload_conditions;; - esac - done -} - upload_selection(){ source_kiauh_ini - [ "$logupload_accepted" = "false" ] && accept_upload_conditions + [ "$logupload_accepted" = "false" ] && upload_yesno ### find all suitable logfiles for klipper logfiles=()