From 00cd62fc384098e394cf6170e3d920c9f142495b Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Mon, 27 Jan 2025 16:14:04 +0100 Subject: [PATCH 1/4] Update build.func --- misc/build.func | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/misc/build.func b/misc/build.func index ef98462f..c7c72f65 100644 --- a/misc/build.func +++ b/misc/build.func @@ -813,6 +813,36 @@ advanced_settings() { fi } +post_to_api() { + local API_URL="http://api.htl-braunau.at/upload" + + + JSON_PAYLOAD=$(cat </dev/null From c04ec818fea547b2a9e584c1f95e1b3266f49ef4 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner Date: Tue, 28 Jan 2025 09:29:38 +0100 Subject: [PATCH 2/4] Update build.func --- misc/build.func | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/misc/build.func b/misc/build.func index c7c72f65..d4494a97 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1,6 +1,7 @@ # Copyright (c) 2021-2025 tteck # Author: tteck (tteckster) # Co-Author: MickLesk +# Co-Author: michelroegl-brunner # License: MIT # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -9,6 +10,7 @@ variables() { var_install="${NSAPP}-install" # sets the var_install variable by appending "-install" to the value of NSAPP. INTEGER='^[0-9]+([.][0-9]+)?$' # it defines the INTEGER regular expression pattern. PVEHOST_NAME=$(hostname) # gets the Proxmox Hostname and sets it to Uppercase + DIAGNOSTICS="yes" # sets the DIAGNOSTICS variable to "yes", used for the API call. } # This function sets various color variables using ANSI escape codes for formatting text in the terminal. @@ -824,7 +826,8 @@ post_to_api() { "core_count": $CORE_COUNT, "ram_size": $RAM_SIZE, "verbose": "$VERBOSE", - "ct_id": $CT_ID, + "os_type": "$var_os", + "os_version": "$var_version", "hn": "$HN", "disableip6": "$DISABLEIP6", "ssh": "$SSH", @@ -858,6 +861,11 @@ install_script() { timezone=$(cat /etc/timezone) header_info while true; do + + if ! (whiptail --backtitle "Proxmox VE Helper Scripts" --title "DIAGNOSTICS" --yesno "Send diagnostics to the maintainer? (No User Data!)" 10 58); then + DIAGNOSTICS="no" + fi + CHOICE=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SETTINGS" --menu "Choose an option:" \ 12 50 4 \ "1" "Default Settings" \ @@ -972,7 +980,10 @@ build_container() { else FEATURES="nesting=1" fi - post_to_api + + if [[ $DIAGNOSTICS == "yes" ]]; then + post_to_api + fi TEMP_DIR=$(mktemp -d) pushd $TEMP_DIR >/dev/null From 3677d116fb219c83166af081d70404cf423e2029 Mon Sep 17 00:00:00 2001 From: Michel Roegl-Brunner <73236783+michelroegl-brunner@users.noreply.github.com> Date: Tue, 28 Jan 2025 10:03:41 +0100 Subject: [PATCH 3/4] Update build.func --- misc/build.func | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/build.func b/misc/build.func index d4494a97..586c75ba 100644 --- a/misc/build.func +++ b/misc/build.func @@ -816,7 +816,7 @@ advanced_settings() { } post_to_api() { - local API_URL="http://api.htl-braunau.at/upload" + local API_URL="http://api.community-scripts.org/upload" JSON_PAYLOAD=$(cat < Date: Tue, 28 Jan 2025 10:42:04 +0100 Subject: [PATCH 4/4] Update build.func --- misc/build.func | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/build.func b/misc/build.func index 586c75ba..57918a22 100644 --- a/misc/build.func +++ b/misc/build.func @@ -837,11 +837,11 @@ post_to_api() { EOF ) - RESPONSE=$(curl -s -o response.txt -w "%{http_code}" -X POST "$API_URL" \ + RESPONSE=$(curl -s -o response.txt -w "%{http_code}" -L -X POST "$API_URL" --post301 --post302 \ -H "Content-Type: application/json" \ -d "$JSON_PAYLOAD") - - if [ ! "$RESPONSE" -eq 201 ]; then + + if [ "$RESPONSE" -ne 201 ] && [ "$RESPONSE" -ne 302 ]; then msg_error "API request failed with HTTP code $RESPONSE" fi }