Skip to content

Commit

Permalink
Don't show curl errors
Browse files Browse the repository at this point in the history
Signed-off-by: yubiuser <[email protected]>
  • Loading branch information
yubiuser committed Jul 17, 2024
1 parent a0054e8 commit 0b55137
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions padd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ TestAPIAvailability() {
API_URL="${API_URL#\"}"

# Test if the API is available at this URL
availabilityResponse=$(curl -skS -o /dev/null -w "%{http_code}" "${API_URL}auth")
availabilityResponse=$(curl -sk -o /dev/null -w "%{http_code}" "${API_URL}auth")

# Test if http status code was 200 (OK) or 401 (authentication required)
if [ ! "${availabilityResponse}" = 200 ] && [ ! "${availabilityResponse}" = 401 ]; then
Expand Down Expand Up @@ -217,7 +217,7 @@ DeleteSession() {
# SID is not null (successful authenthication only), delete the session
if [ "${validSession}" = true ] && [ ! "${SID}" = null ]; then
# Try to delete the session. Omit the output, but get the http status code
deleteResponse=$(curl -skS -o /dev/null -w "%{http_code}" -X DELETE "${API_URL}auth" -H "Accept: application/json" -H "sid: ${SID}")
deleteResponse=$(curl -sk -o /dev/null -w "%{http_code}" -X DELETE "${API_URL}auth" -H "Accept: application/json" -H "sid: ${SID}")

printf "\n\n"
case "${deleteResponse}" in
Expand All @@ -232,7 +232,7 @@ DeleteSession() {
}

Authenticate() {
sessionResponse="$(curl -skS -X POST "${API_URL}auth" --user-agent "PADD ${padd_version}" --data "{\"password\":\"${password}\"}" )"
sessionResponse="$(curl -sk -X POST "${API_URL}auth" --user-agent "PADD ${padd_version}" --data "{\"password\":\"${password}\"}" )"

if [ -z "${sessionResponse}" ]; then
moveXOffset; echo "No response from FTL server. Please check connectivity and use the options to set the API URL"
Expand All @@ -247,7 +247,7 @@ Authenticate() {
GetFTLData() {
local response
# get the data from querying the API as well as the http status code
response=$(curl -skS -w "%{http_code}" -X GET "${API_URL}$1" -H "Accept: application/json" -H "sid: ${SID}" )
response=$(curl -sk -w "%{http_code}" -X GET "${API_URL}$1" -H "Accept: application/json" -H "sid: ${SID}" )

# status are the last 3 characters
status=$(printf %s "${response#"${response%???}"}")
Expand Down Expand Up @@ -1611,7 +1611,7 @@ Update() {
fi
elif which curl > /dev/null 2>&1; then
echo "${check_box_info} Downloading PADD update via curl ..."
if curl -sSL https://install.padd.sh -o "${padd_script_path}" > /dev/null 2>&1; then
if curl -sL https://install.padd.sh -o "${padd_script_path}" > /dev/null 2>&1; then
echo "${check_box_good} ... done. Restart PADD for the update to take effect"
else
echo "${check_box_bad} Cannot download PADD update via curl"
Expand Down

0 comments on commit 0b55137

Please sign in to comment.