Compare commits

...

5 Commits

Author SHA1 Message Date
Michel Roegl-Brunner
a81defdae7
Merge deaf6918e9 into ff06d417b5 2025-01-28 12:15:33 +01:00
Michel Roegl-Brunner
deaf6918e9
Update build.func 2025-01-28 10:42:04 +01:00
Michel Roegl-Brunner
3677d116fb
Update build.func 2025-01-28 10:03:41 +01:00
Michel Roegl-Brunner
c04ec818fe Update build.func 2025-01-28 09:29:38 +01:00
Michel Roegl-Brunner
00cd62fc38 Update build.func 2025-01-27 16:14:04 +01:00

View File

@ -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.
@ -789,6 +791,37 @@ advanced_settings() {
fi
}
post_to_api() {
local API_URL="http://api.community-scripts.org/upload"
JSON_PAYLOAD=$(cat <<EOF
{
"ct_type": $CT_TYPE,
"disk_size": $DISK_SIZE,
"core_count": $CORE_COUNT,
"ram_size": $RAM_SIZE,
"verbose": "$VERBOSE",
"os_type": "$var_os",
"os_version": "$var_version",
"hn": "$HN",
"disableip6": "$DISABLEIP6",
"ssh": "$SSH",
"tags": "$TAGS",
"nsapp": "$NSAPP"
}
EOF
)
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" -ne 201 ] && [ "$RESPONSE" -ne 302 ]; then
msg_error "API request failed with HTTP code $RESPONSE"
fi
}
install_script() {
pve_check
shell_check
@ -804,6 +837,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" \
@ -919,6 +957,9 @@ build_container() {
FEATURES="nesting=1"
fi
if [[ $DIAGNOSTICS == "yes" ]]; then
post_to_api
fi
TEMP_DIR=$(mktemp -d)
pushd $TEMP_DIR >/dev/null