Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress curl and floating number conversion #397

Closed
wants to merge 4 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1634,7 +1634,7 @@ Update() {

echo "${check_box_info} Downloading PADD update ..."

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"
Expand Down
Loading