1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2025-02-05 07:43:22 -08:00

ensure curl -f is always set in notice

This commit is contained in:
Connor Olding 2024-07-06 17:21:02 -07:00
parent 699678a3d9
commit 981c7fa04d

View file

@ -8,8 +8,8 @@ __notice_warn() {
__notice_curl() {
curl -q --no-progress-meter 0.0.0.0 >/dev/null 2>&1
if [ $? = 2 ]
then __notice_curl() { curl -sS "$@"; }
else __notice_curl() { curl --no-progress-meter "$@"; }
then __notice_curl() { curl -fsS "$@"; }
else __notice_curl() { curl -f --no-progress-meter "$@"; }
fi
__notice_curl "$@"
}
@ -135,7 +135,7 @@ __notice_upload_to_at_oshi() {
# TODO: retrieve admin URL from response (suffixed with " [Admin]")
# NOTE: spaces are automatically converted (by the server) to underscores.
__notice_compute_form_limit "f" "${1##*/}" "${bytes:-0}" 5000000000 || return 128
raw="$(__notice_curl -fF "f=@$1" -F expire=20160 "https://$target")" || return
raw="$(__notice_curl -F "f=@$1" -F expire=20160 "https://$target")" || return
normal="https:${raw##*DL: http*:}"; normal="${normal%%[!!-~]*}"
aux="$normal"
}
@ -162,7 +162,7 @@ __notice_upload_to_net_filebin() {
__notice_generate_id "$(date -u +%s)" || return
aux="https://$target/$REPLY"
#raw="$(__notice_curl -gfT "$1" "$aux/$(__notice_urlencode ${1##*/})")" || return
raw="$(__notice_curl -gfT "$1" "$aux/")" || return
raw="$(__notice_curl -gT "$1" "$aux/")" || return
normal="${raw##*\"filename\": \"}"; normal="$aux/${normal%%\"*}"
# optional: lock the bin so nobody can edit it, but anyone can still delete it.
curl -sSX PUT "$aux" >/dev/null || true
@ -175,7 +175,7 @@ __notice_upload_to_at_x0() {
# 100 MiB files are kept for 3 days, and 0 byte files are kept for 100 days.
# filenames are randomized. cannot manually delete nor specify expiry.
__notice_compute_form_limit "file" "${1##*/}" "${bytes:-0}" 232783872 || return 128
raw="$(__notice_curl -fF "file=@$1" "https://$target")" || return
raw="$(__notice_curl -F "file=@$1" "https://$target")" || return
normal="$raw"
aux="$normal"
}
@ -186,7 +186,7 @@ __notice_upload_to_se_uguu() {
# filenames are randomized. cannot manually delete nor specify expiry.
# TODO: use fixed filename to squeeze a couple more bytes out of the limit?
__notice_compute_form_limit "files[]" "${1##*/}" "${bytes:-0}" 67108864 || return 128
raw="$(__notice_curl -fF "files[]=@$1" "https://$target/upload?output=text")" || return
raw="$(__notice_curl -F "files[]=@$1" "https://$target/upload?output=text")" || return
normal="$raw"
aux="$normal"
}
@ -197,7 +197,7 @@ __notice_upload_to_com_cockfile() {
# filenames are randomized. cannot manually delete nor specify expiry.
# must have a file extension or it gets rejected (415), so use `.bin`.
__notice_compute_form_limit "files[]" ".bin" "${bytes:-0}" 999999999 || return 128
raw="$(__notice_curl -fF "files[]=@$1;filename=.bin" "https://$target/upload.php?output=text")" || return
raw="$(__notice_curl -F "files[]=@$1;filename=.bin" "https://$target/upload.php?output=text")" || return
normal="$raw"
aux="$normal"
}
@ -209,7 +209,7 @@ __notice_upload_to_sh_envs() {
# you can delete files if you extract the X-Token field from the response HTTP headers.
# banned MIME types: application/java-archive, application/java-vm
__notice_compute_form_limit "file" "${1##*/}" "${bytes:-0}" 536870912 || return 128
raw="$(__notice_curl -fF "file=@$1" -Fsecret= -Fexpires=336 "https://$target")" || return
raw="$(__notice_curl -F "file=@$1" -Fsecret= -Fexpires=336 "https://$target")" || return
aux="$raw"
normal="$raw/${1##*/}"
}
@ -228,7 +228,7 @@ __notice_upload_to_moe_catbox_litterbox() {
else
set -- "$1" "fileToUpload=@$1"
fi
raw="$(__notice_curl -fF "$2" -Ftime=72h -Freqtype=fileupload "https://$target/resources/internals/api.php")" || return
raw="$(__notice_curl -F "$2" -Ftime=72h -Freqtype=fileupload "https://$target/resources/internals/api.php")" || return
normal="$raw"
aux="$normal"
}