support for getting shortlinks on upload

This commit is contained in:
Jack L. Frost 2015-06-22 03:13:44 +03:00
parent 78b17aa234
commit 828e6a3c53

7
sup
View File

@ -83,14 +83,15 @@ sup.upload() {
sup.get_hash "$file"
file_url=$( curl -fsL "${cfg_service_url}/api?mode=file&file=${file_hash}&direct=1" )
file_url=$( curl -fsL "${cfg_service_url}/api?mode=file&file=${file_hash}&direct=1&short=${flag_shortlink}" )
if ! (( $? )); then
printf '%s\n' "$file_url"
else
if curl -fsL \
if curl -sL \
-F file="@$file" \
-F upload_mode='api' \
-F flag_private="$flag_private" \
-F short="$flag_shortlink" \
-F secret="$secret" \
-F submit="" \
-A 'zerofiles.org upload script' \
@ -200,6 +201,7 @@ sup.set_argv() {
main() {
declare args file target flag_private flag_rm flag_scrot flag_scrot_fullscreen cfg_scrot_delay
declare flag_shortlink=0
while [[ "$1" ]]; do
case "$1" in
@ -213,6 +215,7 @@ main() {
flag_scrot_fullscreen='1'
;;
-S|--short) flag_shortlink='1';;
-u|--url) action='url';;
-h|--help|--usage) sup.usage; return;;