@@ -94,7 +94,7 @@ get_album_id() {
|
||||
return 1
|
||||
}
|
||||
|
||||
get_api_status <<< "$api_response"
|
||||
get_api_status <<< "$api_response" || return 1
|
||||
|
||||
if (( api_status == 200 )); then
|
||||
album_id=$( jq -r '.data.album.id' <<< "$api_response" )
|
||||
@@ -184,7 +184,7 @@ upload() {
|
||||
file_url_request='url'
|
||||
fi
|
||||
|
||||
get_api_status <<< "$api_response"
|
||||
get_api_status <<< "$api_response" || return 1
|
||||
|
||||
if (( api_status == 200 )); then
|
||||
file_link=$( jq -r ".data.${file_url_request}" <<< "$api_response" )
|
||||
@@ -223,7 +223,7 @@ get_shortlink() {
|
||||
return 1
|
||||
}
|
||||
|
||||
get_api_status <<< "$api_response"
|
||||
get_api_status <<< "$api_response" || return 1
|
||||
|
||||
if (( api_status == 200 )); then
|
||||
read -r short_url < <(
|
||||
@@ -243,13 +243,17 @@ get_api_status() {
|
||||
jq -r '.status.code, .status.message'
|
||||
)
|
||||
|
||||
if ! [[ $api_status ]]; then
|
||||
printf -v _ '%d' "$api_status" || {
|
||||
err "Got invalid status from the api: $api_status"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
if (( api_status >= 400 )); then
|
||||
(( api_status >= 400 )) && {
|
||||
err "Error: $api_status, $api_status_message"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
_mktemp() {
|
||||
@@ -276,7 +280,7 @@ get_my_ip() {
|
||||
return 1
|
||||
}
|
||||
|
||||
get_api_status <<< "$api_response"
|
||||
get_api_status <<< "$api_response" || return 1
|
||||
|
||||
if (( api_status == 200 )); then
|
||||
my_ip=$( jq -r '.data.ip' <<< "$api_response" )
|
||||
|
||||
Reference in New Issue
Block a user