From 828e6a3c539225d5f0ea47483a911161ac6b5579 Mon Sep 17 00:00:00 2001 From: fbt Date: Mon, 22 Jun 2015 03:13:44 +0300 Subject: [PATCH] support for getting shortlinks on upload --- sup | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sup b/sup index f061aa0..c679193 100755 --- a/sup +++ b/sup @@ -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;;