support for getting shortlinks on upload
This commit is contained in:
parent
78b17aa234
commit
828e6a3c53
7
sup
7
sup
|
@ -83,14 +83,15 @@ sup.upload() {
|
||||||
|
|
||||||
sup.get_hash "$file"
|
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
|
if ! (( $? )); then
|
||||||
printf '%s\n' "$file_url"
|
printf '%s\n' "$file_url"
|
||||||
else
|
else
|
||||||
if curl -fsL \
|
if curl -sL \
|
||||||
-F file="@$file" \
|
-F file="@$file" \
|
||||||
-F upload_mode='api' \
|
-F upload_mode='api' \
|
||||||
-F flag_private="$flag_private" \
|
-F flag_private="$flag_private" \
|
||||||
|
-F short="$flag_shortlink" \
|
||||||
-F secret="$secret" \
|
-F secret="$secret" \
|
||||||
-F submit="" \
|
-F submit="" \
|
||||||
-A 'zerofiles.org upload script' \
|
-A 'zerofiles.org upload script' \
|
||||||
|
@ -200,6 +201,7 @@ sup.set_argv() {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
declare args file target flag_private flag_rm flag_scrot flag_scrot_fullscreen cfg_scrot_delay
|
declare args file target flag_private flag_rm flag_scrot flag_scrot_fullscreen cfg_scrot_delay
|
||||||
|
declare flag_shortlink=0
|
||||||
|
|
||||||
while [[ "$1" ]]; do
|
while [[ "$1" ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -213,6 +215,7 @@ main() {
|
||||||
flag_scrot_fullscreen='1'
|
flag_scrot_fullscreen='1'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
-S|--short) flag_shortlink='1';;
|
||||||
-u|--url) action='url';;
|
-u|--url) action='url';;
|
||||||
|
|
||||||
-h|--help|--usage) sup.usage; return;;
|
-h|--help|--usage) sup.usage; return;;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user