From d37658ab408c9e98c21e0f6360843107ed911c5c Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Tue, 1 Sep 2020 11:41:59 +0200 Subject: [PATCH] Update upload_file.sh, add shrink_url.sh, rename twist-dl.node to twist-dl.sh --- push_file.sh | 18 ------------------ shrink_url.sh | 17 +++++++++++++++++ twist-dl.node => twist-dl.sh | 0 upload_file.sh | 18 ++++++++++++++++++ 4 files changed, 35 insertions(+), 18 deletions(-) delete mode 100755 push_file.sh create mode 100755 shrink_url.sh rename twist-dl.node => twist-dl.sh (100%) create mode 100755 upload_file.sh diff --git a/push_file.sh b/push_file.sh deleted file mode 100755 index 4239746..0000000 --- a/push_file.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -local_file=$1 -token=$(cat $HOME/.ily_token) - -if test -z "$2"; then - curl -X POST -H 'Accept: text/plain' \ - -H "Authorization: $token" \ - -F 'upload=@'$local_file \ - -F 'ttl=2592000' \ - https://ily.li/ -else - curl -X PUT -H 'Accept: text/plain' \ - -H "Authorization: $token" \ - -F 'upload=@'$local_file \ - -F 'ttl=2592000' \ - "https://ily.li/$2" -fi diff --git a/shrink_url.sh b/shrink_url.sh new file mode 100755 index 0000000..667e434 --- /dev/null +++ b/shrink_url.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +target_url=$1 +slug=$2 +token=$(cat "$HOME/.ily_token") + +if test -z "$slug"; then + method=POST +else + method=PUT +fi + +curl -X $method -H 'Accept: text/plain' \ + -H "Authorization: $token" \ + -F 'type=url' \ + -F "target_url=$target_url" \ + "https://ily.li/$slug" diff --git a/twist-dl.node b/twist-dl.sh similarity index 100% rename from twist-dl.node rename to twist-dl.sh diff --git a/upload_file.sh b/upload_file.sh new file mode 100755 index 0000000..d4a1890 --- /dev/null +++ b/upload_file.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +local_file=$1 +slug=$2 +token=$(cat "$HOME/.ily_token") + +if test -z "$slug"; then + method=POST +else + method=PUT +fi + +curl -X $method -H 'Accept: text/plain' \ + -H "Authorization: $token" \ + -F 'type=file' \ + -F "upload=@$local_file" \ + -F 'ttl=2592000' \ + "https://ily.li/$slug"