Browse Source

group curl settings and make em configurable at the same time

Signed-off-by: fbt <fbt@fleshless.org>
master
Jack L. Frost 2 years ago
parent
commit
522dc0e1f6
  1. 14
      ufw

14
ufw

@ -23,6 +23,8 @@ msg() {
err() { printf '(error) %s\n' "$*" >&2; }
curl() { command curl -sL "$@"; }
usage() {
_cat <<- EOF
Usage: ufw [-RsF] [-D num] [file/url]
@ -81,7 +83,7 @@ get_max_filesize() {
get_album_id() {
declare api_response api_status api_status_message
api_response=$( curl -fsL "$cfg_service_url/albumctl.json?m=new&name=$1&secret=$secret" )
api_response=$( curl -f "$cfg_service_url/albumctl.json?m=new&name=$1&secret=$secret" )
get_api_status <<< "$api_response"
@ -110,7 +112,7 @@ upload() {
get_max_filesize || { return 1; }
curl --max-filesize "$max_filesize_bytes" -sL "$target" > "$file"
curl --max-filesize "$max_filesize_bytes" "$target" > "$file"
curl_result=$?
if (( curl_result )); then
@ -136,7 +138,7 @@ upload() {
get_album_id "$album_name"
fi
api_response=$( curl -sL \
api_response=$( curl \
-F file="@$file" \
-F api_format='json' \
-F flag_private="$flag_private" \
@ -183,7 +185,7 @@ upload() {
get_shortlink() {
declare url=$1 api_response api_status api_status_message
api_response=$( curl -sL "$cfg_service_url/shrink.json?url=${url}&secret=$secret" )
api_response=$( curl "$cfg_service_url/shrink.json?url=${url}&secret=$secret" )
get_api_status <<< "$api_response"
if (( api_status == 200 )); then
@ -225,7 +227,7 @@ _mktemp() {
get_my_ip() {
declare api_response api_status api_status_message my_ip
api_response=$( curl -sl "$cfg_service_url/ip.json" )
api_response=$( curl "$cfg_service_url/ip.json" )
get_api_status <<< "$api_response"
@ -240,7 +242,7 @@ get_my_ip() {
login() {
declare api_response
api_response=$( curl -sl "$cfg_service_url/token_request.json?login=$login" )
api_response=$( curl "$cfg_service_url/token_request.json?login=$login" )
if get_api_status <<< "$api_response"; then
printf 'Check your email.\n'

Loading…
Cancel
Save